Commit 6e12104a by zhangxingmin

push

parent 9e9c9872
...@@ -24,6 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -24,6 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Arrays; import java.util.Arrays;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -85,14 +87,19 @@ public class ApiAiStreamServiceImpl implements ApiAiStreamService { ...@@ -85,14 +87,19 @@ public class ApiAiStreamServiceImpl implements ApiAiStreamService {
.role(Role.SYSTEM.getValue()) .role(Role.SYSTEM.getValue())
.content("You are a helpful assistant.") .content("You are a helpful assistant.")
.build(); .build();
// 获取当前日期并附加到用户问题
String currentDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"));
String questionWithDate = question + " (当前日期:" + currentDate + ")";
Message userMsg = Message.builder() Message userMsg = Message.builder()
.role(Role.USER.getValue()) .role(Role.USER.getValue())
.content(question) .content(questionWithDate)
.build(); .build();
GenerationParam param = GenerationParam.builder() GenerationParam param = GenerationParam.builder()
.apiKey("sk-d6551c67cfbe4a759a78dc3625729291") // 生产环境建议从配置读取 .apiKey("sk-d6551c67cfbe4a759a78dc3625729291")
.model("qwen3-max") // 使用可用的模型 .model("qwen3-max")
.messages(Arrays.asList(systemMsg, userMsg)) .messages(Arrays.asList(systemMsg, userMsg))
.resultFormat(GenerationParam.ResultFormat.MESSAGE) .resultFormat(GenerationParam.ResultFormat.MESSAGE)
.incrementalOutput(true) .incrementalOutput(true)
......
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