fix: strip only internal prefix from model name for compatible providers (#243)

- Changed model.split('/').pop() to model.split('/').slice(1).join('/')
- Preserves vendor namespace in model names (e.g. moonshotai/Kimi-K2-Instruct)
- Also fixes multimodal image_url → input_image conversion for Responses API (#242)
- image_url parts from Chat Completions are now properly converted to input_image format
This commit is contained in:
diegosouzapw
2026-03-08 02:17:21 -03:00
parent 9911272898
commit af7ca4baf7
2 changed files with 8 additions and 2 deletions

View File

@@ -82,7 +82,7 @@ export class DefaultExecutor extends BaseExecutor {
this.provider?.startsWith?.("openai-compatible-") ||
this.provider?.startsWith?.("anthropic-compatible-")
) {
const cleanModel = model.includes("/") ? model.split("/").pop() : model;
const cleanModel = model.includes("/") ? model.split("/").slice(1).join("/") : model;
return { ...body, model: cleanModel };
}
return body;

View File

@@ -261,7 +261,13 @@ export function openaiToOpenAIResponsesRequest(
if (contentItem.type === "text") {
return { type: "input_text", text: toString(contentItem.text) };
}
if (contentItem.type === "image_url") return contentValue; // passthrough images
if (contentItem.type === "image_url") {
const imgUrl = contentItem.image_url as string | { url?: string };
return {
type: "input_image",
image_url: typeof imgUrl === "string" ? imgUrl : imgUrl?.url || "",
};
}
return contentValue;
})
: [{ type: "input_text", text: "" }];