# ChatModel + Embedding 解耦 Tasks ## 需求追踪 | 需求 | 状态 | 备注 | | --- | --- | --- | | ChatService 解耦 DashScopeChatModel | 待处理 | 改为注入 ChatModel | | ChatController 解耦 DashScope | 待处理 | 删除手动构建逻辑 | | AiOpsService 解耦 DashScopeChatModel | 待处理 | 方法签名改为 ChatModel | | VectorEmbeddingService 解耦 DashScope SDK | 待处理 | 改为注入 EmbeddingModel | | RagService 解耦 DashScope Generation | 待处理 | 改为 ChatModel.stream() | | VECTOR_DIM 配置化 | 待处理 | 从 yml 读取 | ## 实现任务 - [ ] T1: MilvusProperties 新增 vectorDim 字段 + getter/setter,application.yml 新增 `milvus.vector-dim: 1024` - [ ] T2: MilvusConstants.VECTOR_DIM 改为从 MilvusProperties 动态读取(MilvusClientFactory 传入) - [ ] T3: ChatService — 删除 createDashScopeApi/createChatModel/createStandardChatModel,新增 @Autowired ChatModel;createReactAgent 参数改为 ChatModel - [ ] T4: ChatController — 删除 DashScope import 和手动构建(行83-84, 171-172, 292-301),改为使用注入 ChatModel 或 ChatService 传入 - [ ] T5: AiOpsService — executeAiOpsAnalysis/buildPlannerAgent/buildExecutorAgent 参数类型 DashScopeChatModel → ChatModel - [ ] T6: VectorEmbeddingService — 删除 DashScope SDK import + TextEmbedding 字段 + @PostConstruct init(),改为 @Autowired EmbeddingModel;generateEmbedding 改为调用 EmbeddingModel.embed() - [ ] T7: RagService — 删除 DashScope SDK import + Generation 字段 + Constants.apiKey,改为 @Autowired ChatModel;generateAnswerStream 改为 ChatModel.stream(Prompt) + Flux 适配 StreamCallback