fix: 调整topic提取的设置

This commit is contained in:
tcmofashi
2025-03-04 19:40:00 +08:00
parent f1a2ccfccf
commit 5a46ee7c70
4 changed files with 45 additions and 8 deletions

View File

@@ -12,7 +12,19 @@ config = driver.config
class TopicIdentifier:
def __init__(self):
self.llm_client = LLM_request(model=global_config.llm_normal)
self.llm_client = LLM_request(model=global_config.llm_topic_extract)
self.select=global_config.topic_extract
def identify_topic(self):
if self.select=='jieba':
return self.identify_topic_jieba
elif self.select=='snownlp':
return self.identify_topic_snownlp
elif self.select=='llm':
return self.identify_topic_llm
else:
return self.identify_topic_snownlp
async def identify_topic_llm(self, text: str) -> Optional[List[str]]:
"""识别消息主题,返回主题列表"""