Удалить init_documents.py
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
"""
|
||||
Script to load all .txt files from a directory into the vector store.
|
||||
"""
|
||||
import os
|
||||
from pathlib import Path
|
||||
from chunker import load_and_split
|
||||
from vector_store import vector_store
|
||||
|
||||
if __name__ == "__main__":
|
||||
docs_dir = Path("docs")
|
||||
if not docs_dir.exists():
|
||||
print("Docs directory not found.")
|
||||
exit(1)
|
||||
chunks = load_and_split(docs_dir)
|
||||
# Each chunk is (text, metadata)
|
||||
documents = []
|
||||
for idx, (chunk, meta) in enumerate(chunks):
|
||||
documents.append({"content": chunk, "metadata": meta})
|
||||
vector_store.add_documents(documents)
|
||||
print(f"Loaded {len(documents)} chunks into the vector store.")
|
||||
Reference in New Issue
Block a user