feat: Save error messages to the database (#23231)

This commit is contained in:
Shirasawa 2026-03-31 17:11:47 +08:00 • committed by GitHub
parent eba2b2cd72
commit b10c70cfcf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3632,6 +3632,16 @@ async def streaming_chat_response_handler(response, ctx):
if not choices:
error = data.get('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(
{
'type': 'chat:completion',