mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
refac: better memory error handling
This commit is contained in:
parent
4c45d67677
commit
be989f3645
1 changed files with 14 additions and 7 deletions
|
|
@ -299,13 +299,20 @@ async def chat_completion_tools_handler(
|
|||
async def chat_memory_handler(
|
||||
request: Request, form_data: dict, extra_params: dict, user
|
||||
):
|
||||
try:
|
||||
results = await query_memory(
|
||||
request,
|
||||
QueryMemoryForm(
|
||||
**{"content": get_last_user_message(form_data["messages"]) or "", "k": 3}
|
||||
**{
|
||||
"content": get_last_user_message(form_data["messages"]) or "",
|
||||
"k": 3,
|
||||
}
|
||||
),
|
||||
user,
|
||||
)
|
||||
except Exception as e:
|
||||
log.debug(e)
|
||||
results = None
|
||||
|
||||
user_context = ""
|
||||
if results and hasattr(results, "documents"):
|
||||
|
|
|
|||
Loading…
Reference in a new issue