-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
50 lines (40 loc) · 1.29 KB
/
main.py
File metadata and controls
50 lines (40 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python3
"""
Main entry point for running LLM Chat directly.
This allows running the package without installation using `python main.py`
"""
import sys
import os
print(f"Current working directory: {os.getcwd()}")
print(f"Python path before modification: {sys.path}")
# Add src directory to Python path when running directly
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
SRC_DIR = os.path.join(SCRIPT_DIR, "src")
sys.path.append(SRC_DIR)
print(f"Script directory: {SCRIPT_DIR}")
print(f"SRC directory: {SRC_DIR}")
print(f"Python path after modification: {sys.path}")
try:
from src.llm_chat.cli import main
print("Successfully imported main from llm_chat.cli")
except ImportError as e:
print(f"Import error: {e}")
print("Error: Could not import llm_chat package.")
print("Make sure you have all dependencies installed:")
print("pip install -r requirements.txt")
sys.exit(1)
def run_main():
"""
Wrapper function to handle any high-level setup/teardown needed when
running the application directly.
"""
try:
main()
except KeyboardInterrupt:
print("\nGoodbye!")
sys.exit(0)
except Exception as e:
print(f"\nAn error occurred: {str(e)}")
sys.exit(1)
if __name__ == "__main__":
run_main()