MCPcopy Create free account
hub / github.com/Roy3838/Observer / insertSensor

Function insertSensor

app/src/components/EditAgent/SimpleCreatorModal.tsx:376–392  ·  view source on GitHub ↗
(tag: string)

Source from the content-addressed store, hash-verified

374 }, [systemPrompt, model, availableModels]);
375
376 const insertSensor = (tag: string) => {
377 let finalTag = tag;
378 if (tag === '$MEMORY@agent_id') {
379 finalTag = `$MEMORY@${agentId || 'your_agent_id'}`;
380 } else if (tag === '$IMEMORY@agent_id') {
381 finalTag = `$IMEMORY@${agentId || 'your_agent_id'}`;
382 }
383 if (!promptRef.current) return;
384 const { selectionStart, selectionEnd, value } = promptRef.current;
385 const newPrompt = `${value.substring(0, selectionStart)} ${finalTag} ${value.substring(selectionEnd)}`;
386 setSystemPrompt(newPrompt);
387 setTimeout(() => {
388 promptRef.current?.focus();
389 const newPos = selectionStart + finalTag.length + 2;
390 promptRef.current?.setSelectionRange(newPos, newPos);
391 }, 0);
392 };
393
394 // --- MODIFIED: toggleTool now handles showing/hiding warnings ---
395 const toggleTool = (tool: SimpleTool) => {

Callers 1

SimpleCreatorModalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected