import yaml

config_path = "/home/multica/.hermes/config.yaml"

with open(config_path, "r") as f:
    config = yaml.safe_load(f)

# 确保 providers.minimaxio 有正确的配置
if "providers" not in config:
    config["providers"] = {}

# 移除 custom_providers 中的 minimaxio（避免冲突）
if "custom_providers" in config:
    config["custom_providers"] = [p for p in config["custom_providers"] if p["name"] != "minimaxio"]

# 使用 providers.minimaxio（Hermes 的标准 provider 格式）
config["providers"]["minimaxio"] = {
    "api_key": "sk-cp-4PndfHCLIer0Xoh67ARXqOtTqjH76AxCeXNsBd22-ljH7H4E8LGOh6CEe9TBWuLs3oDH56t-aXYDc4bPfa5hyRUJBdYZuNeg6r5ZcvkkqY-UaRdnLRwR0lY",
    "base_url": "https://api.minimax.io/v1"
}

# 写回配置文件
with open(config_path, "w") as f:
    yaml.dump(config, f, default_flow_style=False, allow_unicode=True)

print("Updated Hermes config: removed custom_providers.minimaxio, using providers.minimaxio")
