14 lines
502 B
Python
14 lines
502 B
Python
import os
|
|
from rag_tools import add_to_knowledge_base
|
|
|
|
if __name__ == "__main__":
|
|
dir_path = os.getenv("DOCS_DIR", ".")
|
|
for root, _, files in os.walk(dir_path):
|
|
for f in files:
|
|
if f.lower().endswith(('.txt', '.md')):
|
|
path = os.path.join(root, f)
|
|
with open(path, 'r', encoding='utf-8') as fp:
|
|
content = fp.read()
|
|
title = os.path.relpath(path, dir_path)
|
|
add_to_knowledge_base(content, title)
|