This project is a Spring Boot application that demonstrates the integration of an AI chat client using the Spring AI framework. The application provides several endpoints to interact with the AI chat client.
application.yml
The application.yml
file contains the configuration for the server and the AI chat client, including retry settings and API keys.
server:
port: 8888
spring:
ai:
retry:
max-attempts: 3
backoff:
initial-interval: 5000ms
multiplier: 5
max-interval: 180000ms
on-client-errors: true
qianfan:
api-key: YOUR_API_KEY
secret-key: YOUR_SECRET_KEY
chat:
enabled: true
options:
model: yi_34b_chat
temperature: 0.7
top-p: 0.9
/chat/ai/simple
Returns a simple chat completion.
message
(default: "给我讲个笑话")/chat/ai/simple2
Returns a chat completion with a specified voice.
message
(default: "给我讲个笑话"), voice
/chat/ai/stream
Streams the chat completion.
message
(default: "给我讲个笑话"), voice
/chat/ai/actor
Generates the filmography for a random actor.
message
(default: "Generate the filmography for a random actor")/chat/ai/actor2
Generates the filmography of 5 movies for Tom Hanks and Bill Murray.
message
(default: "Generate the filmography of 5 movies for Tom Hanks and Bill Murray.")/chat/ai/actor3
Generates the filmography for a random actor with a custom format.
message
(default: "Generate the filmography for a random actor.")/chat/ai/context
Maintains a conversation context with the AI.
prompt
application.yml
file with your API key and secret key.mvn clean install
mvn spring-boot:run
This project is licensed under the MIT License.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。