From aaa97874c6bd4aa84c54aeee23d7418169186213 Mon Sep 17 00:00:00 2001 From: buua436 <66937541+buua436@users.noreply.github.com> Date: Thu, 25 Sep 2025 11:45:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20replace=20traceback.print=5Fexc()=20with?= =?UTF-8?q?=20logging.exception(e)=20in=20conve=E2=80=A6=20(#10275)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …rsation_app.py ### What problem does this PR solve? issue: #10188 change: This PR replaces traceback.print_exc() with logging.exception(e) in conversation_app.py to ensure that full error tracebacks are captured by the logging system instead of being written only to stderr. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/conversation_app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/apps/conversation_app.py b/api/apps/conversation_app.py index 36543d4e2..48b9a1568 100644 --- a/api/apps/conversation_app.py +++ b/api/apps/conversation_app.py @@ -15,7 +15,7 @@ # import json import re -import traceback +import logging from copy import deepcopy from flask import Response, request from flask_login import current_user, login_required @@ -226,7 +226,7 @@ def completion(): if not is_embedded: ConversationService.update_by_id(conv.id, conv.to_dict()) except Exception as e: - traceback.print_exc() + logging.exception(e) yield "data:" + json.dumps({"code": 500, "message": str(e), "data": {"answer": "**ERROR**: " + str(e), "reference": []}}, ensure_ascii=False) + "\n\n" yield "data:" + json.dumps({"code": 0, "message": "", "data": True}, ensure_ascii=False) + "\n\n"