瀏覽代碼

fix: external reranker

Timothy Jaeryang Baek 5 月之前
父節點
當前提交
6b5f99bf66
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      backend/open_webui/retrieval/utils.py

+ 3 - 1
backend/open_webui/retrieval/utils.py

@@ -818,7 +818,9 @@ class RerankCompressor(BaseDocumentCompressor):
             )
             scores = util.cos_sim(query_embedding, document_embedding)[0]
 
-        docs_with_scores = list(zip(documents, scores.tolist()))
+        docs_with_scores = list(
+            zip(documents, scores.tolist() if not isinstance(scores, list) else scores)
+        )
         if self.r_score:
             docs_with_scores = [
                 (d, s) for d, s in docs_with_scores if s >= self.r_score