This commit is contained in:
aruo
2026-05-31 21:45:14 +08:00
parent d4b5015beb
commit ac08345369
67 changed files with 11120 additions and 387 deletions
+28 -1
View File
@@ -22,8 +22,35 @@
- 定义:基于 Spring AI 的多 Agent 协作框架,提供 ReactAgent、PlannerAgent、ExecutorAgent 等
- 使用场景:项目核心 Agent 逻辑,ReactAgent.builder().model() 接受 ChatModel 接口
### DeepSeekChatModel
- 定义:Spring AI 原生 DeepSeek 实现(`spring-ai-starter-model-deepseek`),非 OpenAI 兼容模式
- 使用场景:Chat → DeepSeek V4 Flash/Pro,支持 reasoning_content
- 配置前缀:`spring.ai.deepseek.*`
### ModelRoutingConfig
- 定义:项目自定义配置类,yml 关键字驱动的 `@Primary` 路由
- 使用场景:多厂商 starter 并存时,通过 `model-routing.chat` / `model-routing.embedding` 声明启用哪个模型
- 路由策略:
1. `Map<String, EmbeddingModel>` 按 Bean 名匹配
2. `List<ChatModel>` 按类名匹配
3. 未匹配则回退到第一个
- 示例:`model-routing.chat: deepseek` → 选中类名含 `DeepSeek` 的 Bean
### SiliconFlow
- 定义:硅基流动 AI 平台,提供 OpenAI 兼容 API,项目用它跑 BGE-M3 embedding
- 配置:`siliconflow.*`(自定义配置前缀),base-url = `https://api.siliconflow.cn`
- model: `BAAI/bge-m3`,1024 维
### BGE-M3
- 定义:BAAI 开源的多语言 embedding 模型,1024 维输出
- 使用场景:通过 SiliconFlow API 调用,替代 DashScope text-embedding-v4
- 维度兼容:1024 = 原 DashScope text-embedding-v4,Milvus 无需重建
## 业务规则
- ChatModel 是唯一 LLM 调用抽象:替换模型只需更换 Spring Boot starter 和配置
- EmbeddingModel 是唯一向量化抽象:替换向量模型只需更换 starter 和配置
- ReactAgent 已兼容 ChatModel 接口,不绑定 DashScope
- ReactAgent 已兼容 ChatModel 接口,不绑定 DashScope
- base-url 只写 host(如 `https://api.deepseek.com`),不写版本路径(如 `/v1`),Spring AI 会自动追加
- 多 starter 并存时,必须通过 `@Primary` 或 `@Qualifier` 指定默认 Bean
- Milvus collection 启动时必须 `loadCollection()`,否则搜索报 `collection not loaded`