Files
erp-nutzfahrzeuge/.a0/worklog.md
T

2.0 KiB

Worklog

T07: KI-Copilot — 2026-07-17

Implemented

  • Backend: CopilotSession + CopilotChat models with UUID PKs, user FK, JSONB actions
  • Backend: Copilot service with OpenRouter chat completions, action proposal/execution system
  • Backend: System prompt with ERP context (vehicle types, contact types, sales workflow) and 5 available actions
  • Backend: Action registry — search_vehicles, search_contacts, get_sale_overview, create_vehicle, create_contact
  • Backend: Voice endpoint with audio transcription (OpenRouter or stub fallback)
  • Backend: Paginated chat history per user, filterable by session_id
  • Backend: Router registered in main.py under /api/v1/copilot
  • Frontend: Full chat interface with message list, text input, voice input, action preview, chat history sidebar
  • Frontend: Web Speech API integration for voice recording via MediaRecorder
  • Frontend: Action confirmation flow — Copilot proposes, user confirms/dismisses

Test Evidence

  • Backend: 48 tests passed, 90% coverage on copilot_service + copilot router
  • Frontend: 24 tests passed covering all components
  • OpenRouter fully mocked in all tests

Files Changed

  • backend/app/models/copilot.py (new)
  • backend/app/schemas/copilot.py (new)
  • backend/app/routers/copilot.py (new)
  • backend/app/services/copilot_service.py (new)
  • backend/app/utils/copilot_actions.py (new)
  • backend/app/utils/copilot_prompt.py (new)
  • backend/app/main.py (modified — added copilot router import + registration)
  • backend/tests/test_copilot.py (new)
  • backend/tests/test_copilot_coverage.py (new)
  • frontend/lib/copilot.ts (new)
  • frontend/app/[locale]/ki-copilot/page.tsx (new)
  • frontend/components/copilot/ChatInterface.tsx (new)
  • frontend/components/copilot/MessageList.tsx (new)
  • frontend/components/copilot/ChatInput.tsx (new)
  • frontend/components/copilot/VoiceInput.tsx (new)
  • frontend/components/copilot/ActionPreview.tsx (new)
  • frontend/components/copilot/ChatHistory.tsx (new)
  • frontend/tests/copilot.test.tsx (new)
  • test_report.md (new)