From 512d475ecc9e252322f103af40554bb0cbe47381 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 5 May 2025 17:43:51 +0400 Subject: [PATCH] refac: api usage --- backend/open_webui/utils/middleware.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 4603903e04..11c07cc1b4 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -938,7 +938,12 @@ async def process_chat_payload(request, form_data, user, metadata, model): ) # If there are citations, add them to the data_items - sources = [source for source in sources if source.get("source", {}).get("name", "")] + sources = [ + source + for source in sources + if source.get("source", {}).get("name", "") + or source.get("source", {}).get("id", "") + ] if len(sources) > 0: events.append({"sources": sources})