2026-05-27 00:17:47 -07:00
|
|
|
import argparse
|
|
|
|
|
|
|
|
|
|
from src.rag.manager import RAGManager
|
|
|
|
|
|
|
|
|
|
|
2026-05-26 21:48:30 -07:00
|
|
|
def main():
|
2026-05-27 00:17:47 -07:00
|
|
|
parser = argparse.ArgumentParser(description="D&D Helpers CLI")
|
|
|
|
|
parser.add_argument(
|
|
|
|
|
"--ingest-pdf",
|
|
|
|
|
type=str,
|
|
|
|
|
help="Path to a PDF file to ingest into the RAG system",
|
|
|
|
|
)
|
2026-05-28 00:08:52 -07:00
|
|
|
parser.add_argument(
|
|
|
|
|
"--ingest-file",
|
|
|
|
|
type=str,
|
|
|
|
|
help="Path to a markdown file to ingest into the RAG system",
|
|
|
|
|
)
|
|
|
|
|
parser.add_argument(
|
|
|
|
|
"--ingest-dir",
|
|
|
|
|
type=str,
|
|
|
|
|
help="Path to a directory of markdown files to ingest into the RAG system",
|
|
|
|
|
)
|
2026-05-27 00:17:47 -07:00
|
|
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
2026-05-28 00:08:52 -07:00
|
|
|
rag_manager = RAGManager()
|
|
|
|
|
|
2026-05-27 00:17:47 -07:00
|
|
|
if args.ingest_pdf:
|
|
|
|
|
print(f"Ingesting PDF: {args.ingest_pdf}...")
|
|
|
|
|
rag_manager.ingest_pdf(args.ingest_pdf)
|
|
|
|
|
print("PDF ingestion complete.")
|
|
|
|
|
|
2026-05-28 00:08:52 -07:00
|
|
|
if args.ingest_file:
|
|
|
|
|
print(f"Ingesting File: {args.ingest_file}...")
|
|
|
|
|
rag_manager.ingest_file(args.ingest_file)
|
|
|
|
|
print("File ingestion complete.")
|
|
|
|
|
|
|
|
|
|
if args.ingest_dir:
|
|
|
|
|
print(f"Ingesting Directory: {args.ingest_dir}...")
|
|
|
|
|
rag_manager.ingest_directory(args.ingest_dir)
|
|
|
|
|
print("Directory ingestion complete.")
|
|
|
|
|
|
|
|
|
|
if not any([args.ingest_pdf, args.ingest_file, args.ingest_dir]):
|
|
|
|
|
print("Hello from dnd-helpers!")
|
2026-05-26 21:48:30 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
main()
|