How scorpio-meow/askmiao works
AskMiao is an enterprise knowledge-chat application: users ask questions, an Agent researches the knowledge base and optional external sources, and streamed answers expose citations and research steps. Administrators manage documents and external tools; authentication gates both workflows. The README documents major capabilities beyond the sampled excerpts, so their modules are included by exact paths, while uncertain internal call wiring is omitted. The sampled RAG manager, pipeline, LLM client, database setup, and MCP client establish selected internal layers and integrations.
Main entry points: contextual_rag.py Contextual RAG · chat.py Chat routes · database.py Application database · App.jsx Web application
Components 32
Web client
- Web application
frontend/src/App.jsx - Authentication UI
frontend/src/services/authService.ts - Chat interface
frontend/src/pages/Chat/index.tsx - API client
frontend/src/services/api.ts
API and identity
- FastAPI application
backend/main.py - Authentication routes
backend/app/api/auth.py - Chat routes
backend/app/api/chat.py - Chat service
backend/app/services/chat_service.py - Application database
backend/app/models/database.py
Research and retrieval
- RAG manager
backend/app/core/rag_manager.py - Research pipeline
backend/app/rag/pipeline.py - Research agent
backend/app/rag/agent.py - Research tools
backend/app/rag/tools.py - Hybrid retrieval
backend/app/rag/retrievers/hybrid.py - Contextual RAG
backend/app/rag/contextual_rag.py - Vector index
backend/app/rag/indices/vector_store.py - BM25 index
backend/app/rag/indices/bm25_store.py - Chunk store
backend/app/rag/indices/chunk_store.py - LLM providers
backend/app/core/llm_client.py
Knowledge management
- Document routes
backend/app/api/documents.py - Document processing
backend/app/services/document_processor.py - PDF extraction
backend/app/services/pdf_service.py
External tools
- API tool management
backend/app/api/api_tools.py - OpenAPI import
backend/app/services/openapi_parser.py - MCP management
backend/app/api/mcp.py - MCP client
backend/app/services/mcp_service.py - Tool approval
backend/app/rag/tool_approval.py - Web search and fetch
backend/app/rag/tools.py
Other components
- User
- Model services
- MCP servers
- Web sources
Connections 36
- User → Web application: uses
- Web application → Authentication UI: routes to
- Web application → Chat interface: routes to
- Authentication UI → API client: requests
- Chat interface → API client: sends chat
- API client → FastAPI application: calls API
- FastAPI application → Authentication routes: dispatches
- FastAPI application → Chat routes: dispatches
- Authentication routes → Application database: checks accounts
- Chat routes → Chat service: handles chat
- Chat service → RAG manager: gets RAG system
- RAG manager → Contextual RAG: creates
- Contextual RAG → Application database: opens sessions
- Research pipeline → Research agent: streams research
- Research pipeline → Research tools: creates registry
- Research tools → Hybrid retrieval: searches knowledge
- Research agent → LLM providers: requests model
- LLM providers → Model services: calls provider
- Hybrid retrieval → Vector index: vector search
- Hybrid retrieval → BM25 index: keyword search
- Contextual RAG → Chunk store: loads chunks
- Contextual RAG → Vector index: aligns index
- Contextual RAG → BM25 index: aligns index
- Chat routes → User: streams events
- Document routes → Document processing: processes uploads
- Document processing → PDF extraction: extracts PDFs
- Document processing → Contextual RAG: indexes chunks
- Document routes → Application database: manages documents
- API tool management → OpenAPI import: imports specs
- API tool management → Application database: stores tool config
- MCP management → MCP client: manages connections
- MCP client → MCP servers: discovers and calls
- Research agent → Tool approval: requests approval
- Tool approval → Chat routes: resolves through API
- Research tools → Web search and fetch: provides tools
- Web search and fetch → Web sources: searches or fetches