惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Cisco Blogs
Schneier on Security
Schneier on Security
T
Tor Project blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tenable Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Threat Research - Cisco Blogs
C
CERT Recently Published Vulnerability Notes
Security Latest
Security Latest
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
NISL@THU
NISL@THU
L
Lohrmann on Cybersecurity
Scott Helme
Scott Helme
Webroot Blog
Webroot Blog
Project Zero
Project Zero
Google Online Security Blog
Google Online Security Blog
The Last Watchdog
The Last Watchdog
Spread Privacy
Spread Privacy
Hacker News: Ask HN
Hacker News: Ask HN
PCI Perspectives
PCI Perspectives
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
W
WeLiveSecurity
Attack and Defense Labs
Attack and Defense Labs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
N
News | PayPal Newsroom
Help Net Security
Help Net Security
The Hacker News
The Hacker News
H
Heimdal Security Blog
O
OpenAI News
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
Cyberwarzone
Cyberwarzone
Simon Willison's Weblog
Simon Willison's Weblog
G
GRAHAM CLULEY
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 叶小钗
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
Tailwind CSS Blog
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
I
Intezer
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
Security Affairs
P
Proofpoint News Feed
S
Secure Thoughts
腾讯CDC
Google DeepMind News
Google DeepMind News
量子位
罗磊的独立博客

博客园 - cn2025

kubeSphere发布ruoyi-web前端 20260711 kubeSphere发布ruoyi-pro后端 k8s集群-kubeShpere 20260710 安装Helm 20260710 k8s-portainer docker 镜像查询 k8集群一键重置 docker run OceanBase spring ai alibaba doc AI2.0 【多模态】 20260615 世界只有一个墨脱 AI2.0 【Mcp-client】 20260611 AI2.0 【Mcp-server】 20260611 GoLand 配Go SDK AI2.0 【redis向量-Rag】 问答顾问器QuestionAnswerAdvisor 20260608 AI2.0 【redis向量】redis-stack 20260608 AI2.0 【Embedding】嵌入模型 20260606 AI 工具 AI2.0 Tool调用20260604 AI2.0 对话chatMemory20260601 AI2.0 模型输出结构化【POJO、Record、List、Map 】20260530 AI2.0 Prompt【模板、流式 API、系统提示词】 20260529 AI2.0 自定义Advisor 20260528 AI2.0 ollama 20260528 AI2.0 dashscope-openai 20260527 ps 配Claude 20260527 spring-ai-alibaba-agent 260526 票务 Tool+Spring Security【动态tooLs:toolCallbacks】 20260525 spring-ai-alibaba-agent 260525 spring-ai-alibaba-agent 260523 票务 Tool接口 / 方法 / 参数【无意义、可读、业务化、参数数量过多】 20260521 票务 Tool参数幻觉 20260521 spring-ai-alibaba-agent 260521 ToolTemperature 温度过低,AI推算缺失自由度20260520 spring-ai-alibaba-agent 260520 票务Tool 20260519 票务助手 -多模型20260518 结构化输出 -原理【structuredconverter】20260518 spring-ai-alibaba-agent 260518 Dify 添加Ollma模型qwen2:0.5b 应用 20260516 docker 部【dify-api】/【dify-web】 20260514 Chatclient 结构化输出20260514 spring-ai-alibaba-agent 260514 Chatmemory 多层(近、中、长期)20260513 ChatmemoryRedis 历史对话存【REDIS】20260512 ChatmemoryJdbc 历史对话存【JDBC】20260511 spring-ai-alibaba-agent 260511 ChatmemoryConversationId 多用户对话记忆 20260508 spring-ai-alibaba-agent 260508 ChatmemoryMax 历史对话长度20260507 2026SE Chatmemory 对话记忆20260506 spring-ai-alibaba-agent 260506 ChatClientPrompt 自定义拦截器【ReReadingAdvisor】重读提示词 20260430 docker-apache/kafka:4.1.2部暑 集群20260423 ChatClientPrompt Template.st20260428 ChatClientPrompt Template20260427 sb-KafkaListener 20260425 docker-apache/kafka:4.1.2部暑 20260425 dashscope-sb ChatClientPrompt20260425 SBAI-MultiPlatformAndModel 20260424 PlatformModel SB-ChatClient-DeepSeekDashScopeOllamaModel 20260424 ollama-sb 多态 图转文 20260418 【gemma3:4b 解析慢】 dashscope-sb 多模态(图片、语音识别) 文生视频 ollama-sb 20260414 dashscope-sb 阿里百炼-文生图20260413 dashscope-sb20260413 dashscope-sb20260411 docker-zabbix 20260410 deepseek-sb20260408 MQTT20260403 spring-ai-alibaba-agent 260403 MqttTest 20260401 spring-ai-alibaba-agent 260401 docker安装 EMQX spring-ai-alibaba-agent 260331 MQTT 20260331 spring-ai-alibaba-agent 三大 Java 生态 AI Agent 框架 CentOS7-静态 IP centos-stream10 安装 百炼-工作流-sb sb-flink1.13.1-jdk8-分隔字符串 20260125
dashscope-sb ChatClient20260420
cn2025 · 2026-04-20 · via 博客园 - cn2025

1、pom

<properties>
<java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot.version>3.2.0</spring-boot.version>
<spring-ai.version>1.0.0</spring-ai.version>
<spring-ai-alibaba.version>1.0.0.2</spring-ai-alibaba.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- 阿里云通义千问(DashScope)starter -->
<dependency>
<groupId>com.alibaba.cloud.ai</groupId>
<artifactId>spring-ai-alibaba-starter-dashscope</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- 统一管理Spring AI依赖版本 -->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-bom</artifactId>
<version>${spring-ai.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.cloud.ai</groupId>
<artifactId>spring-ai-alibaba-bom</artifactId>
<version>${spring-ai-alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- Spring AI 里程碑/快照仓库(必须配置,否则依赖无法下载) -->
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>

2、yml


#server.port=18081
#spring.ai.dashscope.api-key="sk-72d9fd311cde487eb948bcd999ea4a65"
#spring.ai.dashscope.chat.options.model= sk-8718a83408d7443b9544cdfbf259280f
#sk-72d9fd311cde487eb948bcd999ea4a65
server:
port: 18081
spring:
ai:
dashscope:
api-key: sk-8718a83408d7443bxxxxxxx

3、controller

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import reactor.core.publisher.Flux;

@RequestMapping("/openai")
@ResponseBody
@Controller
public class ChatclientControlller {
@Autowired
private ChatClient.Builder chatClientBuilder;

@GetMapping("/simple/chatclient")
public String chatclient () {
// 构建ChatClient并调用
ChatClient chatClient = chatClientBuilder.build();
String content = chatClient.prompt("你好").call().content();

System.out.println(content);
return content;
}

@GetMapping("/simple/chatclientstream")
public void chatclientstream () {
// 构建ChatClient并流式调用
ChatClient chatClient = chatClientBuilder.build();
Flux<String> content = chatClient.prompt("你好").stream().content();
content.toIterable().forEach(s -> System.out.print(s));
}
}

4、浏览器
http://localhost:18081/openai/simple/chatclient

image

 http://localhost:18081/openai/simple/chatclientstream

image