Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ask_data_ai_admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linyangyang
ask_data_ai_admin
Commits
9602b9a8
Commit
9602b9a8
authored
Jul 10, 2025
by
林洋洋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改接口文档
parent
619badac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
ChatController.java
...java/com/pig4cloud/pig/ask/controller/ChatController.java
+13
-4
application-dev.yml
pig-boot/src/main/resources/application-dev.yml
+1
-1
No files found.
pig-ask/pig-ask-biz/src/main/java/com/pig4cloud/pig/ask/controller/ChatController.java
View file @
9602b9a8
...
...
@@ -17,6 +17,7 @@ import org.springframework.ai.chat.memory.ChatMemory;
import
org.springframework.ai.chat.messages.Message
;
import
org.springframework.ai.chat.messages.SystemMessage
;
import
org.springframework.ai.chat.messages.UserMessage
;
import
org.springframework.ai.chat.model.ChatResponse
;
import
org.springframework.ai.chat.prompt.Prompt
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -65,12 +66,20 @@ public class ChatController {
*/
@Operation
(
summary
=
"普通对话"
,
description
=
"普通对话"
)
@GetMapping
(
value
=
"/chat"
,
produces
=
"text/html;charset=utf-8"
)
public
Flux
<
String
>
chat
(
String
message
,
String
conversationId
)
{
public
Flux
<
String
>
chat
(
String
message
,
String
conversationId
)
{
// 创建系统消息,告诉大模型只返回工具名和参数
Message
systemMessage
=
new
SystemMessage
(
"你是一个AI客服助手,请按照用户提问的问题回答,回答内容务必使用markdown格式。"
);
Message
systemMessage
=
new
SystemMessage
(
"你是一个AI客服助手。请严格按照以下格式回答每个问题:"
);
// 用户消息
Message
userMessage
=
new
UserMessage
(
message
);
String
question
=
"请严格按以下格式回答:\n"
+
"<think>\n"
+
"[你的逐步推理过程]\n"
+
"</think>\n"
+
"<answer>\n"
+
"[最终答案]\n"
+
"</answer>\n"
+
"推理过程不要设计`<think>` 和 `<answer>` \n"
+
"问题:"
+
message
+
"\n"
;
Message
userMessage
=
new
UserMessage
(
question
);
// 创建提示,包含系统消息和用户消息
Prompt
prompt
=
new
Prompt
(
Arrays
.
asList
(
systemMessage
,
userMessage
));
...
...
pig-boot/src/main/resources/application-dev.yml
View file @
9602b9a8
...
...
@@ -3,7 +3,7 @@ spring:
type
:
redis
# 缓存类型 Redis
data
:
redis
:
database
:
6
database
:
7
host
:
81.70.183.25
port
:
16379
password
:
'
123qwe!@#'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment