Files
api/services/chat
Roberto Musso d856dfd28c refactor: deduplicate shared code into shared/ module
Move duplicated files from chat + batch-agent into shared/:
- shared/ws_context.py — Redis-based tool call round-trip
- shared/llm.py — LiteLLM factory (get_llm, embed)
- shared/agents/ — 4 domain agents (task, note, project, timeline)

Update all service imports to use shared.* instead of app.*.
Delete 12 duplicated files across both services.
2026-03-23 23:01:45 +01:00
..

Chat Service

Owns: deep_agent (home + floating chat), memory middleware, domain agents (task, note, project, timeline), LLM orchestration.

Tables owned

  • memory_core
  • memory_associative
  • memory_episodic
  • memory_proactive

Tables read (cross-service)

  • users (for encryption_key — memory decryption)

Endpoints

  • POST /chat (REST fallback)

Redis channels

  • Subscribe: chat:request:{user_id}
  • Publish: ws:out:{user_id} (stream frames + tool calls)
  • BRPOP: tool:result:{call_id} (30s timeout)