mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 11:07:06 +00:00
[improvement][chat] Optimize the MemoryReviewTask task by adding individual exception handling (#1788)
This commit is contained in:
@@ -49,11 +49,14 @@ public class MemoryReviewTask {
|
||||
|
||||
@Scheduled(fixedDelay = 60 * 1000)
|
||||
public void review() {
|
||||
try {
|
||||
memoryService.getMemoriesForLlmReview().stream().forEach(this::processMemory);
|
||||
} catch (Exception e) {
|
||||
log.error("Exception occurred during memory review task", e);
|
||||
}
|
||||
memoryService.getMemoriesForLlmReview().stream().forEach(memory -> {
|
||||
try {
|
||||
processMemory(memory);
|
||||
} catch (Exception e) {
|
||||
log.error("Exception occurred while processing memory with id {}: {}",
|
||||
memory.getId(), e.getMessage(), e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void processMemory(ChatMemoryDO m) {
|
||||
|
||||
@@ -105,8 +105,7 @@ public class AgentServiceImpl extends ServiceImpl<AgentDOMapper, AgentDO> implem
|
||||
}
|
||||
|
||||
private synchronized void doExecuteAgentExamples(Agent agent) {
|
||||
if (!agent.containsDatasetTool()
|
||||
|| !agent.enableMemoryReview()
|
||||
if (!agent.containsDatasetTool() || !agent.enableMemoryReview()
|
||||
|| !ModelConfigHelper.testConnection(
|
||||
ModelConfigHelper.getChatModelConfig(agent, ChatModelType.TEXT_TO_SQL))
|
||||
|| CollectionUtils.isEmpty(agent.getExamples())) {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.tencent.supersonic.headless.api.pojo;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ModelSchema {
|
||||
|
||||
|
||||
@@ -56,7 +56,8 @@ public class LLMSqlCorrector extends BaseSemanticCorrector {
|
||||
return;
|
||||
}
|
||||
|
||||
ChatLanguageModel chatLanguageModel = ModelProvider.getChatModel(chatQueryContext.getModelConfig());
|
||||
ChatLanguageModel chatLanguageModel =
|
||||
ModelProvider.getChatModel(chatQueryContext.getModelConfig());
|
||||
SemanticSqlExtractor extractor =
|
||||
AiServices.create(SemanticSqlExtractor.class, chatLanguageModel);
|
||||
Prompt prompt = generatePrompt(chatQueryContext.getQueryText(), semanticParseInfo);
|
||||
|
||||
Reference in New Issue
Block a user