Skip to content

feat(chat): AI chat agent with history and markdown#17

Open
alon710 wants to merge 2 commits into
Shaya16:mainfrom
alon710:alon710/ai-chat-agent-page-v1
Open

feat(chat): AI chat agent with history and markdown#17
alon710 wants to merge 2 commits into
Shaya16:mainfrom
alon710:alon710/ai-chat-agent-page-v1

Conversation

@alon710

@alon710 alon710 commented May 27, 2026

Copy link
Copy Markdown

Summary

  • Adds an AI chat agent page that answers finance questions over the user's local SQLite data via tool calls.
  • Adds persistent chat sessions (SQLite migration 021_chat_sessions.sql), session APIs (/api/chat/sessions[/id]), a history sidebar with new/load/rename/delete, and auto-generated titles via an internal setChatTitle tool with live sidebar rename.
  • Renders assistant markdown via react-markdown + remark-gfm.
  • Fixes three review findings:
    • Re-key the chat by workspaceId so switching workspaces no longer keeps sending the previous x-workspace-id.
    • Inject today's Asia/Jerusalem date into the system prompt so relative-period queries (last month, this year) resolve correctly.
    • Clear the AI SDK error on input change and submit so the composer stays usable after a transient failure.

Test plan

  • npm run build passes
  • Open /chat, ask a question that hits a tool, confirm a session appears in the sidebar with an auto-generated title
  • Rename a session manually; confirm sidebar updates and persists across reload
  • Delete a session; confirm the active chat resets to a new empty one
  • Switch workspaces from the sidebar and confirm the chat starts fresh with the new workspace's data
  • Trigger an error (e.g. invalid provider) and confirm the composer still accepts input

🤖 Generated with Claude Code

alon710 and others added 2 commits May 27, 2026 13:56
Adds a streaming /chat page that uses the same AI provider configured
for categorization (Claude or Ollama). The agent answers free-text
questions about the user's finances through tool calls that wrap
existing read-only DB queries (transactions, monthly summary, top
merchants, category breakdown). Page and sidebar entry are disabled
when no AI provider is configured.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Persist chat sessions and messages in SQLite (migration 021)
- Add session APIs: list, get, rename, delete
- Add history sidebar with new/load/rename/delete actions
- Auto-generate session titles via internal setChatTitle tool with live sidebar rename
- Render assistant markdown via react-markdown + remark-gfm
- Re-key chat by workspaceId so workspace switches do not leak headers
- Inject today's Asia/Jerusalem date into the system prompt for relative-period queries
- Clear AI SDK error on input change and submit so the composer stays usable after a failure

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant