(modelId: string, plan: CopilotPlanType)
| 421 | } |
| 422 | |
| 423 | export function getCopilotMultiplier(modelId: string, plan: CopilotPlanType): number | null { |
| 424 | const candidates = copilotModelCandidates(modelId) |
| 425 | let entry: CopilotMultiplier | undefined |
| 426 | |
| 427 | for (const candidate of candidates) { |
| 428 | entry = COPILOT_MULTIPLIERS[candidate] |
| 429 | if (entry) break |
| 430 | } |
| 431 | |
| 432 | if (!entry) { |
| 433 | const normalizedCandidates = new Set(candidates.map((candidate) => normalizeModelId(candidate))) |
| 434 | |
| 435 | for (const [key, value] of Object.entries(COPILOT_MULTIPLIERS)) { |
| 436 | const normalizedKey = normalizeModelId(key) |
| 437 | if (normalizedCandidates.has(normalizedKey)) { |
| 438 | entry = value |
| 439 | break |
| 440 | } |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | if (!entry) return null |
| 445 | return plan === "free" ? entry.free : entry.paid |
| 446 | } |
| 447 | |
| 448 | export function isCopilotModelAvailable(modelId: string, plan: CopilotPlanType): boolean { |
| 449 | const multiplier = getCopilotMultiplier(modelId, plan) |
no test coverage detected