add init_loader
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
from pathlib import Path
|
||||
from rag_tools import add_to_knowledge_base
|
||||
|
||||
def load_docs_from_dir(directory: str):
|
||||
for file in Path(directory).glob("**/*.txt"):
|
||||
text = file.read_text(encoding="utf-8")
|
||||
add_to_knowledge_base(text, title=file.name)
|
||||
|
||||
if __name__ == "__main__":
|
||||
load_docs_from_dir("docs")
|
||||
Reference in New Issue
Block a user