From 5a62ead621249c997f7c4d5a82122d54804e5377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=A0=D0=BE=D0=BC?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Fri, 5 Jun 2026 12:42:29 +0000 Subject: [PATCH] Update init_loader.py --- init_loader.py | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/init_loader.py b/init_loader.py index b637d8a..d4befb7 100644 --- a/init_loader.py +++ b/init_loader.py @@ -1,37 +1 @@ -""" -Load documents from a directory into the Qdrant knowledge base. -""" - -import argparse -from pathlib import Path - -from vector_store import add_document - -def load_documents_from_dir(directory: str, title_prefix: str = "") -> None: - """Recursively load all text files from *directory* and add them to the store. - - Parameters - ---------- - directory: str - Path to the directory containing documents. - title_prefix: str, optional - Prefix to add to each document title (useful when loading many files). - """ - dir_path = Path(directory) - if not dir_path.is_dir(): - raise ValueError(f"{directory} is not a valid directory") - - for file_path in dir_path.rglob("*.txt"): - with file_path.open("r", encoding="utf-8") as f: - content = f.read() - title = f"{title_prefix}{file_path.stem}" - add_document(content, title) - -if __name__ == "__main__": - parser = argparse.ArgumentParser(description="Load documents into the knowledge base") - parser.add_argument("directory", help="Directory with .txt files") - parser.add_argument("--prefix", default="", help="Optional title prefix") - args = parser.parse_args() - - load_documents_from_dir(args.directory, args.prefix) - print("Loading completed.") \ No newline at end of file +# Legacy file removed \ No newline at end of file