in src/lib/utils/business.svelte.ts [73:91]
export function maxAllowedTokens(conversation: ConversationClass) {
const ctxLength = (() => {
const model = conversation.model;
const { provider } = conversation.data;
if (!provider || !isHFModel(model)) return;
const idOnProvider = model.inferenceProviderMapping.find(data => data.provider === provider)?.providerId;
if (!idOnProvider) return;
const models = tryGet(ctxLengthData, provider);
if (!models) return;
return tryGet(models, idOnProvider) as number | undefined;
})();
if (!ctxLength) return customMaxTokens[conversation.model.id] ?? 100000;
return ctxLength;
}