优化对话转工单处理逻辑,调整LLM参数,增强用户问题和解决方案的提取功能,添加槽位填充支持,提升代码结构和可读性。

This commit is contained in:
2025-05-30 11:10:24 +08:00
parent 05caedc4fa
commit d4ff7b6fad
6 changed files with 469 additions and 123 deletions
+15 -4
View File
@@ -29,7 +29,7 @@ class DifyComparisonTester:
Dify新旧流程对比测试类,用于比较两个不同流程的问答效果并进行评判
"""
def __init__(self, excel_path:str, baseurl:str, old_workflow_api_key:str, new_workflow_api_key:str,
wiki_excel_path:str=None, output_path:str=None, max_workers:int=5):
wiki_excel_path:str=None, output_path:str=None, max_workers:int=1):
"""
初始化对比测试器
@@ -394,6 +394,13 @@ content: "{content}"
Returns:
dict: 包含问题分类结果的字典
"""
retrieve_content=[]
max_score=0
min_score=0
avg_score=0
rewrite_query=""
vertical_classification=""
sub_classification=""
try:
new_message_info = DifyTool.get_message_debug_info_by_id(message_id=new_message_id)
for workflow_node in new_message_info["workflow_node_executions_info"]:
@@ -429,6 +436,11 @@ content: "{content}"
Returns:
dict: 包含问题分类结果的字典
"""
retrieve_content=[]
max_score=0
min_score=0
avg_score=0
rewrite_query=""
try:
old_message_info = DifyTool.get_message_debug_info_by_id(message_id=old_message_id)
for workflow_node in old_message_info["workflow_node_executions_info"]:
@@ -526,9 +538,8 @@ content: "{content}"
"""
# 读取Excel文件中的问题
df = pd.read_excel(self.excel_path)
questions = df['补全后的提'].tolist()
questions = df[''].tolist()
results = []
# 选择处理函数
process_func = self.process_question_with_judge if with_judge else self.process_question
@@ -572,7 +583,7 @@ content: "{content}"
if __name__ == "__main__":
# 定义Excel路径
excel_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", ".." ,"data/excel/历史提问数据(like)_提问明确.xlsx")
excel_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", ".." ,"data/excel/400条答案差异的.xlsx")
if not os.path.exists(excel_path):
print(f"错误:Excel文件不存在: {excel_path}")