ZHANGSHUO22 commited on
Commit ·
2a2a71d
1
Parent(s): 4f499fc
metadata丢失处理2
Browse files
backend/app/services/rag/vector_engine.py
CHANGED
|
@@ -417,12 +417,22 @@ class VectorEngine:
|
|
| 417 |
|
| 418 |
# 3. 贪婪召回:先向数据库狮子大开口,要前 20 名(扩大基础池)
|
| 419 |
where_clause = filters if filters else None
|
|
|
|
| 420 |
results = self.collection.query(
|
| 421 |
query_embeddings=[query_embedding],
|
| 422 |
n_results=max_k,
|
| 423 |
where=where_clause,
|
| 424 |
include=['metadatas', 'documents', 'distances']
|
| 425 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 426 |
|
| 427 |
if not results['ids'][0]:
|
| 428 |
return []
|
|
|
|
| 417 |
|
| 418 |
# 3. 贪婪召回:先向数据库狮子大开口,要前 20 名(扩大基础池)
|
| 419 |
where_clause = filters if filters else None
|
| 420 |
+
print(f"🔎 DEBUG [云端]: 正在执行查询,Where 条件: {where_clause}")
|
| 421 |
results = self.collection.query(
|
| 422 |
query_embeddings=[query_embedding],
|
| 423 |
n_results=max_k,
|
| 424 |
where=where_clause,
|
| 425 |
include=['metadatas', 'documents', 'distances']
|
| 426 |
)
|
| 427 |
+
# 核心调试打印:看看原始返回到底长什么样
|
| 428 |
+
if results['metadatas']:
|
| 429 |
+
print(f"🧬 DEBUG [云端]: 原始元数据第一条: {results['metadatas'][0][0] if results['metadatas'][0] else '列表为空'}")
|
| 430 |
+
else:
|
| 431 |
+
print("❌ DEBUG [云端]: results['metadatas'] 键不存在或为 None")
|
| 432 |
+
|
| 433 |
+
if not results['ids'][0]:
|
| 434 |
+
return []
|
| 435 |
+
|
| 436 |
|
| 437 |
if not results['ids'][0]:
|
| 438 |
return []
|
chroma_db/chroma.sqlite3
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 13946880
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1f5695c3c7a93aa5d4eda2e47f45ee7f8ecee8e35e479628f5defebd263d8fb4
|
| 3 |
size 13946880
|