fix: replace traceback.print_exc() with logging.exception(e) in conve… (#10275)
…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)
This commit is contained in:
parent
193d93d820
commit
aaa97874c6
1 changed files with 2 additions and 2 deletions
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue