This commit is contained in:
yichuan520030910320
2025-09-14 02:37:30 -07:00
parent ed5fd88a85
commit 4a39b40e72
2 changed files with 3 additions and 6 deletions

View File

@@ -74,7 +74,7 @@ class ChromeHistoryReader(BaseReader):
if count >= max_count and max_count > 0: if count >= max_count and max_count > 0:
break break
last_visit, url, title, visit_count, typed_count, hidden = row last_visit, url, title, visit_count, typed_count, _ = row
# Create document content with metadata embedded in text # Create document content with metadata embedded in text
doc_content = f""" doc_content = f"""

View File

@@ -289,11 +289,8 @@ def add_incremental(
embeddings = _np.ascontiguousarray(embeddings, dtype=_np.float32) embeddings = _np.ascontiguousarray(embeddings, dtype=_np.float32)
# Append using FAISS-style signature (n, swig_ptr(x)); fall back to Python wrapper if needed # Append using FAISS-style signature (n, swig_ptr(x)); fall back to Python wrapper if needed
try: index.add(embeddings.shape[0], hnsw_faiss.swig_ptr(embeddings))
index.add(embeddings.shape[0], hnsw_faiss.swig_ptr(embeddings))
except TypeError:
# Some builds expose a Python-friendly signature: index.add(np.ndarray)
index.add(embeddings)
hnsw_faiss.write_index(index, str(faiss_index_file)) hnsw_faiss.write_index(index, str(faiss_index_file))
print(f"Incremental add completed. Index updated at: {index_path}") print(f"Incremental add completed. Index updated at: {index_path}")