add cli
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import sys
|
||||
from agent import executor
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("RAG Agent CLI. Commands: /add <title> <file>, /search <query>, /quit")
|
||||
while True:
|
||||
line = input("> ")
|
||||
if line.startswith("/quit"):
|
||||
break
|
||||
if line.startswith("/add"):
|
||||
_, title, file = line.split(maxsplit=2)
|
||||
with open(file, "r", encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
print(executor.invoke({"input": f"add {title} {text}"}))
|
||||
elif line.startswith("/search"):
|
||||
_, query = line.split(maxsplit=1)
|
||||
print(executor.invoke({"input": f"search {query}"}))
|
||||
else:
|
||||
print("Unknown command")
|
||||
Reference in New Issue
Block a user