(current: string | undefined, variants: string[])
| 59 | } |
| 60 | |
| 61 | export function cycleVariant(current: string | undefined, variants: string[]): string | undefined { |
| 62 | if (variants.length === 0) { |
| 63 | return undefined |
| 64 | } |
| 65 | |
| 66 | if (!current) { |
| 67 | return variants[0] |
| 68 | } |
| 69 | |
| 70 | const idx = variants.indexOf(current) |
| 71 | if (idx === -1 || idx === variants.length - 1) { |
| 72 | return undefined |
| 73 | } |
| 74 | |
| 75 | return variants[idx + 1] |
| 76 | } |
| 77 | |
| 78 | export function pickVariant(model: RunInput["model"], input: RunSession | SessionMessages): string | undefined { |
| 79 | return sessionVariant(Array.isArray(input) ? createSession(input) : input, model) |
no outgoing calls
no test coverage detected