The open source coding agent.
TypeScript
zen: fix routing non OC traffic
Frank47cf267c232f
diff --git a/packages/console/app/src/routes/zen/util/handler.ts b/packages/console/app/src/routes/zen/util/handler.tsindex 9a0ab94f9e5..1996d48c567 100644--- a/packages/console/app/src/routes/zen/util/handler.ts+++ b/packages/console/app/src/routes/zen/util/handler.ts@@ -120,6 +120,7 @@ export async function handler(zenData,authInfo,modelInfo,+ ip,sessionId,trialProviders,retry,@@ -402,6 +403,7 @@ export async function handler(zenData: ZenData,authInfo: AuthInfo,modelInfo: ModelInfo,+ ip: string,sessionId: string,trialProviders: string[] | undefined,retry: RetryOptions,@@ -430,10 +432,11 @@ export async function handler(.flatMap((provider) => Array<typeof provider>(provider.weight ?? 1).fill(provider))// Use the last 4 characters of session ID to select a provider+ const identifier = sessionId.length ? sessionId : iplet h = 0- const l = sessionId.length+ const l = identifier.lengthfor (let i = l - 4; i < l; i++) {- h = (h * 31 + sessionId.charCodeAt(i)) | 0 // 32-bit int+ h = (h * 31 + identifier.charCodeAt(i)) | 0 // 32-bit int}const index = (h >>> 0) % providers.length // make unsigned + range 0..length-1const provider = providers[index || 0]