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

Function insertSensor

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

Source from the content-addressed store, hash-verified

375 }, [systemPrompt, model, availableModels]);
376
377 const insertSensor = (tag: string) => {
378 let finalTag = tag;
379 if (tag === '$MEMORY@agent_id') {
380 finalTag = `$MEMORY@${agentId || 'your_agent_id'}`;
381 } else if (tag === '$IMEMORY@agent_id') {
382 finalTag = `$IMEMORY@${agentId || 'your_agent_id'}`;
383 }
384 if (!promptRef.current) return;
385 const { selectionStart, selectionEnd, value } = promptRef.current;
386 const newPrompt = `${value.substring(0, selectionStart)} ${finalTag} ${value.substring(selectionEnd)}`;
387 setSystemPrompt(newPrompt);
388 setTimeout(() => {
389 promptRef.current?.focus();
390 const newPos = selectionStart + finalTag.length + 2;
391 promptRef.current?.setSelectionRange(newPos, newPos);
392 }, 0);
393 };
394
395 // lockPhone() can't ask for its permission once the agent runs in the background, so the
396 // tile asks for it here, from the tap. The tile only turns on once it's granted.

Callers 1

SimpleCreatorModalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected