feat(ipuaro): add JSON tool call parsing and improve prompts

- Add JSON fallback parsing in ResponseParser for LLMs that prefer JSON
- Add tool name aliases (get_functions -> get_lines, etc.)
- Improve system prompt with clear tool usage guidelines
- Add native Ollama tools support in OllamaClient
- Add E2E tests for full workflow with real Ollama
This commit is contained in:
imfozilbek
2025-12-05 20:51:18 +05:00
parent c82006bbda
commit 3e7762ec4e
11 changed files with 2430 additions and 102 deletions

View File

@@ -18,6 +18,7 @@ import {
buildInitialContext,
type ProjectStructure,
SYSTEM_PROMPT,
TOOL_REMINDER,
} from "../../infrastructure/llm/prompts.js"
import { parseToolCalls } from "../../infrastructure/llm/ResponseParser.js"
import type { IToolRegistry } from "../interfaces/IToolRegistry.js"
@@ -277,6 +278,12 @@ export class HandleMessage {
messages.push(...session.history)
// Add tool reminder if last message is from user (first LLM call for this query)
const lastMessage = session.history[session.history.length - 1]
if (lastMessage?.role === "user") {
messages.push(createSystemMessage(TOOL_REMINDER))
}
return messages
}