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