Add sticky round-robin for combos (#831)

Made-with: Cursor
This commit is contained in:
Abhishek Divekar
2026-05-01 16:36:36 +07:00
committed by GitHub
parent 0da61d8f7b
commit 3f17ee0e21
8 changed files with 160 additions and 24 deletions
+8 -4
View File
@@ -97,14 +97,16 @@ export async function handleChat(request, clientRawRequest = null) {
const comboSpecificStrategy = comboStrategies[modelStr]?.fallbackStrategy;
const comboStrategy = comboSpecificStrategy || settings.comboStrategy || "fallback";
log.info("CHAT", `Combo "${modelStr}" with ${comboModels.length} models (strategy: ${comboStrategy})`);
const comboStickyLimit = settings.comboStickyRoundRobinLimit;
log.info("CHAT", `Combo "${modelStr}" with ${comboModels.length} models (strategy: ${comboStrategy}, sticky: ${comboStickyLimit})`);
return handleComboChat({
body,
models: comboModels,
handleSingleModel: (b, m) => handleSingleModelChat(b, m, clientRawRequest, request, apiKey),
log,
comboName: modelStr,
comboStrategy
comboStrategy,
comboStickyLimit
});
}
@@ -128,14 +130,16 @@ async function handleSingleModelChat(body, modelStr, clientRawRequest = null, re
const comboSpecificStrategy = comboStrategies[modelStr]?.fallbackStrategy;
const comboStrategy = comboSpecificStrategy || chatSettings.comboStrategy || "fallback";
log.info("CHAT", `Combo "${modelStr}" with ${comboModels.length} models (strategy: ${comboStrategy})`);
const comboStickyLimit = chatSettings.comboStickyRoundRobinLimit;
log.info("CHAT", `Combo "${modelStr}" with ${comboModels.length} models (strategy: ${comboStrategy}, sticky: ${comboStickyLimit})`);
return handleComboChat({
body,
models: comboModels,
handleSingleModel: (b, m) => handleSingleModelChat(b, m, clientRawRequest, request, apiKey),
log,
comboName: modelStr,
comboStrategy
comboStrategy,
comboStickyLimit
});
}
log.warn("CHAT", "Invalid model format", { model: modelStr });
+4 -2
View File
@@ -84,14 +84,16 @@ export async function handleFetch(request) {
if (comboModels) {
const comboStrategies = settings.comboStrategies || {};
const comboStrategy = comboStrategies[providerInput]?.fallbackStrategy || settings.comboStrategy || "fallback";
log.info("FETCH", `Combo "${providerInput}" with ${comboModels.length} providers (strategy: ${comboStrategy})`);
const comboStickyLimit = settings.comboStickyRoundRobinLimit;
log.info("FETCH", `Combo "${providerInput}" with ${comboModels.length} providers (strategy: ${comboStrategy}, sticky: ${comboStickyLimit})`);
return handleComboChat({
body,
models: comboModels,
handleSingleModel: (b, m) => handleSingleProviderFetch(b, m, request, apiKey, settings),
log,
comboName: providerInput,
comboStrategy
comboStrategy,
comboStickyLimit
});
}
+4 -2
View File
@@ -74,14 +74,16 @@ export async function handleSearch(request) {
if (comboModels) {
const comboStrategies = settings.comboStrategies || {};
const comboStrategy = comboStrategies[providerInput]?.fallbackStrategy || settings.comboStrategy || "fallback";
log.info("SEARCH", `Combo "${providerInput}" with ${comboModels.length} providers (strategy: ${comboStrategy})`);
const comboStickyLimit = settings.comboStickyRoundRobinLimit;
log.info("SEARCH", `Combo "${providerInput}" with ${comboModels.length} providers (strategy: ${comboStrategy}, sticky: ${comboStickyLimit})`);
return handleComboChat({
body,
models: comboModels,
handleSingleModel: (b, m) => handleSingleProviderSearch(b, m, request, apiKey, settings),
log,
comboName: providerInput,
comboStrategy
comboStrategy,
comboStickyLimit
});
}