(fix)(headless)When reload dictWord, the old data was not cleared (#1659)

This commit is contained in:
SuperLiChaoRen
2024-09-12 22:27:17 +08:00
committed by GitHub
parent e07ba7cfdb
commit 47cc933aec

View File

@@ -6,6 +6,7 @@ import com.tencent.supersonic.headless.api.pojo.SchemaElementType;
import com.tencent.supersonic.headless.api.pojo.SemanticSchema;
import com.tencent.supersonic.headless.chat.knowledge.DictWord;
import com.tencent.supersonic.headless.chat.knowledge.KnowledgeBaseService;
import com.tencent.supersonic.headless.chat.knowledge.SearchService;
import com.tencent.supersonic.headless.chat.knowledge.builder.WordBuilderFactory;
import com.tencent.supersonic.headless.server.service.SchemaService;
import lombok.extern.slf4j.Slf4j;
@@ -43,6 +44,7 @@ public class DictWordService {
return;
}
setPreDictWords(dictWords);
SearchService.clear();
knowledgeBaseService.updateOnlineKnowledge(getAllDictWords());
long duration = System.currentTimeMillis() - startTime;
log.info("Dictionary has been regularly reloaded in {} milliseconds", duration);