File size: 3,010 Bytes
ba18ff2 |
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
#!/usr/bin/env python3
"""
Enhanced Chat Startup Script
Quick launcher for the enhanced terminal chat with command flow.
This script ensures proper environment setup and provides helpful feedback.
"""
import sys
import os
import subprocess
from pathlib import Path
def check_environment():
"""Check if we're in the correct conda environment"""
conda_env = os.environ.get('CONDA_DEFAULT_ENV', 'base')
if conda_env != 'cyber_llm':
print("⚠️ Warning: Not in 'cyber_llm' conda environment")
print(f"Current environment: {conda_env}")
print("Please run: conda activate cyber_llm")
return False
return True
def check_model_file():
"""Check if the model file exists"""
model_path = Path(__file__).parent / "models" / "deepseek-llm-7b-chat-Q6_K.gguf"
if not model_path.exists():
print(f"⚠️ Warning: Model file not found at {model_path}")
print("Please ensure the DeepSeek model is in the models/ directory")
return False
return True
def check_dependencies():
"""Check if required packages are installed"""
required_packages = ['mcp', 'llama_cpp', 'pydantic', 'asyncio']
missing = []
for package in required_packages:
try:
__import__(package.replace('-', '_'))
except ImportError:
missing.append(package)
if missing:
print(f"⚠️ Missing packages: {', '.join(missing)}")
print("Please run: pip install -r requirements.txt")
return False
return True
def main():
"""Main startup function"""
print("🚀 DeepSeek Enhanced Chat Launcher")
print("=" * 40)
# Check environment
if not check_environment():
input("Press Enter to continue anyway or Ctrl+C to exit...")
# Check model file
if not check_model_file():
input("Press Enter to continue anyway or Ctrl+C to exit...")
# Check dependencies
if not check_dependencies():
input("Press Enter to continue anyway or Ctrl+C to exit...")
print("✅ Environment checks completed!")
print("🚀 Starting Enhanced Terminal Chat...")
print("=" * 40)
# Launch the enhanced chat
try:
# Add current directory to Python path
current_dir = str(Path(__file__).parent)
if current_dir not in sys.path:
sys.path.insert(0, current_dir)
# Import and run the enhanced chat
from terminal_chat import main as chat_main
import asyncio
asyncio.run(chat_main())
except KeyboardInterrupt:
print("\n👋 Chat terminated by user.")
except ImportError as e:
print(f"❌ Import error: {e}")
print("Please check that all files are in place and dependencies are installed.")
except Exception as e:
print(f"❌ Error starting chat: {e}")
print("Try running 'python terminal_chat.py' directly for more details.")
if __name__ == "__main__":
main()
|