Przeglądaj źródła

refac: api usage

Timothy Jaeryang Baek 5 miesięcy temu
rodzic
commit
512d475ecc
1 zmienionych plików z 6 dodań i 1 usunięć
  1. 6 1
      backend/open_webui/utils/middleware.py

+ 6 - 1
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
     # 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:
     if len(sources) > 0:
         events.append({"sources": sources})
         events.append({"sources": sources})