import json
import os

_SERVER_DIR = os.path.dirname(os.path.abspath(__file__))
_MODEL_FILE = os.path.join(_SERVER_DIR, "llm-model.json")

_DEFAULT_MODEL = "Qwen3.6-35B-A3B-FP8"


def get_vllm_model() -> str:
    env = os.environ.get("VLLM_MODEL")
    if env:
        return env
    if not os.path.isfile(_MODEL_FILE):
        return _DEFAULT_MODEL
    try:
        with open(_MODEL_FILE, "r", encoding="utf-8") as f:
            data = json.load(f)
        return data.get("vllm_model", _DEFAULT_MODEL)
    except Exception:
        return _DEFAULT_MODEL
