Add LLM tool calling for creating tasks, notes, and searching from chat
Ollama tool/function calling integration allows the LLM to create tasks, create notes, and search existing notes on behalf of the user during chat. Multi-round tool loop (max 5 rounds) lets the model execute tools then produce a natural language response. Tool results are persisted in a new JSONB column on messages and rendered as compact cards with linked titles. - Migration 0013: add tool_calls JSONB column to messages - New services/tools.py: tool definitions + execute_tool dispatcher - llm.py: ChatChunk dataclass, stream_chat_with_tools(), date in system prompt - generation_task.py: multi-round tool call loop with SSE tool_call events - Frontend: ToolCallRecord type, streamingToolCalls in store, ToolCallCard component, rendering in ChatMessage and ChatView streaming bubble Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
export interface ToolCallRecord {
|
||||
function: string;
|
||||
arguments: Record<string, unknown>;
|
||||
result: { success: boolean; type?: string; data?: Record<string, unknown>; error?: string };
|
||||
status: "success" | "error";
|
||||
}
|
||||
|
||||
export interface Message {
|
||||
id: number;
|
||||
conversation_id: number;
|
||||
@@ -5,6 +12,7 @@ export interface Message {
|
||||
content: string;
|
||||
status?: "complete" | "generating" | "error";
|
||||
context_note_id: number | null;
|
||||
tool_calls?: ToolCallRecord[] | null;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user