mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-11 01:32:22 +03:00
fix: repair stray brace in combo.ts and fix no-explicit-any types in repro-9630 test
This commit is contained in:
@@ -2065,7 +2065,6 @@ export async function handleComboChat({
|
||||
{ code: "ALL_ACCOUNTS_INACTIVE", type: "service_unavailable" }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const status = lastStatus;
|
||||
// Build aggregated error message with per-model failure details for diagnostics.
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import type {
|
||||
ComboLogger,
|
||||
ComboRelayOptions,
|
||||
} from "../../open-sse/services/combo/types.ts";
|
||||
import {
|
||||
handleComboChat,
|
||||
} from "../../open-sse/services/combo.ts";
|
||||
import { getCircuitBreaker, STATE } from "../../src/shared/utils/circuitBreaker.js";
|
||||
|
||||
const noopLogger: ComboLogger = { info: () => {}, warn: () => {}, debug: () => {}, error: () => {} };
|
||||
type BodyType = Record<string, unknown>;
|
||||
|
||||
function okResponse() {
|
||||
return new Response(JSON.stringify({ ok: true }), {
|
||||
status: 200,
|
||||
@@ -27,14 +34,14 @@ test("#9630: combo returns 503 when circuit breaker is OPEN but other healthy ta
|
||||
strategy: "priority",
|
||||
models: ["openai/gpt-4", "anthropic/claude-opus-5"],
|
||||
},
|
||||
handleSingleModel: async (_body: any, modelStr: string) => {
|
||||
handleSingleModel: async (_body: BodyType, modelStr: string) => {
|
||||
assert.equal(modelStr, "anthropic/claude-opus-5", "should skip openai breaker and try anthropic");
|
||||
return okResponse();
|
||||
},
|
||||
isModelAvailable: async () => true,
|
||||
log: { info: () => {}, warn: () => {}, debug: () => {}, error: () => {} } as any,
|
||||
log: noopLogger,
|
||||
settings: null,
|
||||
relayOptions: null as any,
|
||||
relayOptions: null as unknown as ComboRelayOptions,
|
||||
allCombos: null,
|
||||
});
|
||||
|
||||
@@ -65,9 +72,9 @@ test("#9630: combo returns truthful error, not false ALL_ACCOUNTS_INACTIVE, when
|
||||
},
|
||||
handleSingleModel: async () => { throw new Error("should not be called"); },
|
||||
isModelAvailable: async () => true,
|
||||
log: { info: () => {}, warn: () => {}, debug: () => {}, error: () => {} } as any,
|
||||
log: noopLogger,
|
||||
settings: null,
|
||||
relayOptions: null as any,
|
||||
relayOptions: null as unknown as ComboRelayOptions,
|
||||
allCombos: null,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user