Commit 9602b9a8 authored by 林洋洋's avatar 林洋洋

修改接口文档

parent 619badac
......@@ -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));
......
......@@ -3,7 +3,7 @@ spring:
type: redis # 缓存类型 Redis
data:
redis:
database: 6
database: 7
host: 81.70.183.25
port: 16379
password: '123qwe!@#'
......
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