Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion skillclaw/setup_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
},
"minimax": {
"api_base": "https://api.minimax.io/v1",
"model_id": "MiniMax-M3",
"model_id": "MiniMax-M3.1-Flash",
"model_ids": ["MiniMax-M3.1-Flash", "MiniMax-M3"],
"regions": {
"global_en": "https://api.minimax.io/v1",
"cn_zh": "https://api.minimaxi.com/v1",
Expand Down Expand Up @@ -183,6 +184,8 @@ def run(self):
"API base URL [http://api.example.com/v1]",
default=default_api_base,
)
if preset.get("model_ids"):
print(f"Available models: {', '.join(preset['model_ids'])}")
model_id = _prompt(
"Model ID",
default=(current_llm.get("model_id") if provider_unchanged else "") or preset["model_id"],
Expand Down
70 changes: 68 additions & 2 deletions tests/test_setup_wizard.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import pytest

from skillclaw import setup_wizard
from skillclaw.setup_wizard import SetupWizard

Expand Down Expand Up @@ -89,7 +91,7 @@ def choose_atlascloud_provider(msg, choices, default=""):
assert saved["llm"]["api_mode"] == "chat"


def test_setup_wizard_minimax_preset_defaults_to_m3_and_global_region(monkeypatch, tmp_path):
def test_setup_wizard_minimax_preset_defaults_to_flash_and_global_region(monkeypatch, tmp_path, capsys):
saved = {}

class FakeConfigStore:
Expand All @@ -110,6 +112,7 @@ def fake_prompt_choice(msg, choices, default=""):
return default if default else choices[0]

monkeypatch.setattr(setup_wizard, "ConfigStore", FakeConfigStore)
monkeypatch.setattr(setup_wizard, "CONFIG_DIR", tmp_path)
monkeypatch.setattr(setup_wizard, "_prompt_choice", fake_prompt_choice)
monkeypatch.setattr(setup_wizard, "_prompt", lambda msg, default="", hide=False: default)
monkeypatch.setattr(setup_wizard, "_prompt_bool", lambda msg, default=False: default)
Expand All @@ -118,7 +121,9 @@ def fake_prompt_choice(msg, choices, default=""):
SetupWizard().run()

assert saved["llm"]["provider"] == "minimax"
assert saved["llm"]["model_id"] == "MiniMax-M3"
assert saved["llm"]["model_id"] == "MiniMax-M3.1-Flash"
assert setup_wizard._PROVIDER_PRESETS["minimax"]["model_ids"] == ["MiniMax-M3.1-Flash", "MiniMax-M3"]
assert "Available models: MiniMax-M3.1-Flash, MiniMax-M3" in capsys.readouterr().out
assert saved["llm"]["api_base"] == "https://api.minimax.io/v1"
assert saved["llm"]["region"] == "global_en"

Expand Down Expand Up @@ -146,6 +151,7 @@ def fake_prompt_choice(msg, choices, default=""):
return default if default else choices[0]

monkeypatch.setattr(setup_wizard, "ConfigStore", FakeConfigStore)
monkeypatch.setattr(setup_wizard, "CONFIG_DIR", tmp_path)
monkeypatch.setattr(setup_wizard, "_prompt_choice", fake_prompt_choice)
monkeypatch.setattr(setup_wizard, "_prompt", lambda msg, default="", hide=False: default)
monkeypatch.setattr(setup_wizard, "_prompt_bool", lambda msg, default=False: default)
Expand All @@ -156,3 +162,63 @@ def fake_prompt_choice(msg, choices, default=""):
assert saved["llm"]["provider"] == "minimax"
assert saved["llm"]["api_base"] == "https://api.minimaxi.com/v1"
assert saved["llm"]["region"] == "cn_zh"
assert saved["llm"]["model_id"] == "MiniMax-M3.1-Flash"


@pytest.mark.parametrize(
("current_provider", "current_model", "entered_model", "expected_model"),
[
("minimax", "MiniMax-M3", "", "MiniMax-M3"),
("minimax", "custom-model", "", "custom-model"),
("custom", "custom-model", "", "MiniMax-M3.1-Flash"),
("custom", "custom-model", "MiniMax-M3", "MiniMax-M3"),
("custom", "custom-model", "custom-deployment", "custom-deployment"),
],
)
def test_setup_wizard_minimax_model_input(
monkeypatch, tmp_path, current_provider, current_model, entered_model, expected_model
):
saved = {}

class FakeConfigStore:
config_file = tmp_path / "config.yaml"

def exists(self):
return True

def load(self):
return {
"llm": {
"provider": current_provider,
"model_id": current_model,
"api_base": "https://custom.example/v1",
},
"skills": {"enabled": False, "dir": str(tmp_path / "skills")},
"prm": {"enabled": False},
"sharing": {"enabled": False},
}

def save(self, data):
saved.update(data)

def fake_prompt(msg, default="", hide=False):
if msg == "Model ID":
return entered_model or default
return default

monkeypatch.setattr(setup_wizard, "ConfigStore", FakeConfigStore)
monkeypatch.setattr(
setup_wizard,
"_prompt_choice",
lambda msg, choices, default="": "minimax" if msg == "LLM provider" else default,
)
monkeypatch.setattr(setup_wizard, "_prompt", fake_prompt)
monkeypatch.setattr(setup_wizard, "_prompt_bool", lambda msg, default=False: default)
monkeypatch.setattr(setup_wizard, "_prompt_int", lambda msg, default=0: default)

SetupWizard().run()

assert saved["llm"]["model_id"] == expected_model
assert saved["llm"]["api_base"] == (
"https://custom.example/v1" if current_provider == "minimax" else "https://api.minimax.io/v1"
)
Loading