Skip to content

feat(ai-chat): add AI tool-calling, chat history and withdrawal modeling - #5

Merged
Metee01 merged 5 commits into
mainfrom
feature/ai-chat
Aug 13, 2026
Merged

feat(ai-chat): add AI tool-calling, chat history and withdrawal modeling#5
Metee01 merged 5 commits into
mainfrom
feature/ai-chat

Conversation

@Metee01

@Metee01 Metee01 commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Summary

AI assistant now reads AND writes portfolio data in the app. Added persistent
chat history, centralized configuration, and an in-band tool-calling protocol
with explicit user approval before any data mutation.

Changes

  • feat(ai): AI assistant chat widget + centralized AI settings (#e675004)
  • feat(config): central APP_CONFIG + docs (#56c7278)
  • feat(ai-chat): persistent chat sessions, withholding tax, custom withdrawals (#73bb28b)
  • feat(ai-chat): tool-calling protocol — apply_params, set_custom_withdrawal,
    clear_custom_withdrawals, create_scenario, reset_params, calculate_projection,
    forecast_economics; approval card UI before store mutations (#1abab37)
  • chore(config): demo model + chat quota tweak (uncommitted, included)

Verification

  • npm run lint ✅ (0 errors)
  • npm run test ✅ (engine + store + new tools suite: 15 tests)
  • npm run build ✅

- Add floating action button (FAB) and interactive chat panel for portfolio Q&A
- Inject real-time portfolio parameters and projection metrics into AI system prompt
- Centralize AI provider and API key management inside Application Settings dialog
- Add Demo API toggle support via VITE_DEMO_API_KEY with quota limits (5 forecasts, 15 chat messages)
- Implement security controls: 500-char message capping and 3s cooldown rate-limiting for Demo API
- Add Turkish and English translations for chat UI, settings, and quota indicators
- Add src/config/index.ts (APP_CONFIG) for centralizing app metadata, demo API quotas, security limits, AI defaults, and calculation constraints
- Integrate APP_CONFIG across ai-service, ai-chat-service, settings store, and UI modals
- Update project documentation files (README.md, README.tr.md, AGENTS.md, CONTRIBUTING.md, CONTRIBUTING.tr.md) to reflect the new architecture
Introduce persistent chat sessions and UI: add a zustand chat store (with persist), chat history UI in AiChat, session CRUD, and chat-store tests. Implement withdrawal tax (stopaj) logic and expose netWithdrawal: new calculateWithdrawalTax helper, projection changes to compute withholdingTax and netWithdrawal, summary fields, engine tests updated. Add per-month customWithdrawals with UI in ProjectionTable and store actions to set/clear overrides. Update AI config & services (demo provider/baseUrl, maxTokens, response cleaning), CSV export, translations, and small UI/UX fixes.
Introduce an in-band AI tool-calling system: new src/lib/ai-tools.ts (tool registry, parser, sanitizer, executor, default deps) and unit runner src/lib/ai-tools.test.ts. Integrate into chat flow: ai-chat-service now returns parsed tool calls; AiChat UI supports proposal approvals/rejections, tool execution results, and follow-up rounds. Add types for AiToolCall/AiToolCallResult and internal message flag. Update APP_CONFIG (toolCall limits, engine sanitization limits, demo chat cap), translations, vite dev server, and package.json test script. This enables AI to request precise engine calculations and propose mutations gated by user approval, with sanitization and read/mutate separation.
Make the AI chat panel resizable: add panel size state, pointer-based resize handlers, clamp constraints and visible resize handles (desktop). Adjust transition behavior while resizing. Update demo AI configuration to use "nvidia/nemotron-3-ultra-550b-a55b:free" and lower demo chat quota from 20 to 15. Docs updated (EN + TR) to instruct adding LANGUAGE_LABELS and to update APP_CONFIG.supportedLanguages when adding new locales.

Files changed: src/components/chat/AiChat.tsx, src/config/index.ts, CONTRIBUTING.md, CONTRIBUTING.tr.md
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
money-trace Ready Ready Preview Aug 13, 2026 3:26pm

@Metee01
Metee01 merged commit 68ec9a1 into main Aug 13, 2026
3 checks passed
@Metee01
Metee01 deleted the feature/ai-chat branch August 14, 2026 15:34
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