```typescript import { runTools } from "./tools.js"; import { memoryAppend, memoryGet } from "./memory.js"; import { llmChat } from "../services/ollama.js"; export async function rosalindaRespond(input: { projectId: string; userText: string; }) { const { projectId, userText } = input; const history = memoryGet(projectId); memoryAppend(projectId, { role: "user", content: userText }); const toolResult = await runTools({ projectId, userText }); const system = ` Tu es Rosalinda, l'IA privée du propriétaire. Règles: - Tu proposes des actions concrètes. - Tu peux créer des projets, lancer des jobs, manipuler des fichiers via les tools. - Tu réponds en français, clair, professionnel. `; const messages = [ { role: "system", content: system }, ...history.slice(-12), ...(toolResult ? [{ role: "assistant", content: `Résultat outil: ${toolResult}` }] : []) ]; const reply = await llmChat(messages); memoryAppend(projectId, { role: "assistant", content: reply }); return { reply, toolResult }; } ```