feat(agent):Fix agent bug (#1953)

Co-authored-by: aries_ckt <916701291@qq.com>
This commit is contained in:
明天
2024-09-04 10:59:03 +08:00
committed by GitHub
parent d72bfb2f5f
commit b951b50689
18 changed files with 67 additions and 46 deletions

View File

@@ -548,6 +548,17 @@ async def chat_completions(
headers=headers,
media_type="text/plain",
)
except Exception as e:
logger.exception(f"Chat Exception!{dialogue}", e)
async def error_text(err_msg):
yield f"data:{err_msg}\n\n"
return StreamingResponse(
error_text(str(e)),
headers=headers,
media_type="text/plain",
)
finally:
# write to recent usage app.
if dialogue.user_name is not None and dialogue.app_code is not None: