调整PGSQL相关代码逻辑

This commit is contained in:
2025-08-29 11:49:07 +08:00
parent 78dc1673aa
commit d69fe2b8d1
3 changed files with 261 additions and 260 deletions
+5 -5
View File
@@ -18,7 +18,7 @@ from langchain_core.output_parsers import JsonOutputParser
sys.path.append(os.getcwd())
from rag2_0.dify.dify_client import ChatClient
from rag2_0.tool.ModelTool import OpenAiLLM
from rag2_0.dify.dify_tool import PgSql, DifyTool
from rag2_0.dify.dify_tool import DifyTool
from rag2_0.dify.export_new_dify import DifyExporter
load_dotenv()
# 创建日志目录
@@ -104,7 +104,7 @@ class DifyCompareTest:
answer = answer.split("----------------------------------------")[0].strip()
if len(answer) == 0:
raise Exception(f"回答为空: {result}")
if old_answer:
if isinstance(old_answer, str) and len(old_answer) > 0:
judge_result = self.llm_judge_answer(old_answer=old_answer, now_answer=answer)
else:
judge_result=""
@@ -149,8 +149,8 @@ class DifyCompareTest:
result_row["检索到的词条"] = ''
return index, result_row
if "回答" in row:
old_answer = row["回答"]
if "参考回答" in row:
old_answer = row["参考回答"]
else:
old_answer = ""
@@ -259,7 +259,7 @@ if __name__ == "__main__":
# 处理第一个文件
excel_files = [
("data/excel/第一轮的专业问题.xlsx", "data/excel/第一轮的专业问题_dify.xlsx"),
("data/excel/第5轮-软件问题-点踩结果.xlsx", "data/excel/第5轮-软件问题-点踩结果_dify.xlsx"),
# ("data/excel/有知识的.xlsx", "data/excel/有知识的_问答测试.xlsx")
]