Upload main.py
Browse files
main.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""J.A.R.V.I.S. entry point."""
|
| 3 |
+
import argparse
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
|
| 6 |
+
from jarvis.config import Config
|
| 7 |
+
from jarvis.memory import Memory
|
| 8 |
+
from jarvis.llm import get_backend
|
| 9 |
+
from jarvis.ui import TerminalUI
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def main():
|
| 13 |
+
parser = argparse.ArgumentParser(description="J.A.R.V.I.S. - Alvin OS Personal AI Assistant")
|
| 14 |
+
parser.add_argument("--config", "-c", type=str, default="config.yaml", help="Path to config file")
|
| 15 |
+
parser.add_argument("--data-dir", "-d", type=str, default=None, help="Override data directory")
|
| 16 |
+
args = parser.parse_args()
|
| 17 |
+
|
| 18 |
+
cfg_path = Path(args.config)
|
| 19 |
+
if cfg_path.exists():
|
| 20 |
+
config = Config.from_file(str(cfg_path))
|
| 21 |
+
else:
|
| 22 |
+
print(f"Config not found at {cfg_path}, using defaults.")
|
| 23 |
+
config = Config.from_env()
|
| 24 |
+
|
| 25 |
+
if args.data_dir:
|
| 26 |
+
config.data_dir = args.data_dir
|
| 27 |
+
config.memory.sqlite_path = str(Path(args.data_dir) / "jarvis.db")
|
| 28 |
+
config.memory.chroma_path = str(Path(args.data_dir) / "chroma")
|
| 29 |
+
|
| 30 |
+
Path(config.data_dir).mkdir(parents=True, exist_ok=True)
|
| 31 |
+
|
| 32 |
+
memory = Memory(config.memory)
|
| 33 |
+
backend = get_backend(config.llm)
|
| 34 |
+
|
| 35 |
+
ui = TerminalUI(config, memory, backend)
|
| 36 |
+
ui.run()
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
if __name__ == "__main__":
|
| 40 |
+
main()
|