Commit Graph

10 Commits

Author SHA1 Message Date
MerCry fc53fdc6ac feat(AISVC-T8): LLM配置管理与RAG调试输出支持 [AC-AISVC-42, AC-AISVC-43, AC-AISVC-44, AC-AISVC-45, AC-AISVC-46, AC-AISVC-47, AC-AISVC-48, AC-AISVC-49, AC-AISVC-50]
- 新增 LLMProviderFactory 工厂类支持 OpenAI/Ollama/Azure [AC-AISVC-42]
- 新增 LLMConfigManager 支持配置热更新 [AC-AISVC-43, AC-AISVC-44]
- 新增 LLM 管理 API 端点 [AC-AISVC-42~AC-AISVC-46]
- 更新 RAG 实验接口支持 AI 回复生成 [AC-AISVC-47, AC-AISVC-49]
- 新增 RAG 实验流式输出 SSE [AC-AISVC-48]
- 支持指定 LLM 提供者 [AC-AISVC-50]
- 更新 OpenAPI 契约添加 LLM 管理接口
- 更新前后端规范文档 v0.4.0 迭代
2026-02-25 01:25:53 +08:00
MerCry c1d76093aa feat(AISVC-T7): 嵌入模型可插拔设计与文档解析支持 [AC-AISVC-29, AC-AISVC-30, AC-AISVC-31, AC-AISVC-32, AC-AISVC-33, AC-AISVC-34, AC-AISVC-35, AC-AISVC-36, AC-AISVC-37, AC-AISVC-38, AC-AISVC-39, AC-AISVC-40, AC-AISVC-41]
- 新增 EmbeddingProvider 抽象基类和工厂模式 [AC-AISVC-29, AC-AISVC-30]
- 实现 OllamaEmbeddingProvider 和 OpenAIEmbeddingProvider [AC-AISVC-29, AC-AISVC-30]
- 新增 EmbeddingConfigManager 支持配置热更新 [AC-AISVC-31, AC-AISVC-32]
- 新增 DocumentParser 抽象接口和工厂类 [AC-AISVC-33]
- 实现 PDF/Word/Excel/Text 文档解析器 [AC-AISVC-33, AC-AISVC-34, AC-AISVC-35]
- 新增嵌入管理 API 端点 [AC-AISVC-38, AC-AISVC-39, AC-AISVC-40, AC-AISVC-41]
- 更新文档上传流程支持多格式文档解析 [AC-AISVC-36, AC-AISVC-37]
- 更新 OpenAPI 契约添加嵌入管理接口
- 添加数据库初始化脚本
- 更新规范文档标记 Phase 7 完成
2026-02-24 23:08:08 +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 71e966d62a docs(ai-service): update progress files [AISVC-ALL] all phases completed
- Update spec/ai-service/progress.md with Phase 3 completion details
- Update spec/ai-service/tasks.md status to completed
- All 5 phases (23 tasks) completed: T1.1-T1.6, T2.1-T2.5, T3.1-T3.5, T4.1-T4.4, T5.1-T5.3
- 184 tests passing
- All AC markers covered: AC-AISVC-01~AC-AISVC-20
2026-02-24 14:02:33 +08:00
MerCry 43ce9837a1 feat(ai-service): add contract validation tests for T3.5 [AC-AISVC-02]
- Verify ChatResponse fields match OpenAPI contract
- Test required fields: reply, confidence, shouldTransfer
- Test optional fields: transferReason, metadata
- Test JSON serialization uses camelCase (by_alias=True)
- Test confidence range validation [0.0, 1.0]
- Test ChatRequest contract compliance
- Test ErrorResponse contract compliance
- Test SSEFinalEvent matches ChatResponse structure
- Test SSEErrorEvent matches ErrorResponse structure
- Add end-to-end contract validation with OrchestratorService
- All 184 tests passing
2026-02-24 13:55:17 +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 00953196c9 feat(ai-service): implement SSE state machine and error handling [AC-AISVC-08, AC-AISVC-09]
- Integrate state machine in API layer for proper event sequencing
- Ensure message* -> final/error -> close sequence
- Prevent events after final/error
- Convert streaming exceptions to error events
- Add comprehensive state machine tests
- 117 tests passing
2026-02-24 13:32:59 +08:00
MerCry c9f2c1eb3a feat(ai-service): implement SSE event generator for message events [AC-AISVC-07]
- Optimize Orchestrator streaming output with LLM client integration
- Implement _stream_from_llm() to wrap LLM chunks as message events
- Implement _stream_mock_response() for demo/testing
- Add SSE event format tests (message/final/error)
- Fix by_alias=True for final event JSON output
- 79 tests passing
2026-02-24 13:28:10 +08:00
MerCry 4cee28e9f4 docs: mark Phase 1 and Phase 2 tasks as completed [AC-AISVC-01~AC-AISVC-20] 2026-02-24 13:22:56 +08:00
MerCry cc70ffeca6 docs: confirm open questions and update design [AC-AISVC-01] 2026-02-24 13:00:08 +08:00