|
|
|
""" |
|
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) |
|
|
|
|
|
if not check_environment(): |
|
input("Press Enter to continue anyway or Ctrl+C to exit...") |
|
|
|
|
|
if not check_model_file(): |
|
input("Press Enter to continue anyway or Ctrl+C to exit...") |
|
|
|
|
|
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) |
|
|
|
|
|
try: |
|
|
|
current_dir = str(Path(__file__).parent) |
|
if current_dir not in sys.path: |
|
sys.path.insert(0, current_dir) |
|
|
|
|
|
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() |
|
|