Skip to content

Commit b10c70c

Browse files
feat: Save error messages to the database (open-webui#23231)
1 parent eba2b2c commit b10c70c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

backend/open_webui/utils/middleware.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3632,6 +3632,16 @@ async def flush_pending_delta_data(threshold: int = 0):
36323632
if not choices:
36333633
error = data.get('error', {})
36343634
if error:
3635+
try:
3636+
Chats.upsert_message_to_chat_by_id_and_message_id(
3637+
metadata["chat_id"],
3638+
metadata["message_id"],
3639+
{
3640+
"error": {"content": error},
3641+
},
3642+
)
3643+
except Exception:
3644+
pass
36353645
await event_emitter(
36363646
{
36373647
'type': 'chat:completion',

0 commit comments

Comments
 (0)