How shao3d/ukido_dyncontinj works
Project Type & Purpose
• This is a backend-centric AI chatbot service (no dedicated SPA/web UI)
• Exposes a FastAPI HTTP API (src/main.py)
• Implements a two-stage AI pipeline:
– Stage 1: Gemini router & intent classifier
– Stage 2: Claude response generator
• Uses in-memory/context stores and a markdown-based knowledge base
A. Actor
– “Parent User” (HTTP client)
B. API Layer
– FastAPI Server (src/main.py)
C. AI Processing – Router
– GeminiRouter (src/router.py + src/gemini_cached_client.py)
– Social Detector (src/social_intents.py)
– History Manager (src/history_manager.py)
– Social State Tracker (src/social_state.py)
– Standard Responses (src/standard_responses.py)
– Fuzzy-match logic (patterns in social_intents)
D. Knowledge Base
– Compressed MD docs (data/documents_compressed/*.md)
E. AI Processing – Generator
– ClaudeGenerator (src/response_generator.py + src/openrouter_client.py)
– OpenRouter API (external Claude service)
F. Config & Caches
– src/config.py
– .serena cache & memories (on-disk caches for speed)
G. External Services
– Google AI (Gemini API)
– OpenRouter (Claude API)
Architectural Patterns & Principles
• Two-stage pipeline separates classification (Gemini) and generation (Claude)
• Modular design: each core behavior (social, history, routing, generation) lives in its own module
• Configurable context length (HISTORY_LIMIT in config.py)
• Fuzzy matching for social intents to improve UX
• Caching layers (.serena) to reduce repeated LLM calls
Technologies & Frameworks
• Python 3.11+
• FastAPI
• Gemini API via gemini_cached_client
• Claude API via openrouter_client
• Markdown docs as Knowledge Base
• pytest + custom scripts under tests/ for CI