Commit 6ccd0ca61e6a3540c01dd61d7f7dede71e849332
1 parent
cc24eca4
【代码优化】AI:优化 pom 依赖的说明
Showing
3 changed files
with
40 additions
and
49 deletions
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/chat/AiChatMessageServiceImpl.java
| ... | ... | @@ -120,7 +120,6 @@ public class AiChatMessageServiceImpl implements AiChatMessageService { |
| 120 | 120 | AiChatMessageDO assistantMessage = createChatMessage(conversation.getId(), userMessage.getId(), model, |
| 121 | 121 | userId, conversation.getRoleId(), MessageType.ASSISTANT, "", sendReqVO.getUseContext()); |
| 122 | 122 | |
| 123 | - | |
| 124 | 123 | // 3.2 召回段落 |
| 125 | 124 | List<AiKnowledgeSegmentDO> segmentList = recallSegment(sendReqVO.getContent(), conversation.getKnowledgeId()); |
| 126 | 125 | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/pom.xml
| ... | ... | @@ -20,10 +20,11 @@ |
| 20 | 20 | |
| 21 | 21 | <dependencies> |
| 22 | 22 | <dependency> |
| 23 | - <groupId>${spring-ai.groupId}</groupId> | |
| 24 | - <artifactId>spring-ai-zhipuai-spring-boot-starter</artifactId> | |
| 25 | - <version>${spring-ai.version}</version> | |
| 23 | + <groupId>cn.iocoder.boot</groupId> | |
| 24 | + <artifactId>yudao-common</artifactId> | |
| 26 | 25 | </dependency> |
| 26 | + | |
| 27 | + <!-- Spring AI Model 模型接入 --> | |
| 27 | 28 | <dependency> |
| 28 | 29 | <groupId>${spring-ai.groupId}</groupId> |
| 29 | 30 | <artifactId>spring-ai-openai-spring-boot-starter</artifactId> |
| ... | ... | @@ -44,68 +45,65 @@ |
| 44 | 45 | <artifactId>spring-ai-stability-ai-spring-boot-starter</artifactId> |
| 45 | 46 | <version>${spring-ai.version}</version> |
| 46 | 47 | </dependency> |
| 47 | - | |
| 48 | - <!-- 向量化,基于 Redis 存储,Tika 解析内容 --> | |
| 49 | - | |
| 50 | - <!-- 暂不做经济型,先注释 TODO 经济型是啥呀? --> | |
| 51 | - <!-- <dependency>--> | |
| 52 | - <!-- <groupId>${spring-ai.groupId}</groupId>--> | |
| 53 | - <!-- <artifactId>spring-ai-transformers-spring-boot-starter</artifactId>--> | |
| 54 | - <!-- <version>${spring-ai.version}</version>--> | |
| 55 | - <!-- </dependency>--> | |
| 56 | 48 | <dependency> |
| 49 | + <!-- 通义千问 --> | |
| 50 | + <groupId>com.alibaba.cloud.ai</groupId> | |
| 51 | + <artifactId>spring-ai-alibaba-starter</artifactId> | |
| 52 | + <version>1.0.0-M5.1</version> | |
| 53 | + </dependency> | |
| 54 | + <dependency> | |
| 55 | + <!-- 文心一言 --> | |
| 57 | 56 | <groupId>${spring-ai.groupId}</groupId> |
| 58 | - <artifactId>spring-ai-tika-document-reader</artifactId> | |
| 57 | + <artifactId>spring-ai-qianfan-spring-boot-starter</artifactId> | |
| 59 | 58 | <version>${spring-ai.version}</version> |
| 60 | - <!-- TODO 芋艿:boot 项目里,不引入 cloud 依赖!!!另外,这样也是为了解决启动报错的问题! --> | |
| 61 | - <exclusions> | |
| 62 | - <exclusion> | |
| 63 | - <artifactId>spring-cloud-function-context</artifactId> | |
| 64 | - <groupId>org.springframework.cloud</groupId> | |
| 65 | - </exclusion> | |
| 66 | - <exclusion> | |
| 67 | - <artifactId>spring-cloud-function-core</artifactId> | |
| 68 | - <groupId>org.springframework.cloud</groupId> | |
| 69 | - </exclusion> | |
| 70 | - </exclusions> | |
| 71 | 59 | </dependency> |
| 72 | 60 | <dependency> |
| 61 | + <!-- 智谱 GLM --> | |
| 73 | 62 | <groupId>${spring-ai.groupId}</groupId> |
| 74 | - <artifactId>spring-ai-redis-store</artifactId> | |
| 63 | + <artifactId>spring-ai-zhipuai-spring-boot-starter</artifactId> | |
| 75 | 64 | <version>${spring-ai.version}</version> |
| 76 | 65 | </dependency> |
| 77 | 66 | |
| 67 | + <!-- 向量存储:https://db-engines.com/en/ranking/vector+dbms --> | |
| 78 | 68 | <dependency> |
| 79 | - <groupId>cn.iocoder.boot</groupId> | |
| 80 | - <artifactId>yudao-spring-boot-starter-redis</artifactId> | |
| 69 | + <!-- Qdrant:https://qdrant.tech/ --> | |
| 70 | + <groupId>${spring-ai.groupId}</groupId> | |
| 71 | + <artifactId>spring-ai-qdrant-store</artifactId> | |
| 72 | + <version>${spring-ai.version}</version> | |
| 81 | 73 | </dependency> |
| 82 | 74 | |
| 83 | 75 | <dependency> |
| 76 | + <!-- Redis:https://redis.io/docs/latest/develop/get-started/vector-database/ --> | |
| 77 | + <groupId>${spring-ai.groupId}</groupId> | |
| 78 | + <artifactId>spring-ai-redis-store</artifactId> | |
| 79 | + <version>${spring-ai.version}</version> | |
| 80 | + </dependency> | |
| 81 | + <dependency> | |
| 84 | 82 | <groupId>cn.iocoder.boot</groupId> |
| 85 | - <artifactId>yudao-common</artifactId> | |
| 83 | + <artifactId>yudao-spring-boot-starter-redis</artifactId> | |
| 86 | 84 | </dependency> |
| 87 | 85 | |
| 88 | 86 | <dependency> |
| 89 | - <groupId>${spring-ai.groupId}</groupId> | |
| 90 | - <artifactId>spring-ai-qianfan-spring-boot-starter</artifactId> | |
| 87 | + <!-- Milvus:https://milvus.io/ --> | |
| 88 | + <groupId>org.springframework.ai</groupId> | |
| 89 | + <artifactId>spring-ai-milvus-store</artifactId> | |
| 91 | 90 | <version>${spring-ai.version}</version> |
| 92 | 91 | </dependency> |
| 93 | - <dependency> | |
| 94 | - <groupId>com.alibaba.cloud.ai</groupId> | |
| 95 | - <artifactId>spring-ai-alibaba-starter</artifactId> | |
| 96 | - <version>1.0.0-M5.1</version> | |
| 97 | - </dependency> | |
| 98 | 92 | |
| 99 | - <!-- 阿里云 通义千问 --> | |
| 100 | - <!-- TODO 芋艿:等 spring cloud alibaba ai 发布最新的时候,可以替换掉这个依赖,并且删除我们直接 cv 的代码 --> | |
| 101 | 93 | <dependency> |
| 102 | - <groupId>com.alibaba</groupId> | |
| 103 | - <artifactId>dashscope-sdk-java</artifactId> | |
| 104 | - <version>2.14.0</version> | |
| 94 | + <!-- Tika:负责内容的解析 --> | |
| 95 | + <groupId>${spring-ai.groupId}</groupId> | |
| 96 | + <artifactId>spring-ai-tika-document-reader</artifactId> | |
| 97 | + <version>${spring-ai.version}</version> | |
| 98 | + <!-- TODO 芋艿:boot 项目里,不引入 cloud 依赖!!!另外,这样也是为了解决启动报错的问题! --> | |
| 105 | 99 | <exclusions> |
| 106 | 100 | <exclusion> |
| 107 | - <groupId>org.slf4j</groupId> | |
| 108 | - <artifactId>slf4j-simple</artifactId> | |
| 101 | + <artifactId>spring-cloud-function-context</artifactId> | |
| 102 | + <groupId>org.springframework.cloud</groupId> | |
| 103 | + </exclusion> | |
| 104 | + <exclusion> | |
| 105 | + <artifactId>spring-cloud-function-core</artifactId> | |
| 106 | + <groupId>org.springframework.cloud</groupId> | |
| 109 | 107 | </exclusion> |
| 110 | 108 | </exclusions> |
| 111 | 109 | </dependency> | ... | ... |
yudao-server/src/main/resources/application.yaml
| ... | ... | @@ -151,12 +151,6 @@ spring: |
| 151 | 151 | redis: |
| 152 | 152 | index: default-index |
| 153 | 153 | prefix: "default:" |
| 154 | - embedding: | |
| 155 | - transformer: | |
| 156 | - onnx: | |
| 157 | - model-uri: https://raw.gitcode.com/yudaocode/yudao-demo/raw/master/yudao-static/ai/model.onnx | |
| 158 | - tokenizer: | |
| 159 | - uri: https://raw.gitcode.com/yudaocode/yudao-demo/raw/master/yudao-static/ai/tokenizer.json | |
| 160 | 154 | qianfan: # 文心一言 |
| 161 | 155 | api-key: x0cuLZ7XsaTCU08vuJWO87Lg |
| 162 | 156 | secret-key: R9mYF9dl9KASgi5RUq0FQt3wRisSnOcK | ... | ... |