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

优化配置项

parent c3e601a7
......@@ -35,17 +35,20 @@ async def update_fixed_answer(_id, default_answer):
async def record_answer(_id, _completion_answer):
"""AI回答完成后,异步更新回答数据"""
await db_util.update(
AiChatRecordEntity,
{
"id": _id
},
{
"answer": _completion_answer,
"answer_time": datetime.now().strftime("%Y-%m-%d %H:%M:%S")
}
)
try:
await db_util.update(
AiChatRecordEntity,
{
"id": _id
},
{
"answer": _completion_answer,
"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:
def __init__(self):
......@@ -174,7 +177,7 @@ class McpClient:
if db_question and len(db_question) > 0 and db_question[0].question_type == "fixed": # 固定问题
q = db_question[0]
# 更新频率小于等于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
if not call_ai:
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