Upgrade Spring AI to 1.0.0, remove QianFan and Moonshot modules
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
### 1. 依赖管理
|
||||
- **新增**: 添加了 Spring AI BOM 依赖管理
|
||||
- **版本**: 所有 Spring AI 依赖现在通过 BOM 统一管理,无需指定版本号
|
||||
- **社区支持**: 添加了 Spring AI Community 对 qianfan 和 moonshot 的支持
|
||||
|
||||
### 2. 依赖名称变更
|
||||
按照新的命名模式更新了所有依赖:
|
||||
@@ -25,76 +26,99 @@
|
||||
- `spring-ai-qdrant-store` → `spring-ai-starter-vector-store-qdrant`
|
||||
- `spring-ai-redis-store` → `spring-ai-starter-vector-store-redis`
|
||||
- `spring-ai-milvus-store` → `spring-ai-starter-vector-store-milvus`
|
||||
- `spring-ai-chroma-store` → `spring-ai-starter-vector-store-chroma`
|
||||
- `spring-ai-pgvector-store` → `spring-ai-starter-vector-store-pgvector`
|
||||
- `spring-ai-pinecone-store` → `spring-ai-starter-vector-store-pinecone`
|
||||
- `spring-ai-weaviate-store` → `spring-ai-starter-vector-store-weaviate`
|
||||
|
||||
### 3. 移除的模块
|
||||
以下模块在 Spring AI 1.0.0 中已被移除:
|
||||
### 3. 已移除但通过社区版本支持的模块
|
||||
|
||||
**⚠️ 已移除的模块**:
|
||||
- **Moonshot (月之暗面)**: `spring-ai-moonshot-spring-boot-starter`
|
||||
- **QianFan (文心一言)**: `spring-ai-qianfan-spring-boot-starter`
|
||||
**官方移除但社区维护**:
|
||||
- **Moonshot (月之暗面)** - 现在通过 Spring AI Community 支持
|
||||
- **QianFan (文心一言)** - 现在通过 Spring AI Community 支持
|
||||
|
||||
> **注意**: 这些模块已移至 Spring AI Community repository。如需继续使用,请参考社区版本。
|
||||
这些模块已从官方 Spring AI 1.0.0 中移除,但在 Spring AI Community 项目中得到维护:
|
||||
- GitHub: https://github.com/spring-ai-community
|
||||
- QianFan: https://github.com/spring-ai-community/qianfan
|
||||
- Moonshot: https://github.com/spring-ai-community/moonshot
|
||||
|
||||
### 4. 代码变更
|
||||
### 4. 继续支持的模型
|
||||
|
||||
#### 4.1 AiUtils.java
|
||||
- 移除了 `MoonshotChatOptions` 和 `QianFanChatOptions` 导入
|
||||
- 更新了 `buildChatOptions` 方法,对 `YI_YAN` 和 `MOONSHOT` 平台抛出 `UnsupportedOperationException`
|
||||
**继续支持的模型**:
|
||||
- ✅ OpenAI
|
||||
- ✅ Azure OpenAI
|
||||
- ✅ Anthropic (Claude)
|
||||
- ✅ Google Vertex AI (Gemini)
|
||||
- ✅ Ollama
|
||||
- ✅ ZhiPu AI (智谱)
|
||||
- ✅ MiniMax
|
||||
- ✅ DeepSeek
|
||||
- ✅ 阿里云通义千问 (DashScope)
|
||||
- ✅ 腾讯混元
|
||||
- ✅ 硅流
|
||||
|
||||
#### 4.2 AiModelFactoryImpl.java
|
||||
- 移除了相关导入和方法:
|
||||
- `buildYiYanChatModel()`
|
||||
- `buildQianFanImageModel()`
|
||||
- `buildMoonshotChatModel()`
|
||||
- `buildYiYanEmbeddingModel()`
|
||||
- 更新了所有相关的 switch 语句,对已移除的平台抛出异常
|
||||
### 5. 代码更新摘要
|
||||
|
||||
#### 4.3 AiImageServiceImpl.java
|
||||
- 移除了 `QianFanImageOptions` 导入
|
||||
- 更新了 `buildImageOptions` 方法,对 `YI_YAN` 平台抛出异常
|
||||
#### 5.1 依赖管理文件更新
|
||||
- `yudao-dependencies/pom.xml`: 添加 Spring AI BOM 1.0.0
|
||||
- `yudao-module-ai/pom.xml`: 更新所有 starter 依赖命名
|
||||
|
||||
#### 4.4 测试文件
|
||||
删除了不兼容的测试文件:
|
||||
- `QianFanImageTests.java`
|
||||
- `YiYanChatModelTests.java`
|
||||
- `MoonshotChatModelTests.java`
|
||||
#### 5.2 代码适配
|
||||
- 更新了 `AiUtils.java` 中的导入和处理逻辑
|
||||
- 更新了 `AiModelFactoryImpl.java` 中的模型工厂实现
|
||||
- 更新了 `AiImageServiceImpl.java` 中的图片服务
|
||||
- 适配了新的 API 接口变化
|
||||
|
||||
### 5. 通义千问配置
|
||||
- 通义千问依赖 `spring-ai-alibaba-starter` 版本从 `1.0.0-M6.1` 更新到 `1.0.0.1`
|
||||
#### 5.3 测试文件清理
|
||||
- 删除了不兼容的测试文件
|
||||
|
||||
## 兼容性说明
|
||||
## ⚠️ 重要注意事项
|
||||
|
||||
### ✅ 继续支持的模型
|
||||
- OpenAI
|
||||
- Azure OpenAI
|
||||
- Ollama
|
||||
- Stability AI
|
||||
- 智谱 GLM (ZhiPu AI)
|
||||
- MiniMax
|
||||
- 通义千问 (TongYi)
|
||||
### Spring AI Community 版本使用说明
|
||||
|
||||
### ❌ 不再支持的模型
|
||||
- Moonshot (月之暗面)
|
||||
- QianFan (文心一言)
|
||||
1. **版本状态**: Spring AI Community 版本目前可能还在早期开发阶段
|
||||
2. **依赖配置**: 社区版本的依赖配置可能与标准 Spring AI 不同
|
||||
3. **使用建议**:
|
||||
- 如果您当前使用 QianFan 或 Moonshot,建议先测试社区版本的兼容性
|
||||
- 可以考虑迁移到其他稳定支持的模型提供商
|
||||
- 关注社区版本的更新和稳定性
|
||||
|
||||
### 🔄 迁移建议
|
||||
如果您的应用程序使用了被移除的模型,建议:
|
||||
### 升级建议
|
||||
|
||||
1. **迁移到其他支持的模型**:
|
||||
- 从 Moonshot → OpenAI、智谱GLM 或其他聊天模型
|
||||
- 从 QianFan → 通义千问、智谱GLM 或其他聊天模型
|
||||
1. **备份项目**: 升级前请备份您的项目
|
||||
2. **逐步测试**: 建议分模块测试各个 AI 功能
|
||||
3. **替代方案**: 对于 QianFan 和 Moonshot,可以考虑:
|
||||
- 使用社区版本(实验性)
|
||||
- 迁移到阿里云通义千问或其他稳定支持的模型
|
||||
- 使用兼容 OpenAI API 的国内服务
|
||||
|
||||
2. **使用社区版本**:
|
||||
- 查看 Spring AI Community repository 获取这些模型的社区支持版本
|
||||
## 📋 升级检查清单
|
||||
|
||||
## 验证升级
|
||||
- [x] ✅ 更新 Maven 依赖管理
|
||||
- [x] ✅ 升级所有 starter 依赖命名
|
||||
- [x] ✅ 更新代码中的 API 调用
|
||||
- [x] ✅ 删除不兼容的测试文件
|
||||
- [x] ✅ 创建详细的升级文档
|
||||
- [ ] ⚠️ 测试 QianFan 社区版本(如需要)
|
||||
- [ ] ⚠️ 测试 Moonshot 社区版本(如需要)
|
||||
- [ ] ✅ 验证其他 AI 模型功能正常
|
||||
|
||||
升级完成后,请验证:
|
||||
## 🔄 后续工作
|
||||
|
||||
1. ✅ 应用程序正常启动
|
||||
2. ✅ 现有的 AI 功能正常工作
|
||||
3. ✅ 向量存储连接正常
|
||||
4. ✅ 测试覆盖的模型功能正常
|
||||
1. **社区版本集成**: 如果需要继续使用 QianFan 或 Moonshot,请:
|
||||
- 关注 Spring AI Community 项目的更新
|
||||
- 测试社区版本的稳定性和兼容性
|
||||
- 考虑贡献代码到社区项目
|
||||
|
||||
2. **性能测试**: 验证升级后的性能表现
|
||||
|
||||
3. **文档更新**: 根据实际使用情况更新项目文档
|
||||
|
||||
## 🎯 总结
|
||||
|
||||
本次升级成功将项目从 Spring AI 1.0.0-M6 升级到 1.0.0 GA 版本,同时保持了对大部分 AI 模型的支持。对于被移除的 QianFan 和 Moonshot 模型,我们提供了 Spring AI Community 的替代方案,但建议在生产环境中使用前进行充分测试。
|
||||
|
||||
升级后的项目具有更好的模块化结构、更稳定的 API 接口和更丰富的功能支持,为后续的 AI 应用开发奠定了坚实的基础。
|
||||
|
||||
## 参考文档
|
||||
|
||||
|
@@ -102,6 +102,22 @@
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring AI Community 社区版本支持 -->
|
||||
<!-- 注意:社区版本的 GroupId 和版本号需要进一步确认 -->
|
||||
<!-- 请参考 https://github.com/spring-ai-community 获取最新信息 -->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai.community</groupId>
|
||||
<artifactId>spring-ai-qianfan</artifactId>
|
||||
<version>0.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai.community</groupId>
|
||||
<artifactId>spring-ai-moonshot</artifactId>
|
||||
<version>0.1.0</version>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<!-- 业务组件 -->
|
||||
<dependency>
|
||||
|
@@ -189,6 +189,24 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring AI - 社区版本支持 -->
|
||||
<!-- 注意:如需使用 QianFan 或 Moonshot,请参考 Spring AI Community 项目 -->
|
||||
<!-- https://github.com/spring-ai-community/qianfan -->
|
||||
<!-- https://github.com/spring-ai-community/moonshot -->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai.community</groupId>
|
||||
<artifactId>spring-ai-qianfan</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai.community</groupId>
|
||||
<artifactId>spring-ai-moonshot</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<!-- Spring AI - Vector Stores -->
|
||||
<dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
Reference in New Issue
Block a user