MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / askAi

Function askAi

graph-ui/src/chat/AtlasChatPanel.tsx:298–323  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

296 };
297 }, [builtLines]);
298 const askAi = (): void => {
299 if (!props.aiAvailable || builtLines.length === 0) return;
300 setAiState('running');
301 void askModel({
302 origin: SIDECAR_ORIGIN,
303 system: READER_SYSTEM_PROMPT,
304 user: buildReaderPrompt('chat reader', readerSubjectText(builtLines)),
305 chatTemplateKwargs: nonThinkingFor(props.requestModel ?? props.modelName ?? '').chatTemplateKwargs,
306 maxTokens: readerMaxTokens(builtLines),
307 fetch: (url, init) => window.fetch(url, init),
308 ...(props.requestModel === undefined ? {} : { model: props.requestModel }),
309 }).then((reply) => {
310 const checked = applyReaderRewrite(builtLines, reply.content);
311 if (checked.kind === 'applied') {
312 setAiLines(checked.lines.map((line) => line.text));
313 setAiState('applied');
314 setAiReason('');
315 } else {
316 setAiState('refused');
317 setAiReason(checked.reason);
318 }
319 }).catch((error: unknown) => {
320 setAiState('refused');
321 setAiReason(error instanceof Error ? error.message : String(error));
322 });
323 };
324
325 return (
326 <article

Callers

nothing calls this directly

Calls 6

askModelFunction · 0.90
buildReaderPromptFunction · 0.90
readerSubjectTextFunction · 0.90
nonThinkingForFunction · 0.90
readerMaxTokensFunction · 0.90
applyReaderRewriteFunction · 0.90

Tested by

no test coverage detected