更新环境变量配置,调整模型名称获取方式,新增Dify API相关配置,删除无用的脚本文件,优化意图识别逻辑,添加LLM提取词条逻辑
This commit is contained in:
@@ -3,19 +3,15 @@ import json
|
||||
|
||||
from regex import search
|
||||
|
||||
import ijson
|
||||
import sys
|
||||
import os
|
||||
sys.path.append(os.getcwd())
|
||||
from rag2_0.dify.dify_tool import DifyTool
|
||||
|
||||
df = pd.read_excel("data/excel/已分析数据汇总(第一轮).xlsx")
|
||||
df=df[df["评价"]=="dislike"]
|
||||
dify_tool = DifyTool()
|
||||
|
||||
df = pd.read_excel("data/excel/0714提问数据汇总(已分析)_软件.xlsx")
|
||||
|
||||
msg_id_list = df["msg_id"].tolist()
|
||||
msg_debug_list = {}
|
||||
# 流式解析 JSON 数组
|
||||
with open("data/excel/msg_debug_list.json", "r", encoding="utf-8") as f:
|
||||
# 使用ijson.items直接获取顶层键值对
|
||||
for msg_id, data in ijson.kvitems(f, ''):
|
||||
if msg_id in msg_id_list:
|
||||
msg_debug_list[msg_id] = data
|
||||
|
||||
def get_rewrite_query(intent_node_execution_info)->str:
|
||||
outputs_result =json.loads(intent_node_execution_info['outputs'])
|
||||
@@ -28,7 +24,7 @@ def judge_error_node_and_reason(intent_node_execution_info, knowledge_filter_nod
|
||||
|
||||
outputs_result =json.loads(intent_node_execution_info['outputs'])
|
||||
result["问题改写结果"] = outputs_result['optimize_query']
|
||||
if outputs_result['is_complete'] == False:
|
||||
if outputs_result['is_complete'] == False and outputs_result["has_slot_filling"] == True:
|
||||
result["错误环节"] = "槽点填充"
|
||||
result["错误原因"] = f"槽点缺失"
|
||||
result["具体描述"] = f"缺失内容:{outputs_result['missing_slots']}"
|
||||
@@ -80,6 +76,8 @@ for index, row in df.iterrows():
|
||||
answer = row["回答"]
|
||||
query = row["提问"]
|
||||
rating = row["评价"]
|
||||
if rating != "dislike":
|
||||
continue
|
||||
class_type = row["问题分类"]
|
||||
dislike_reason = row["点踩原因"]
|
||||
if dislike_reason is None or pd.isna(dislike_reason):
|
||||
@@ -87,7 +85,8 @@ for index, row in df.iterrows():
|
||||
|
||||
answer_wiki_name = row["关联词条"]
|
||||
search_wiki = row["检索到的词条"]
|
||||
node_executions_info = msg_debug_list[msg_id]
|
||||
msg_debug_info = dify_tool.get_message_debug_info_by_id(msg_id)
|
||||
node_executions_info = msg_debug_info["workflow_node_executions_info"]
|
||||
intent_node_execution_info = [node_execution_info for node_execution_info in node_executions_info
|
||||
if node_execution_info["title"] == "意图识别结果解析"]
|
||||
|
||||
@@ -109,7 +108,7 @@ for index, row in df.iterrows():
|
||||
print(f"msg_id: {msg_id} 处理失败: {e}")
|
||||
continue
|
||||
|
||||
df.to_excel("data/excel/已分析数据汇总(第一轮)_分析.xlsx", index=False)
|
||||
df.to_excel("data/excel/0714提问数据汇总(已分析)_软件_分析.xlsx", index=False)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user