fix(vscode): address speech model review feedback

This commit is contained in:
marius-kilocode
2026-08-04 10:26:28 +02:00
parent 08ee34706d
commit 0f47a63a62
3 changed files with 9 additions and 10 deletions
@@ -52,15 +52,11 @@ function isCatalogModel(value: unknown): value is CatalogModel {
}
function toModel(model: CatalogModel): SpeechToTextModelDef {
const provider = model.name.split(":", 1)[0]?.trim() || model.id.split("/", 1)[0] || "Kilo Gateway"
const index = model.name.indexOf(":")
const provider = index === -1 ? model.id.split("/", 1)[0] || "Kilo Gateway" : model.name.slice(0, index).trim()
return {
id: model.id,
label: model.name.includes(":") ? model.name.slice(model.name.indexOf(":") + 1).trim() : model.name,
label: index === -1 ? model.name : model.name.slice(index + 1).trim(),
provider,
...(isVerbatim(model.id) ? { verbatim: true } : {}),
}
}
function isVerbatim(id: string): boolean {
return id === "openai/gpt-4o-mini-transcribe" || id === "openai/gpt-4o-transcribe"
}
@@ -54,7 +54,7 @@ export async function transcribeSpeech(
"Content-Type": "application/json",
},
body: JSON.stringify({
model: input.model ?? model.id,
model: input.model || model.id,
input_audio: {
data: input.data,
format: input.format,
@@ -13,6 +13,10 @@ describe("speech-to-text discovery", () => {
id: "openai/gpt-4o-mini-transcribe",
name: "OpenAI: GPT-4o Mini Transcribe",
},
{
id: "openai/whisper-1",
name: "Whisper 1",
},
])
expect(models).toEqual([
@@ -21,10 +25,9 @@ describe("speech-to-text discovery", () => {
id: "openai/gpt-4o-mini-transcribe",
label: "GPT-4o Mini Transcribe",
provider: "OpenAI",
verbatim: true,
},
{ id: "openai/whisper-1", label: "Whisper 1", provider: "openai" },
])
expect(models?.find((model) => model.id === "openai/gpt-4o-mini-transcribe")?.verbatim).toBe(true)
})
it("rejects empty or malformed catalogs so callers can use the static fallback", () => {