diff --git a/bot/api.py b/bot/api.py index 27717c6..cb21e13 100644 --- a/bot/api.py +++ b/bot/api.py @@ -72,18 +72,10 @@ api_requests_logger = get_logger('api.requests') # ========== GPU Selection Helper ========== def get_current_gpu_url(): """Get the URL for the currently selected GPU""" - gpu_state_file = os.path.join(os.path.dirname(__file__), "memory", "gpu_state.json") - try: - with open(gpu_state_file, "r") as f: - state = json.load(f) - current_gpu = state.get("current_gpu", "nvidia") - if current_gpu == "amd": - return globals.LLAMA_AMD_URL - else: - return globals.LLAMA_URL - except: - # Default to NVIDIA if state file doesn't exist - return globals.LLAMA_URL + from config_manager import config_manager + if config_manager.get_gpu() == "amd": + return globals.LLAMA_AMD_URL + return globals.LLAMA_URL app = FastAPI() @@ -697,13 +689,8 @@ def cleanup_bipolar_webhooks(): @app.get("/gpu-status") def get_gpu_status(): """Get current GPU selection""" - gpu_state_file = os.path.join(os.path.dirname(__file__), "memory", "gpu_state.json") - try: - with open(gpu_state_file, "r") as f: - state = json.load(f) - return {"gpu": state.get("current_gpu", "nvidia")} - except: - return {"gpu": "nvidia"} + from config_manager import config_manager + return {"gpu": config_manager.get_gpu()} @app.post("/gpu-select") async def select_gpu(request: Request): diff --git a/bot/config.py b/bot/config.py index 38b135e..3e44665 100644 --- a/bot/config.py +++ b/bot/config.py @@ -5,7 +5,6 @@ Uses Pydantic for type-safe configuration loading from: - config.yaml (all other configuration) """ -import os from pathlib import Path from typing import Optional from pydantic import BaseModel, Field diff --git a/bot/config_manager.py b/bot/config_manager.py index 281b8f4..d300526 100644 --- a/bot/config_manager.py +++ b/bot/config_manager.py @@ -10,9 +10,8 @@ Handles: """ import json -import os from pathlib import Path -from typing import Any, Dict, Optional, Union +from typing import Any, Dict, Optional from datetime import datetime import yaml diff --git a/bot/globals.py b/bot/globals.py index 85897af..3a7db0e 100644 --- a/bot/globals.py +++ b/bot/globals.py @@ -6,8 +6,6 @@ from apscheduler.schedulers.asyncio import AsyncIOScheduler scheduler = AsyncIOScheduler() -GUILD_SETTINGS = {} - # Stores last 5 exchanges per user (as deque) conversation_history = defaultdict(lambda: deque(maxlen=5)) diff --git a/bot/server_manager.py b/bot/server_manager.py index 3125256..e614aa5 100644 --- a/bot/server_manager.py +++ b/bot/server_manager.py @@ -12,7 +12,6 @@ from apscheduler.triggers.interval import IntervalTrigger from apscheduler.triggers.cron import CronTrigger from apscheduler.triggers.date import DateTrigger import random -from datetime import datetime, timedelta from utils.logger import get_logger logger = get_logger('server')