feat(provider): Add MiniMax AI provider integration
- Add minimax to PROVIDERS lists in gui_2.py and app_controller.py - Add minimax credentials template in ai_client.py - Implement _list_minimax_models, _classify_minimax_error, _ensure_minimax_client - Implement _send_minimax with streaming and reasoning support - Add minimax to send(), list_models(), reset_session(), get_history_bleed_stats() - Add unit tests in tests/test_minimax_provider.py
This commit is contained in:
41
tests/test_minimax_provider.py
Normal file
41
tests/test_minimax_provider.py
Normal file
@@ -0,0 +1,41 @@
|
||||
import unittest.mock
|
||||
from unittest.mock import patch, MagicMock
|
||||
from src import ai_client
|
||||
|
||||
def test_minimax_model_selection() -> None:
|
||||
ai_client.set_provider("minimax", "MiniMax-M2.5")
|
||||
assert ai_client._provider == "minimax"
|
||||
assert ai_client._model == "MiniMax-M2.5"
|
||||
|
||||
def test_minimax_default_model() -> None:
|
||||
ai_client.set_provider("minimax", "invalid-model")
|
||||
assert ai_client._model == "MiniMax-M2.5"
|
||||
|
||||
def test_minimax_list_models() -> None:
|
||||
models = ai_client.list_models("minimax")
|
||||
assert "MiniMax-M2.5" in models
|
||||
assert "MiniMax-M2.5-highspeed" in models
|
||||
assert "MiniMax-M2.1" in models
|
||||
assert "MiniMax-M2" in models
|
||||
|
||||
def test_minimax_history_bleed_stats() -> None:
|
||||
ai_client.set_provider("minimax", "MiniMax-M2.5")
|
||||
ai_client.reset_session()
|
||||
stats = ai_client.get_history_bleed_stats(md_content="Test context")
|
||||
assert stats["provider"] == "minimax"
|
||||
assert stats["limit"] == 204800
|
||||
|
||||
def test_minimax_in_providers_list() -> None:
|
||||
from src.gui_2 import PROVIDERS
|
||||
assert "minimax" in PROVIDERS
|
||||
|
||||
def test_minimax_in_app_controller_providers() -> None:
|
||||
from src.app_controller import AppController
|
||||
assert "minimax" in AppController.PROVIDERS
|
||||
|
||||
def test_minimax_credentials_template() -> None:
|
||||
try:
|
||||
ai_client._load_credentials()
|
||||
except FileNotFoundError as e:
|
||||
error_msg = str(e)
|
||||
assert "minimax" in error_msg
|
||||
Reference in New Issue
Block a user