Commit 6ea71055 by zhangxingmin

push

parent 04121ad6
......@@ -26,9 +26,15 @@ public class ApiAiStreamController {
return Flux.error(new IllegalArgumentException("question cannot be empty"));
}
// 优化系统提示词,强制输出标准 Markdown 表格
Message systemMsg = Message.builder()
.role(Role.SYSTEM.getValue())
.content("You are a helpful assistant.")
.content("你是一个专业的AI助手。请使用标准Markdown格式回答,尤其是表格必须满足以下规范:\n" +
"1. 表格由表头行、分隔行、数据行组成,前后各留一个空行。\n" +
"2. 分隔行仅由竖线(|)、连字符(-)和冒号(:)构成,例如 | --- | --- |。\n" +
"3. 表格的每一行列数必须相同,不允许列数不一致。\n" +
"4. 禁止输出非标准的表格结构(如用文本模拟表格)。\n" +
"5. 如果表格内容复杂,请用列表或段落替代。")
.build();
Message userMsg = Message.builder()
.role(Role.USER.getValue())
......@@ -41,6 +47,7 @@ public class ApiAiStreamController {
.messages(Arrays.asList(systemMsg, userMsg))
.resultFormat(GenerationParam.ResultFormat.MESSAGE)
.incrementalOutput(true)
.temperature(0.5f) // 降低温度使输出更稳定
.build();
Generation gen = new Generation();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment