fix: bind getProviderAuthMode to registry instance to avoid undefined 'this'

Extracting a class method as a bare reference loses its 'this' context,
causing 'Cannot read properties of undefined' when minimax (or any
provider) triggers the flat-rate auth-mode lookup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mikael Hugo 2026-04-25 19:22:39 +02:00
parent 7be540480e
commit f0da5b6d21

View file

@ -707,7 +707,7 @@ export function buildFlatRateContext(
prefs?: { flat_rate_providers?: readonly string[] },
): FlatRateContext {
let authMode: FlatRateContext["authMode"];
const getAuthMode = ctx?.modelRegistry?.getProviderAuthMode;
const getAuthMode = ctx?.modelRegistry?.getProviderAuthMode?.bind(ctx.modelRegistry);
if (typeof getAuthMode === "function") {
try {
const mode = getAuthMode(provider);