Switch LLM provider to z.ai GLM

This commit is contained in:
Azimkin
2026-09-21 20:35:08 +02:00
parent 0df55d295c
commit 316eefe58a
10 changed files with 219 additions and 35 deletions

View File

@@ -5,8 +5,8 @@ import pytest
from llm_trade_bot.config import ConfigError, load_config
CONFIG = """
[deepseek]
api_key = "deepseek-key"
[zai]
api_key = "zai-key"
[bybit]
api_key = "bybit-key"
api_secret = "bybit-secret"
@@ -51,7 +51,7 @@ def write_config(tmp_path: Path, content: str = CONFIG) -> Path:
def test_loads_and_resolves_database_path(tmp_path: Path):
path = write_config(tmp_path)
config = load_config(path)
assert config.deepseek.model == "deepseek-flash"
assert config.zai.model == "glm-4.6"
assert config.telegram.admin_user_ids == frozenset({42})
assert config.storage.database_path == tmp_path / "state.db"
assert config.prompts.file_path == tmp_path / "prompts.md"
@@ -63,8 +63,8 @@ def test_rejects_risk_above_hard_limit(tmp_path: Path):
load_config(path)
def test_rejects_non_official_deepseek_endpoint(tmp_path: Path):
changed = CONFIG.replace("api_key = \"deepseek-key\"", 'api_key = "deepseek-key"\nbase_url = "https://example.com"', 1)
def test_rejects_non_official_zai_endpoint(tmp_path: Path):
changed = CONFIG.replace("api_key = \"zai-key\"", 'api_key = "zai-key"\nbase_url = "https://example.com"', 1)
path = write_config(tmp_path, changed)
with pytest.raises(ConfigError, match="base_url"):
load_config(path)