From a32371a2312cf51b3a41c6dc14eb7fd94c709900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D1=80=D0=B0=D1=82=20=D0=A4=D0=B0=D0=B7=D1=8B?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2?= Date: Tue, 12 May 2026 20:01:18 +0000 Subject: [PATCH] add cli --- cli.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 cli.py diff --git a/cli.py b/cli.py new file mode 100644 index 0000000..e9f50be --- /dev/null +++ b/cli.py @@ -0,0 +1,19 @@ +import sys +from agent import executor + +if __name__ == "__main__": + print("RAG Agent CLI. Commands: /add <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")