How hill-1024/lawyance works
Lawver is a Chinese-language legal AI assistant. A user chats or starts a simulated-court session in the React app; requests reach FastAPI routes and service pipelines, which assemble context and run agents. Agents use business tools through the shared MCP forwarding layer to retrieve legal and company information, process documents, search the web, and access conversation memory. The frontend also manages conversation workspaces and local records. The README documents these boundaries; unsampled source leaves some internal calls and provider wiring unverified.
Main entry points: routes HTTP routes · court_pipeline.py Court pipeline · mcps.py Tool forwarding · chat_pipeline.py Chat pipeline
Components 22
User application
- Application shell
src/App.tsx - Chat workflow
src/hooks/useChat.ts - Court workflow
src/components/CourtPage.tsx - Local storage
src/lib/db.ts - API client
src/services/api.ts
Request handling
- Application factory
app_factory.py - HTTP routes
routes - Chat pipeline
services/chat_pipeline.py - Court pipeline
services/court_pipeline.py - Authentication
auth.py
Agent and review
- Agent builder
services/agent_builder.py - Agent tool loop
agents/tool_loop.py - Output review
services/ocp_service.py
Legal capabilities
- Tool forwarding
mcps.py - Tool registry
tools/registry.py - Legal data search
RAG/law_data_search.py - MCP clients
mcp
Memory and workspace
- Conversation memory
memory_system/service - Session workspace
workspace.py
Other components
- User
- Model service
- Legal and company sources
Connections 28
- User → Application shell: uses
README.md - Application shell → Chat workflow: presents
src/App.tsx - Application shell → Court workflow: routes to
src/App.tsx - Chat workflow → API client: sends chat
src/hooks/useChat.ts - Court workflow → API client: sends turns
README.md - Chat workflow → Local storage: persists conversations
src/hooks/useChat.ts - API client → HTTP routes: calls REST/stream
README.md - HTTP routes → Application factory: registered in
README.md - HTTP routes → Authentication: uses authentication
routes/auth.py - HTTP routes → Chat pipeline: forwards chat
README.md - HTTP routes → Court pipeline: forwards court turns
README.md - Chat pipeline → Agent builder: builds agent
services/chat_pipeline.py - Court pipeline → Agent tool loop: runs agent
services/court_pipeline.py - Agent builder → Agent tool loop: selects agent
README.md - Agent builder → Output review: builds review
README.md - Agent tool loop → Model service: requests completion
- Agent tool loop → Tool forwarding: dispatches tools
README.md - Court pipeline → Tool forwarding: dispatches court tools
README.md - Tool forwarding → Tool registry: uses registry
mcps.py - Tool forwarding → MCP clients: forwards calls
README.md - MCP clients → Legal data search: queries local law
- Legal data search → Legal and company sources: searches
- MCP clients → Legal and company sources: queries legal/company
- Chat pipeline → Conversation memory: syncs and retrieves
README.md - Court pipeline → Conversation memory: syncs role memory
services/court_pipeline.py - Chat pipeline → Session workspace: scopes session
README.md - Court pipeline → Session workspace: scopes session
README.md - Tool forwarding → Session workspace: validates paths
README.md