8996b45e50
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>
18 lines
317 B
Python
18 lines
317 B
Python
"""Add tool_calls JSONB column to messages."""
|
|
|
|
from alembic import op
|
|
|
|
revision = "0013"
|
|
down_revision = "0012"
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.execute("""
|
|
ALTER TABLE messages
|
|
ADD COLUMN IF NOT EXISTS tool_calls JSONB
|
|
""")
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_column("messages", "tool_calls")
|