Spaces:
Paused
Paused
lanny xu
commited on
Commit
·
6da2725
1
Parent(s):
9e3fc83
optimize query speed
Browse files- document_processor.py +12 -2
document_processor.py
CHANGED
|
@@ -267,9 +267,19 @@ class DocumentProcessor:
|
|
| 267 |
# 优先使用 URI
|
| 268 |
if MILVUS_URI and len(MILVUS_URI.strip()) > 0:
|
| 269 |
is_local_file = not (MILVUS_URI.startswith("http://") or MILVUS_URI.startswith("https://"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
mode_name = "Lite (Local File)" if is_local_file else "Cloud (HTTP)"
|
| 271 |
-
print(f"🔄 正在连接 Milvus {mode_name} ({
|
| 272 |
-
connection_args["uri"] =
|
|
|
|
| 273 |
if not is_local_file and MILVUS_PASSWORD:
|
| 274 |
connection_args["token"] = MILVUS_PASSWORD
|
| 275 |
else:
|
|
|
|
| 267 |
# 优先使用 URI
|
| 268 |
if MILVUS_URI and len(MILVUS_URI.strip()) > 0:
|
| 269 |
is_local_file = not (MILVUS_URI.startswith("http://") or MILVUS_URI.startswith("https://"))
|
| 270 |
+
|
| 271 |
+
real_uri = MILVUS_URI
|
| 272 |
+
if is_local_file:
|
| 273 |
+
import os
|
| 274 |
+
# Milvus Lite requires absolute path in some versions/environments
|
| 275 |
+
if not os.path.isabs(real_uri):
|
| 276 |
+
real_uri = os.path.abspath(real_uri)
|
| 277 |
+
print(f"📂 将相对路径转换为绝对路径: {real_uri}")
|
| 278 |
+
|
| 279 |
mode_name = "Lite (Local File)" if is_local_file else "Cloud (HTTP)"
|
| 280 |
+
print(f"🔄 正在连接 Milvus {mode_name} ({real_uri})...")
|
| 281 |
+
connection_args["uri"] = real_uri
|
| 282 |
+
|
| 283 |
if not is_local_file and MILVUS_PASSWORD:
|
| 284 |
connection_args["token"] = MILVUS_PASSWORD
|
| 285 |
else:
|