更新意图识别模块,优化软件锁类的描述信息,增强代码可读性。同时,调整分类信息示例,新增后缀名咨询的示例,提升用户体验。更新多个二进制索引文件以反映最新变化。

This commit is contained in:
2025-06-19 14:43:22 +08:00
parent 9fe4094f5b
commit 86510d5c0e
8 changed files with 279 additions and 242 deletions
+15 -14
View File
@@ -52,6 +52,7 @@ class IntentRecognizer:
# 初始化LLM
llm_params = {
"temperature": 0.2, # 降低随机性,使结果更确定
"top_p": 0.7,
"model": model_name
}
@@ -117,14 +118,15 @@ class IntentRecognizer:
output_format=classification_parser.get_format_instructions(),
conversation_context=conversation_context,
chat_history=json.dumps(chat_history, ensure_ascii=False))
# 调用LLM
response = self._llm.invoke(formatted_prompt, False)
classification_end_time = time.time()
classification_time = classification_end_time - classification_start_time
logging.info(f"意图分类耗时统计 - 总耗时: {classification_time:.2f}")
# 解析输出
try:
# 调用LLM
response = self._llm.invoke(formatted_prompt, False)
classification_end_time = time.time()
classification_time = classification_end_time - classification_start_time
logging.info(f"意图分类耗时统计 - 总耗时: {classification_time:.2f}")
# 尝试直接解析JSON响应
parsed_output = classification_parser.parse(response.content.strip())
return parsed_output
@@ -319,12 +321,11 @@ class IntentRecognizer:
keywords=keywords_str,
chat_history=chat_history,
context=context)
# 调用LLM
response = self._llm.invoke(formatted_prompt, False)
# 解析输出
try:
# 调用LLM
response = self._llm.invoke(formatted_prompt, False)
# 尝试直接解析JSON响应
parsed_output = query_rewrite_parser.parse(response.content)
rewrite_end_time = time.time()
@@ -531,11 +532,11 @@ class IntentRecognizer:
chat_history=json.dumps(chat_history,ensure_ascii=False),
previous_slots=json.dumps(previous_slots,ensure_ascii=False),
)
# 调用LLM
response = self._llm.invoke(formatted_prompt, False)
try:
# 调用LLM
response = self._llm.invoke(formatted_prompt, False)
# 尝试解析LLM响应
parsed_output = slot_parser.parse(response.content)
return parsed_output