Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-ai
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xingmin
yd-ai
Commits
6ea71055
Commit
6ea71055
authored
Apr 01, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
04121ad6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletions
+8
-1
yd-ai-api/src/main/java/com/yd/ai/api/controller/ApiAiStreamController.java
+8
-1
No files found.
yd-ai-api/src/main/java/com/yd/ai/api/controller/ApiAiStreamController.java
View file @
6ea71055
...
@@ -26,9 +26,15 @@ public class ApiAiStreamController {
...
@@ -26,9 +26,15 @@ public class ApiAiStreamController {
return
Flux
.
error
(
new
IllegalArgumentException
(
"question cannot be empty"
));
return
Flux
.
error
(
new
IllegalArgumentException
(
"question cannot be empty"
));
}
}
// 优化系统提示词,强制输出标准 Markdown 表格
Message
systemMsg
=
Message
.
builder
()
Message
systemMsg
=
Message
.
builder
()
.
role
(
Role
.
SYSTEM
.
getValue
())
.
role
(
Role
.
SYSTEM
.
getValue
())
.
content
(
"You are a helpful assistant."
)
.
content
(
"你是一个专业的AI助手。请使用标准Markdown格式回答,尤其是表格必须满足以下规范:\n"
+
"1. 表格由表头行、分隔行、数据行组成,前后各留一个空行。\n"
+
"2. 分隔行仅由竖线(|)、连字符(-)和冒号(:)构成,例如 | --- | --- |。\n"
+
"3. 表格的每一行列数必须相同,不允许列数不一致。\n"
+
"4. 禁止输出非标准的表格结构(如用文本模拟表格)。\n"
+
"5. 如果表格内容复杂,请用列表或段落替代。"
)
.
build
();
.
build
();
Message
userMsg
=
Message
.
builder
()
Message
userMsg
=
Message
.
builder
()
.
role
(
Role
.
USER
.
getValue
())
.
role
(
Role
.
USER
.
getValue
())
...
@@ -41,6 +47,7 @@ public class ApiAiStreamController {
...
@@ -41,6 +47,7 @@ public class ApiAiStreamController {
.
messages
(
Arrays
.
asList
(
systemMsg
,
userMsg
))
.
messages
(
Arrays
.
asList
(
systemMsg
,
userMsg
))
.
resultFormat
(
GenerationParam
.
ResultFormat
.
MESSAGE
)
.
resultFormat
(
GenerationParam
.
ResultFormat
.
MESSAGE
)
.
incrementalOutput
(
true
)
.
incrementalOutput
(
true
)
.
temperature
(
0.5f
)
// 降低温度使输出更稳定
.
build
();
.
build
();
Generation
gen
=
new
Generation
();
Generation
gen
=
new
Generation
();
...
...
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