Commit ed3aed2a authored by 何家明's avatar 何家明

优化配置项

parent c3e601a7
...@@ -35,6 +35,7 @@ async def update_fixed_answer(_id, default_answer): ...@@ -35,6 +35,7 @@ async def update_fixed_answer(_id, default_answer):
async def record_answer(_id, _completion_answer): async def record_answer(_id, _completion_answer):
"""AI回答完成后,异步更新回答数据""" """AI回答完成后,异步更新回答数据"""
try:
await db_util.update( await db_util.update(
AiChatRecordEntity, AiChatRecordEntity,
{ {
...@@ -45,7 +46,9 @@ async def record_answer(_id, _completion_answer): ...@@ -45,7 +46,9 @@ async def record_answer(_id, _completion_answer):
"answer_time": datetime.now().strftime("%Y-%m-%d %H:%M:%S") "answer_time": datetime.now().strftime("%Y-%m-%d %H:%M:%S")
} }
) )
logger.info(f"Record answer success, chat_record_id: {_id}")
except Exception as e:
logger.error(f"Record answer failed, chat_record_id: {_id}, error: {str(e)}", exc_info=True)
class McpClient: class McpClient:
def __init__(self): def __init__(self):
...@@ -174,7 +177,7 @@ class McpClient: ...@@ -174,7 +177,7 @@ class McpClient:
if db_question and len(db_question) > 0 and db_question[0].question_type == "fixed": # 固定问题 if db_question and len(db_question) > 0 and db_question[0].question_type == "fixed": # 固定问题
q = db_question[0] q = db_question[0]
# 更新频率小于等于0,或者默认回答没有数据,那都要重新调用AI # 更新频率小于等于0,或者默认回答没有数据,那都要重新调用AI
call_ai = q.answer_update_frequency <= 0 or q.default_answer is None call_ai = q.answer_update_frequency <= 0 or not q.default_answer
fixed_question_id = q.id fixed_question_id = q.id
if not call_ai: if not call_ai:
if q.latest_answer_time: if q.latest_answer_time:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment