代码优化
This commit is contained in:
@@ -92,7 +92,7 @@ public class WebClientThinkConfig {
|
||||
}
|
||||
String reasoningContent = (String) delta.get("reasoning_content");
|
||||
String content = (String) delta.get("content");
|
||||
if (StringUtils.isNotBlank(reasoningContent)) {
|
||||
if (StringUtils.isNotBlank(reasoningContent) && StringUtils.isBlank(content)) {
|
||||
if (!thinkingFlag.get()) {
|
||||
thinkingFlag.set(true);
|
||||
delta.put("content", "<think>\n" + reasoningContent);
|
||||
@@ -102,7 +102,7 @@ public class WebClientThinkConfig {
|
||||
} else {
|
||||
if (thinkingFlag.get()) {
|
||||
thinkingFlag.set(false);
|
||||
delta.put("content", "</think>" + (content == null ? "" : content));
|
||||
delta.put("content", "</think>\n" + (content == null ? "" : content));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,19 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
@ConfigurationProperties("spring.ai")
|
||||
public class CmsAiProperties {
|
||||
|
||||
/**
|
||||
* 是否启用 Tool calling 工具调用
|
||||
*/
|
||||
private Boolean toolCalls = false;
|
||||
|
||||
/**
|
||||
* 默认系统提示词
|
||||
*/
|
||||
private String defaultSystem = "";
|
||||
|
||||
/**
|
||||
* 默认问题模板格式
|
||||
*/
|
||||
private String defaultPromptTemplate = "";
|
||||
|
||||
public Boolean getToolCalls() {
|
||||
|
||||
@@ -59,6 +59,9 @@ public class CmsAiChatService extends BaseService {
|
||||
* @author ThinkGem
|
||||
*/
|
||||
public List<Message> getChatMessage(String conversationId) {
|
||||
if (StringUtils.isBlank(conversationId)) {
|
||||
return List.of();
|
||||
}
|
||||
return chatMemory.get(conversationId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user