Add AI prompt tool for natural language graph operations

New MCP tool and portal UI for executing natural language instructions
against the memory graph via Ollama (qwen3-coder:30b). Single LLM call
generates a JSON action plan which is executed sequentially.

Supports 8 action types: add_node, update_node, remove_node, add_edge,
remove_edge, bulk_tag, reorganize, query. Actions can reference previous
results via $result[N].field interpolation. Uses /api/chat with few-shot
assistant example, format:json, and temperature:0 for reliable output.
This commit is contained in:
2026-02-03 02:40:01 +01:00
parent f2f9d729da
commit 661325a235
11 changed files with 569 additions and 3 deletions

View File

@@ -166,4 +166,19 @@ router.post('/maintenance/run', async (_req: Request, res: Response) => {
}
});
// Prompt — AI-driven natural language instruction
router.post('/prompt', async (req: Request, res: Response) => {
try {
const { prompt } = req.body;
if (!prompt || typeof prompt !== 'string') {
return res.status(400).json({ error: 'prompt is required' });
}
const { interpretAndExecute } = await import('../core/prompt/interpreter');
const result = await interpretAndExecute(prompt);
res.json(result);
} catch (err: any) {
res.status(500).json({ error: err.message });
}
});
export default router;