This commit is contained in:
@@ -55,3 +55,13 @@ def test_gemini_is_called_only_after_ollama_failure(monkeypatch):
|
||||
assert result.success is True
|
||||
assert result.provider == "gemini"
|
||||
assert result.content == "gemini fallback"
|
||||
|
||||
|
||||
def test_status_never_recommends_gemini_as_primary_provider():
|
||||
service = AIProviderService(default_provider="ollama")
|
||||
|
||||
assert service._get_recommended_provider(
|
||||
ollama_ok=False,
|
||||
gemini_ok=True,
|
||||
elephant_ok=False,
|
||||
) == "none"
|
||||
|
||||
@@ -486,3 +486,15 @@ def test_resource_optimization_cannot_use_legacy_autonomous_execution_template(m
|
||||
asyncio.run(engine._notify_telegram_executed(decision, trigger))
|
||||
|
||||
assert sent == []
|
||||
|
||||
|
||||
def test_elephant_alpha_openclaw_registry_is_ollama_first():
|
||||
from services.elephant_alpha_orchestrator import ElephantAlphaOrchestrator
|
||||
|
||||
orchestrator = ElephantAlphaOrchestrator()
|
||||
openclaw = orchestrator.agents["openclaw"]
|
||||
|
||||
assert not openclaw.model.startswith("gemini")
|
||||
assert openclaw.model == "qwen2.5-coder:7b"
|
||||
assert "Gemini is not a primary agent model" in orchestrator.system_prompt
|
||||
assert "Ollama cascade" in orchestrator.system_prompt
|
||||
|
||||
@@ -182,7 +182,7 @@ def test_ppt_vision_minicpm_unhealthy_routes_to_llava(monkeypatch):
|
||||
# ═══════════════════════════════════════════════════════════════════════════
|
||||
|
||||
def test_ea_engine_no_cot_returns_default(monkeypatch):
|
||||
"""規則命中但 model_name=None → 回 default(caller 用既有 Gemini)"""
|
||||
"""EA 不需要深推理時走免費 Ollama Hermes,不得回 Gemini 預設。"""
|
||||
monkeypatch.setenv('MODEL_ROUTER_ENABLED', 'true')
|
||||
from services.llm_model_router import select_model
|
||||
|
||||
@@ -191,7 +191,19 @@ def test_ea_engine_no_cot_returns_default(monkeypatch):
|
||||
context={'require_chain_of_thought': False},
|
||||
default='gemini-2.0-flash',
|
||||
)
|
||||
assert result == 'gemini-2.0-flash'
|
||||
assert result == 'hermes3:latest'
|
||||
|
||||
|
||||
def test_ea_engine_rejects_gemini_default_even_when_router_disabled(monkeypatch):
|
||||
monkeypatch.delenv('MODEL_ROUTER_ENABLED', raising=False)
|
||||
from services.llm_model_router import select_model
|
||||
|
||||
result = select_model(
|
||||
caller='ea_engine',
|
||||
context={'require_chain_of_thought': False},
|
||||
default='gemini-2.0-flash',
|
||||
)
|
||||
assert result == 'hermes3:latest'
|
||||
|
||||
|
||||
def test_ea_engine_cot_routes_to_deepseek_r1(monkeypatch):
|
||||
|
||||
Reference in New Issue
Block a user