Commit 369ca68a35469730a8d071f149aa7b6254ca9f0b
1 parent
5b31f27b
feat:【ai 大模型】增加 MCP Server Client Starter 示例
Showing
3 changed files
with
16 additions
and
1 deletions
yudao-module-ai/pom.xml
| ... | ... | @@ -193,6 +193,12 @@ |
| 193 | 193 | <version>${spring-ai.version}</version> |
| 194 | 194 | </dependency> |
| 195 | 195 | |
| 196 | + <dependency> | |
| 197 | + <groupId>org.springframework.ai</groupId> | |
| 198 | + <artifactId>spring-ai-starter-mcp-client-webflux</artifactId> | |
| 199 | + <version>${spring-ai.version}</version> | |
| 200 | + </dependency> | |
| 201 | + | |
| 196 | 202 | <!-- TinyFlow:AI 工作流 --> |
| 197 | 203 | <dependency> |
| 198 | 204 | <groupId>dev.tinyflow</groupId> | ... | ... |
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/service/chat/AiChatMessageServiceImpl.java
| ... | ... | @@ -346,7 +346,8 @@ public class AiChatMessageServiceImpl implements AiChatMessageService { |
| 346 | 346 | // 2.2 构建 ChatOptions 对象 |
| 347 | 347 | AiPlatformEnum platform = AiPlatformEnum.validatePlatform(model.getPlatform()); |
| 348 | 348 | ChatOptions chatOptions = AiUtils.buildChatOptions(platform, model.getModel(), |
| 349 | - conversation.getTemperature(), conversation.getMaxTokens(), toolNames, toolContext); | |
| 349 | + conversation.getTemperature(), conversation.getMaxTokens(), | |
| 350 | + toolNames, toolContext); | |
| 350 | 351 | return new Prompt(chatMessages, chatOptions); |
| 351 | 352 | } |
| 352 | 353 | ... | ... |
yudao-server/src/main/resources/application.yaml
| ... | ... | @@ -203,6 +203,14 @@ spring: |
| 203 | 203 | version: 1.0.0 |
| 204 | 204 | instructions: 一个 MCP 示例服务 |
| 205 | 205 | sse-endpoint: /sse |
| 206 | + client: | |
| 207 | + enabled: true | |
| 208 | + name: mcp | |
| 209 | + sse: | |
| 210 | + connections: | |
| 211 | + filesystem: | |
| 212 | + url: http://127.0.0.1:8089 | |
| 213 | + sse-endpoint: /sse | |
| 206 | 214 | |
| 207 | 215 | yudao: |
| 208 | 216 | ai: | ... | ... |