更改项目名称为"rag2_0",更新相关依赖项名称,增强PgSql类的线程安全性,添加锁机制以确保数据库连接的安全关闭,同时优化DifyTool类的资源管理,确保在对象销毁时自动关闭数据库连接。
This commit is contained in:
@@ -69,6 +69,14 @@ class DifyComparisonTester:
|
||||
else:
|
||||
self.wiki_excel = None
|
||||
|
||||
self.dify_tool = DifyTool()
|
||||
|
||||
def __del__(self):
|
||||
"""
|
||||
析构函数,在对象被销毁时自动关闭数据库连接。
|
||||
确保在对象生命周期结束时释放数据库资源。
|
||||
"""
|
||||
self.dify_tool.close_connection()
|
||||
|
||||
def get_llm(self):
|
||||
api_key = os.getenv("OPENAI_API_KEY")
|
||||
@@ -381,7 +389,7 @@ content: "{content}"
|
||||
"""
|
||||
try:
|
||||
# 使用DifyTool直接获取消息信息
|
||||
new_message_info = DifyTool.get_message_debug_info_by_id(message_id=new_message_id)
|
||||
new_message_info = self.dify_tool.get_message_debug_info_by_id(message_id=new_message_id)
|
||||
|
||||
# 初始化变量
|
||||
retrieve_title = []
|
||||
@@ -428,7 +436,7 @@ content: "{content}"
|
||||
"""
|
||||
try:
|
||||
# 使用DifyTool直接获取消息信息
|
||||
old_message_info = DifyTool.get_message_debug_info_by_id(message_id=old_message_id)
|
||||
old_message_info = self.dify_tool.get_message_debug_info_by_id(message_id=old_message_id)
|
||||
|
||||
# 初始化变量
|
||||
retrieve_title = []
|
||||
|
||||
Reference in New Issue
Block a user