瀏覽代碼

fix: preserve Unicode characters in keyword search queries (#15522)

Signed-off-by: kenwoodjw <blackxin55+@gmail.com>
kenwoodjw 1 月之前
父節點
當前提交
087bb60b31
共有 1 個文件被更改,包括 1 次插入2 次删除
  1. 1 2
      api/core/rag/datasource/retrieval_service.py

+ 1 - 2
api/core/rag/datasource/retrieval_service.py

@@ -1,5 +1,4 @@
 import concurrent.futures
-import json
 from concurrent.futures import ThreadPoolExecutor
 from typing import Optional
 
@@ -243,7 +242,7 @@ class RetrievalService:
 
     @staticmethod
     def escape_query_for_search(query: str) -> str:
-        return json.dumps(query).strip('"')
+        return query.replace('"', '\\"')
 
     @classmethod
     def format_retrieval_documents(cls, documents: list[Document]) -> list[RetrievalSegments]: