mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 12:25:20 +00:00
refac
This commit is contained in:
parent
d802c718a4
commit
26d069080a
1 changed files with 11 additions and 0 deletions
|
|
@ -1373,6 +1373,17 @@ async def chat_completion(
|
||||||
request, response, form_data, user, metadata, model, events, tasks
|
request, response, form_data, user, metadata, model, events, tasks
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
log.debug(f"Error in chat completion: {e}")
|
||||||
|
if metadata.get("chat_id") and metadata.get("message_id"):
|
||||||
|
# Update the chat message with the error
|
||||||
|
Chats.upsert_message_to_chat_by_id_and_message_id(
|
||||||
|
metadata["chat_id"],
|
||||||
|
metadata["message_id"],
|
||||||
|
{
|
||||||
|
"error": {"content": str(e)},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_400_BAD_REQUEST,
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
detail=str(e),
|
detail=str(e),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue