Commit Graph

9 Commits

Author SHA1 Message Date
MerCry 5148c6ef42 feat(AISVC-T6.9): 前后端接口对接修正及Dashboard/RAG Lab功能完善
## 后端修改
- 新增 Dashboard 统计 API (/admin/dashboard/stats)
- 新增知识库列表 API (/admin/kb/knowledge-bases),返回文档数量
- 会话列表 API 新增 tenantId 字段
- KBService 新增 list_knowledge_bases 方法

## 前端修改
- Dashboard 页面对接真实后端 API
- RAG Lab 知识库选择器显示文档数量
- Monitoring 页面修复数据映射
- 新增 dashboard.ts API 文件
- kb.ts 新增 listKnowledgeBases 函数
2026-02-24 19:59:26 +08:00
MerCry fb3c8ca2aa feat(ai-service): v0.2.0 前后端联调真实对接
实现内容:
- 新增知识库实体模型 (KnowledgeBase, Document, IndexJob)
- 新增 KBService 服务层,支持文档上传、存储、索引任务管理
- 实现知识库管理 API 真实对接 (POST/GET /admin/kb/documents)
- 实现索引任务状态查询 API (GET /admin/kb/index/jobs/{jobId})
- 实现 RAG 实验室真实向量检索 (POST /admin/rag/experiments/run)
- 实现会话监控真实数据库查询 (GET /admin/sessions)

规范更新:
- requirements.md: v0.1.0 -> v0.2.0, 新增 AC-AISVC-21~28
- tasks.md: v0.1.0 -> v0.2.0, 新增 Phase 6 (9个任务)
- openapi.admin.yaml: L0 -> L1, 更新 x-requirements 映射

验收标准: AC-AISVC-21, AC-AISVC-22, AC-AISVC-23, AC-AISVC-24,
          AC-AISVC-25, AC-AISVC-26, AC-AISVC-27, AC-AISVC-28
2026-02-24 18:16:29 +08:00
MerCry 2e5ddc3653 feat: implement admin management APIs [AC-ASA-01, AC-ASA-02, AC-ASA-05, AC-ASA-07, AC-ASA-08, AC-ASA-09] 2026-02-24 16:10:27 +08:00
MerCry e4dc3d97e2 feat(ai-service): add Phase 5 integration and contract tests [AC-AISVC-10,11,17,18]
- Add multi-tenant integration tests (test_integration_tenant.py)
- Add RAG smoke tests (test_rag_smoke.py)
- Add API contract tests (test_contract.py)
- 184 tests passing
- Phase 4 & 5 complete
2026-02-24 13:53:55 +08:00
MerCry 6d54030e0d feat(ai-service): implement complete Orchestrator generation pipeline for T3.4 [AC-AISVC-01, AC-AISVC-02]
- Integrate Memory, ContextMerger, Retriever, LLMClient, ConfidenceCalculator
- Implement 8-step generation pipeline:
  1. Load local history from Memory
  2. Merge with external history (dedup + truncate)
  3. RAG retrieval (optional)
  4. Build prompt with context and evidence
  5. LLM generation
  6. Calculate confidence
  7. Save messages to Memory
  8. Return ChatResponse
- Add GenerationContext dataclass for tracking intermediate results
- Implement fallback response mechanism for error handling
- Add 21 unit tests for OrchestratorService
- All 138 tests passing
2026-02-24 13:47:12 +08:00
MerCry 66fa2d2677 feat(ai-service): implement confidence calculation for T3.3 [AC-AISVC-17, AC-AISVC-18, AC-AISVC-19]
- Add ConfidenceCalculator class for confidence scoring
- Implement retrieval insufficiency detection (hit count, score threshold, evidence tokens)
- Implement confidence calculation based on retrieval scores
- Implement shouldTransfer logic with configurable threshold
- Add transferReason for low confidence scenarios
- Add comprehensive unit tests (19 test cases)
- Update config with confidence-related settings
2026-02-24 13:31:42 +08:00
MerCry 550d0d8498 feat(ai-service): implement context merging for T3.2 [AC-AISVC-14, AC-AISVC-15]
- Add ContextMerger class for combining local and external history
- Implement message fingerprint computation (SHA256 hash)
- Implement deduplication: local history takes priority
- Implement token-based truncation using tiktoken
- Add comprehensive unit tests (20 test cases)
2026-02-24 13:26:37 +08:00
MerCry 92cef20a86 test(ai-service): add Retrieval layer unit tests [AC-AISVC-10, AC-AISVC-16, AC-AISVC-17] 2026-02-24 13:22:04 +08:00
MerCry 0a167d69f0 feat(ai-service): implement LLM Adapter for T3.1 [AC-AISVC-02, AC-AISVC-06]
- Add LLMClient abstract base class with generate/stream_generate interfaces
- Implement OpenAIClient with httpx for OpenAI-compatible API calls
- Add retry logic with tenacity for timeout handling
- Support both non-streaming and streaming generation
- Add comprehensive unit tests for LLM Adapter
- Fix entities.py JSON column type for SQLModel compatibility
2026-02-24 13:19:38 +08:00