mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-24 07:26:47 +08:00
fix: guard Dashscope response attribute access in token/log utils (#12082)
### What problem does this PR solve? Guard Dashscope response attribute access in token/log utils, since `dashscope_response` returns dict like object. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -75,9 +75,12 @@ def init_root_logger(logfile_basename: str, log_format: str = "%(asctime)-15s %(
|
||||
def log_exception(e, *args):
|
||||
logging.exception(e)
|
||||
for a in args:
|
||||
if hasattr(a, "text"):
|
||||
logging.error(a.text)
|
||||
raise Exception(a.text)
|
||||
else:
|
||||
logging.error(str(a))
|
||||
try:
|
||||
text = getattr(a, "text")
|
||||
except Exception:
|
||||
text = None
|
||||
if text is not None:
|
||||
logging.error(text)
|
||||
raise Exception(text)
|
||||
logging.error(str(a))
|
||||
raise e
|
||||
|
||||
Reference in New Issue
Block a user