()
| 316 | start_server() |
| 317 | |
| 318 | def main(): |
| 319 | if len(sys.argv) < 2: |
| 320 | print("Usage: python main.py [index|chat|show_graph|api] [query]") |
| 321 | return |
| 322 | |
| 323 | command = sys.argv[1] |
| 324 | if command == "index": |
| 325 | # Allow passing file paths from the command line |
| 326 | files = sys.argv[2:] if len(sys.argv) > 2 else None |
| 327 | run_indexing(files) |
| 328 | elif command == "chat": |
| 329 | if len(sys.argv) < 3: |
| 330 | print("Usage: python main.py chat <query>") |
| 331 | return |
| 332 | query = " ".join(sys.argv[2:]) |
| 333 | # 🆕 Print the result for command-line usage |
| 334 | print(run_chat(query)) |
| 335 | elif command == "show_graph": |
| 336 | show_graph() |
| 337 | elif command == "api": |
| 338 | run_api_server() |
| 339 | else: |
| 340 | print(f"Unknown command: {command}") |
| 341 | |
| 342 | if __name__ == "__main__": |
| 343 | # This allows running the script from the command line to index documents. |
nothing calls this directly
no test coverage detected