server/routers/chat.py

Chat API route implementation, prompt composition, streaming, and memory orchestration.

CategoryBackend
Sourceserver/routers/chat.py

What it does

Chat API route implementation, prompt composition, streaming, and memory orchestration.

Key responsibilities

  • Defines the /api/chat endpoints for streaming chat, confirmations, and conversation controls.
  • Builds the system prompt with memory, personality, activity, live data, visual context, and tools.
  • Integrates core services such as MemoryManager, PersonalityEngine, ActivityTracker, task planner, and visual context.
  • Streams responses with server-sent-event-like patterns and logs chat output to data/chat.log.
  • Extracts facts, emotions, and summaries from conversations for memory updates and longer-term context.

Related files

Explore other files in the Backend category.