(index: Map<string, Val>, modelId: string, providers: Set<string>)
| 91 | // Faithful replication of RouterCore.resolveModel (exact path) + the new |
| 92 | // resolvePreferringDefaultProvider tie-break. |
| 93 | const resolveExact = (index: Map<string, Val>, modelId: string, providers: Set<string>) => { |
| 94 | const direct = index.get(modelId); |
| 95 | if (!direct) return null; |
| 96 | let resolvedId = modelId; |
| 97 | if (modelId.includes('/')) { |
| 98 | const [first, ...rest] = modelId.split('/'); |
| 99 | if (first && providers.has(first)) resolvedId = rest.join('/'); |
| 100 | } |
| 101 | return { provider: direct.provider, resolvedId }; |
| 102 | }; |
| 103 | const resolvePreferringDefault = (index: Map<string, Val>, modelId: string, defProvider: string, providers: Set<string>) => { |
| 104 | if (!modelId.includes('/')) { |
| 105 | const q = resolveExact(index, `${defProvider}/${modelId}`, providers); |
no test coverage detected