mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-10-19 05:20:05 +00:00
Validated in the round-3 combined board (release/v3.8.51 @ e3b152badd + 59 PRs, gates on the 192.168.0.113 box): typecheck/open-sse/dashboard typecheck, complexity, cognitive, changelog integrity, route-validation, docs-counts, cycles, changed node:test files and vitest green except the inherited base-reds tracked in #14496/#14547 and file-size ratchet drift (rebaselined in a follow-up). Thanks @VIPKaiser!
40 lines
1.7 KiB
TypeScript
40 lines
1.7 KiB
TypeScript
// Unknown grok-cli ids (passthrough / not yet synced, e.g. grok-4.7 on release day) must
|
|
// still resolve to the Responses wire format: GrokCliExecutor always POSTs to
|
|
// /v1/responses, so a chat-completions body 400s upstream.
|
|
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { getModelTargetFormat } from "../../open-sse/config/providerModels.ts";
|
|
import { resolveChatCoreTargetFormat } from "../../open-sse/handlers/chatCore/targetFormat.ts";
|
|
import { FORMATS } from "../../open-sse/translator/formats.ts";
|
|
|
|
test("unknown grok-cli ids fall back to openai-responses (alias and provider id)", () => {
|
|
for (const alias of ["gc", "grok-cli"]) {
|
|
assert.equal(getModelTargetFormat(alias, "grok-4.7"), "openai-responses");
|
|
assert.equal(getModelTargetFormat(alias, "grok-4.7-build-fast"), "openai-responses");
|
|
assert.equal(getModelTargetFormat(alias, "gc/grok-4.99"), "openai-responses");
|
|
}
|
|
});
|
|
|
|
test("seeded grok-cli ids keep their explicit target format", () => {
|
|
assert.equal(getModelTargetFormat("gc", "grok-4.6"), "openai-responses");
|
|
assert.equal(getModelTargetFormat("gc", "grok-4.5"), "openai-responses");
|
|
});
|
|
|
|
test("chatCore routes an unsynced grok-cli id through Responses", () => {
|
|
const r = resolveChatCoreTargetFormat({
|
|
provider: "grok-cli",
|
|
resolvedModel: "grok-4.99",
|
|
apiFormat: undefined,
|
|
sourceFormat: FORMATS.OPENAI,
|
|
customModelTargetFormat: undefined,
|
|
providerSpecificData: undefined,
|
|
});
|
|
assert.equal(r.targetFormat, FORMATS.OPENAI_RESPONSES);
|
|
});
|
|
|
|
test("the fallback is scoped to grok-cli: unknown xai / xai-oauth ids are unchanged", () => {
|
|
for (const alias of ["xai", "xai-oauth"]) {
|
|
assert.equal(getModelTargetFormat(alias, "grok-4.99"), null);
|
|
}
|
|
});
|