Browse Source

refac: remove duplicate urls

Timothy Jaeryang Baek 1 month ago
parent
commit
b50dcb1862
1 changed files with 4 additions and 0 deletions
  1. 4 0
      backend/open_webui/routers/retrieval.py

+ 4 - 0
backend/open_webui/routers/retrieval.py

@@ -1601,6 +1601,10 @@ async def process_web_search(
             doc.metadata.get("source") for doc in docs if doc.metadata.get("source")
             doc.metadata.get("source") for doc in docs if doc.metadata.get("source")
         ]  # only keep URLs
         ]  # only keep URLs
 
 
+        # Remove duplicates
+        urls = list(dict.fromkeys(urls))
+        log.debug(f"urls: {urls}")
+
         if request.app.state.config.BYPASS_WEB_SEARCH_EMBEDDING_AND_RETRIEVAL:
         if request.app.state.config.BYPASS_WEB_SEARCH_EMBEDDING_AND_RETRIEVAL:
             return {
             return {
                 "status": True,
                 "status": True,