[fix][chat] The terms in the descriptor of the term no longer undergo descriptor mapping (#1897)

This commit is contained in:
lexluo09
2024-11-09 14:16:55 +08:00
committed by GitHub
parent c9c6dc4e44
commit d4a9d5a7e6
3 changed files with 8 additions and 4 deletions

View File

@@ -22,10 +22,10 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Collections; import java.util.Collections;
import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.List;
@Component @Component
@Slf4j @Slf4j
@@ -64,7 +64,8 @@ public class MemoryReviewTask {
if (!agent.enableMemoryReview()) { if (!agent.enableMemoryReview()) {
continue; continue;
} }
ChatMemoryFilter chatMemoryFilter = ChatMemoryFilter.builder().agentId(agent.getId()).build(); ChatMemoryFilter chatMemoryFilter =
ChatMemoryFilter.builder().agentId(agent.getId()).build();
memoryService.getMemories(chatMemoryFilter).stream().forEach(memory -> { memoryService.getMemories(chatMemoryFilter).stream().forEach(memory -> {
try { try {
processMemory(memory, agent); processMemory(memory, agent);

View File

@@ -30,6 +30,7 @@ public class QueryNLReq extends SemanticQueryReq implements Serializable {
private List<Text2SQLExemplar> dynamicExemplars = Lists.newArrayList(); private List<Text2SQLExemplar> dynamicExemplars = Lists.newArrayList();
private SemanticParseInfo contextParseInfo; private SemanticParseInfo contextParseInfo;
private SemanticParseInfo selectedParseInfo; private SemanticParseInfo selectedParseInfo;
private boolean descriptionMapped;
@Override @Override
public String toCustomizedString() { public String toCustomizedString() {

View File

@@ -20,7 +20,8 @@ public class TermDescMapper extends BaseMapper {
public void doMap(ChatQueryContext chatQueryContext) { public void doMap(ChatQueryContext chatQueryContext) {
SchemaMapInfo mapInfo = chatQueryContext.getMapInfo(); SchemaMapInfo mapInfo = chatQueryContext.getMapInfo();
List<SchemaElement> termElements = mapInfo.getTermDescriptionToMap(); List<SchemaElement> termElements = mapInfo.getTermDescriptionToMap();
if (CollectionUtils.isEmpty(termElements)) { if (CollectionUtils.isEmpty(termElements)
|| chatQueryContext.getRequest().isDescriptionMapped()) {
return; return;
} }
for (SchemaElement schemaElement : termElements) { for (SchemaElement schemaElement : termElements) {
@@ -39,6 +40,7 @@ public class TermDescMapper extends BaseMapper {
queryContext.setSemanticSchema(chatQueryContext.getSemanticSchema()); queryContext.setSemanticSchema(chatQueryContext.getSemanticSchema());
queryContext.setModelIdToDataSetIds(chatQueryContext.getModelIdToDataSetIds()); queryContext.setModelIdToDataSetIds(chatQueryContext.getModelIdToDataSetIds());
queryContext.setChatWorkflowState(chatQueryContext.getChatWorkflowState()); queryContext.setChatWorkflowState(chatQueryContext.getChatWorkflowState());
queryContext.getRequest().setDescriptionMapped(true);
return queryContext; return queryContext;
} }
} }