How yphyphyph/hagent works
HAgent is a web-based enterprise AI assistant combining streamed chat, grounded knowledge-base answers, agent tools, conversation memory, and administrative controls. The primary workflow runs from a user message through the chat service, optional retrieval/tool work, and model-generated SSE events displayed in the portal. Separate branches cover knowledge ingestion and administration. Edges are based on README statements or the shown source/index references; several runtime modules were not sampled, so their internal links are omitted.
Main entry points: ChatServiceImpl.java Chat orchestration · SettingsView.vue Admin console · AgentToolLoopService.java Agent tool loop · RagService.java RAG service
Components 24
Chat experience
- Chat portal
hagent-front/src/views/portal/PortalChatView.vue - Chat stream state
hagent-front/src/composables/useChat.ts - Chat API
hagent-back/hagent-ai/src/main/java/com/hagent/ai/controller/ChatController.java - Chat orchestration
hagent-back/hagent-ai/src/main/java/com/hagent/ai/service/impl/ChatServiceImpl.java - Conversation memory
hagent-back/hagent-ai/src/main/java/com/hagent/ai/memory/ConversationMemoryService.java
AI reasoning
- Query rewriting
hagent-back/hagent-ai/src/main/java/com/hagent/ai/service/impl/QueryRewriteServiceImpl.java - RAG service
hagent-back/hagent-ai/src/main/java/com/hagent/ai/core/RagService.java - Hybrid search
hagent-back/hagent-ai/src/main/java/com/hagent/ai/retrieval/HybridSearchService.java - Reranking and evidence gate
hagent-back/hagent-ai/src/main/java/com/hagent/ai/retrieval/RerankingService.java - Agent tool loop
hagent-back/hagent-ai/src/main/java/com/hagent/ai/core/AgentToolLoopService.java - AI tools
hagent-back/hagent-ai/src/main/java/com/hagent/ai/mcp/McpToolService.java - Model provider
hagent-back/hagent-ai/src/main/java/com/hagent/ai/core/AiModelProvider.java
Knowledge base
- Knowledge management
hagent-back/hagent-module-knowledge/src/main/java/com/hagent/knowledge/service/impl/KnowledgeServiceImpl.java - Document vectorization
hagent-back/hagent-module-knowledge/src/main/java/com/hagent/knowledge/service/KnowledgeVectorizeRunner.java - Vector store
hagent-back/hagent-common/src/main/java/com/hagent/common/service/VectorStoreService.java
Administration
- Admin console
hagent-front/src/views/admin/SettingsView.vue - System settings
hagent-back/hagent-server/src/main/java/com/hagent/server/system/controller/SystemSettingsController.java - SQL table policies
hagent-back/hagent-ai/src/main/java/com/hagent/ai/service/impl/SqlTablePolicyServiceImpl.java - MCP management
hagent-back/hagent-ai/src/main/java/com/hagent/ai/controller/McpToolController.java
Identity
- Login and profile
hagent-front/src/views/LoginView.vue - Authentication API
hagent-back/hagent-server/src/main/java/com/hagent/server/auth/controller/AuthController.java - Authentication service
hagent-back/hagent-server/src/main/java/com/hagent/server/auth/service/impl/AuthServiceImpl.java
Other components
- User
- Administrator
Connections 27
- User → Chat portal: asks
README.md - Chat portal → Chat stream state: streams through
hagent-front/src/composables/useChat.ts - Chat stream state → Chat API: calls
- Chat API → Chat orchestration: dispatches
- Chat orchestration → Conversation memory: uses
- Chat orchestration → Query rewriting: rewrites query
- Query rewriting → RAG service: supplies query
- RAG service → Hybrid search: searches through
hagent-back/hagent-ai/src/main/java/com/hagent/ai/core/RagService.java - Hybrid search → Reranking and evidence gate: reranks results
hagent-back/hagent-ai/src/main/java/com/hagent/ai/retrieval/HybridSearchService.java - Chat orchestration → Agent tool loop: runs tools
- Agent tool loop → AI tools: dispatches
- Agent tool loop → RAG service: retrieves knowledge
hagent-back/hagent-ai/src/main/java/com/hagent/ai/core/AgentToolLoopService.java - Chat orchestration → Model provider: generates with
- Chat orchestration → Chat portal: pushes SSE events
README.md - Administrator → Admin console: configures
README.md - Admin console → System settings: updates models
- System settings → Model provider: refreshes configuration
hagent-back/hagent-server/src/main/java/com/hagent/server/system/controller/SystemSettingsController.java - Admin console → Knowledge management: manages documents
README.md - Knowledge management → Document vectorization: queues processing
README.md - Document vectorization → Vector store: writes embeddings
- RAG service → Vector store: searches vectors
- Admin console → SQL table policies: sets table rules
README.md - Agent tool loop → SQL table policies: validates SQL policy
- Admin console → MCP management: manages tools
README.md - Administrator → Login and profile: signs in
README.md - Login and profile → Authentication API: submits credentials
- Authentication API → Authentication service: delegates
hagent-back/hagent-server/src/main/java/com/hagent/server/auth/controller/AuthController.java