feat: Save error messages to the database (#23231)
This commit is contained in:
@@ -3632,6 +3632,16 @@ async def streaming_chat_response_handler(response, ctx):
|
|||||||
if not choices:
|
if not choices:
|
||||||
error = data.get('error', {})
|
error = data.get('error', {})
|
||||||
if error:
|
if error:
|
||||||
|
try:
|
||||||
|
Chats.upsert_message_to_chat_by_id_and_message_id(
|
||||||
|
metadata["chat_id"],
|
||||||
|
metadata["message_id"],
|
||||||
|
{
|
||||||
|
"error": {"content": error},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
await event_emitter(
|
await event_emitter(
|
||||||
{
|
{
|
||||||
'type': 'chat:completion',
|
'type': 'chat:completion',
|
||||||
|
|||||||
Reference in New Issue
Block a user