This commit is contained in:
@@ -158,13 +158,11 @@ class AIProviderService:
|
||||
return status
|
||||
|
||||
def _get_recommended_provider(self, ollama_ok: bool, gemini_ok: bool, elephant_ok: bool) -> str:
|
||||
"""根據可用性推薦提供者"""
|
||||
"""根據可用性推薦主提供者;Gemini 僅能備援,不可被推薦為主路徑。"""
|
||||
if ollama_ok:
|
||||
return 'ollama'
|
||||
if self._default_provider == 'elephant' and elephant_ok:
|
||||
return 'elephant'
|
||||
if gemini_ok:
|
||||
return 'gemini'
|
||||
if elephant_ok:
|
||||
return 'elephant'
|
||||
return 'none'
|
||||
|
||||
@@ -85,10 +85,9 @@ class ElephantAlphaOrchestrator:
|
||||
),
|
||||
"openclaw": AgentCapability(
|
||||
name="OpenClaw Strategist",
|
||||
# LOCKED-GEMINI: EA HITL 戰略決策影響統帥行動,要最高品質推理
|
||||
# 未來可升 Claude Sonnet 4.6 (agentic 工具使用佳) — Phase 7 任務
|
||||
# ADR-028 鎖定場景 #6
|
||||
model="gemini-2.0-flash",
|
||||
# Ollama-first: OpenClaw strategy/reporting must use the approved
|
||||
# GCP-A → GCP-B → 111 cascade; Gemini is emergency fallback only.
|
||||
model="qwen2.5-coder:7b",
|
||||
strengths=["strategic_planning", "market_analysis", "insight_generation"],
|
||||
limitations=["real_time_execution", "direct_actions"],
|
||||
cost_per_token=0.0,
|
||||
@@ -125,11 +124,16 @@ AGENT CAPABILITIES:
|
||||
- Limitations: Limited strategic depth, short-term focus
|
||||
- Best for: Executing actions, immediate responses, tool-based operations
|
||||
|
||||
3. OPENCLAW (gemini-2.0-flash)
|
||||
3. OPENCLAW (qwen2.5-coder:7b / qwen3:14b via Ollama cascade)
|
||||
- Strengths: Strategic planning, market analysis, insight generation
|
||||
- Limitations: No direct execution capabilities, analysis-only
|
||||
- Best for: Long-term strategy, market insights, recommendation generation
|
||||
|
||||
Gemini policy:
|
||||
- Gemini is not a primary agent model.
|
||||
- Gemini may only be used after the approved Ollama cascade fails and the
|
||||
operator explicitly unlocks the emergency fallback guard.
|
||||
|
||||
YOUR SUPERVISORY CAPABILITIES:
|
||||
- Cross-agent coordination and optimization
|
||||
- Strategic long-term planning (weeks/months ahead)
|
||||
|
||||
@@ -80,15 +80,34 @@ ROUTING_RULES: Dict[str, list] = {
|
||||
'minicpm-v:latest'),
|
||||
],
|
||||
|
||||
# 推理增強場景(EA HITL 戰略決策;目前未啟用,預留)
|
||||
# 推理增強場景(EA HITL 戰略決策;Gemini 不可作為預設模型)
|
||||
'ea_engine': [
|
||||
(lambda ctx: bool(ctx.get('require_chain_of_thought', False)),
|
||||
'deepseek-r1:14b'),
|
||||
(lambda ctx: True,
|
||||
None), # None → caller 用預設(gemini-2.0-flash)
|
||||
'hermes3:latest'),
|
||||
],
|
||||
}
|
||||
|
||||
_CALLER_SAFE_DEFAULT_MODELS = {
|
||||
'ea_engine': 'hermes3:latest',
|
||||
}
|
||||
|
||||
|
||||
def _sanitize_default_model(caller: str, default: Optional[str]) -> Optional[str]:
|
||||
"""Model router must not hand Gemini back as an Ollama-route default."""
|
||||
if default and default.strip().lower().startswith('gemini'):
|
||||
safe_default = _CALLER_SAFE_DEFAULT_MODELS.get(caller)
|
||||
if safe_default:
|
||||
logger.warning(
|
||||
"[ModelRouter] %s default=%s rejected; using %s",
|
||||
caller,
|
||||
default,
|
||||
safe_default,
|
||||
)
|
||||
return safe_default
|
||||
return default
|
||||
|
||||
|
||||
def select_model(
|
||||
caller: str,
|
||||
@@ -107,6 +126,8 @@ def select_model(
|
||||
|
||||
flag OFF 時直接回 default(不評估規則,向下相容)
|
||||
"""
|
||||
default = _sanitize_default_model(caller, default)
|
||||
|
||||
if not is_model_router_enabled():
|
||||
return default
|
||||
|
||||
|
||||
Reference in New Issue
Block a user