(state types.RuntimeState)
| 93 | } |
| 94 | |
| 95 | func (r *RuleRouter) firstHealthyBackend(state types.RuntimeState) (types.RouteDecision, bool) { |
| 96 | for _, backend := range r.cfg.Backends { |
| 97 | if !backendSelectable(state, backend.Name) { |
| 98 | continue |
| 99 | } |
| 100 | return types.RouteDecision{ |
| 101 | BackendName: backend.Name, |
| 102 | Reason: "healthy-fallback-order", |
| 103 | EstimatedCost: backend.Cost.Unit, |
| 104 | }, true |
| 105 | } |
| 106 | return types.RouteDecision{}, false |
| 107 | } |
| 108 | |
| 109 | func (r *RuleRouter) optimizeByCost(tenant config.TenantConfig, req types.AIRequest, base types.RouteDecision, state types.RuntimeState) types.RouteDecision { |
| 110 | if r.costEngine == nil { |
no test coverage detected