mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
* fix(translator): register openai response projection for gemini clients
The response-translator registry had an OpenAI -> Antigravity response
projection registered, but no OpenAI -> Gemini one. When a client request is
detected as Gemini format (body-shape match on `contents: [...]`, per
detectFormat()) and combo routing lands the request on an OpenAI-native
provider, translateResponse() fell through its hub-and-spoke path with no
`openai -> gemini` translator registered, so the raw OpenAI
`chat.completion.chunk` shape reached the client unchanged instead of the
shared Gemini `response.candidates[]` envelope.
Registers FORMATS.OPENAI -> FORMATS.GEMINI reusing the existing
openaiToAntigravityResponse projection — Gemini and Antigravity already
share the same wrapped `{ response: { candidates: [...] } }` envelope
elsewhere in the pipeline (see the unwrapGeminiChunk callers in
open-sse/utils/stream.ts, which treat FORMATS.GEMINI and FORMATS.ANTIGRAVITY
identically), so no new conversion logic is introduced.
Co-authored-by: W ARELIK <warelik@users.noreply.github.com>
Inspired-by: https://github.com/decolua/9router/pull/2399
* chore(changelog): fragment for #7207
---------
Co-authored-by: W ARELIK <warelik@users.noreply.github.com>
29 lines
1013 B
TypeScript
29 lines
1013 B
TypeScript
/**
|
|
* Explicit translator bootstrap module.
|
|
* Importing this file initializes all translator adapters via side-effect registration.
|
|
*/
|
|
|
|
import "./request/claude-to-openai.ts";
|
|
import "./request/openai-to-claude.ts";
|
|
import "./request/gemini-to-openai.ts";
|
|
import "./request/openai-to-gemini.ts";
|
|
import "./request/antigravity-to-openai.ts";
|
|
import "./request/openai-responses.ts";
|
|
import "./request/openai-to-kiro.ts";
|
|
import "./request/openai-to-cursor.ts";
|
|
import "./request/claude-to-gemini.ts";
|
|
|
|
import "./response/claude-to-openai.ts";
|
|
import "./response/openai-to-claude.ts";
|
|
import "./response/gemini-to-openai.ts";
|
|
import "./response/gemini-to-claude.ts";
|
|
import "./response/openai-to-antigravity.ts";
|
|
import "./response/openai-to-gemini.ts";
|
|
import "./response/openai-responses.ts";
|
|
import "./response/kiro-to-openai.ts";
|
|
import "./response/cursor-to-openai.ts";
|
|
|
|
export function bootstrapTranslatorRegistry() {
|
|
// no-op by design; importing this module triggers translator self-registration once
|
|
}
|