Merge pull request #3674 from code-yeongyu/fix/doctor-parse-multi-slash-model

fix(doctor): parse provider/model with indexOf for multi-slash IDs (fixes #3380)
This commit is contained in:
YeonGyu-Kim
2026-04-27 18:52:58 +09:00
committed by GitHub
2 changed files with 43 additions and 2 deletions
@@ -1,6 +1,47 @@
import { describe, it, expect } from "bun:test"
describe("model-resolution check", () => {
describe("parseProviderModel", () => {
it("splits chutes model IDs at the provider separator", async () => {
const { parseProviderModel } = await import("./model-resolution")
// #given a provider-prefixed model whose model ID contains a slash
const value = "chutes/deepseek-ai/DeepSeek-V3.2-TEE"
// #when parsing the provider and model IDs
const result = parseProviderModel(value)
// #then only the first slash separates the provider
expect(result).toEqual({ providerID: "chutes", modelID: "deepseek-ai/DeepSeek-V3.2-TEE" })
})
it("splits simple provider model IDs", async () => {
const { parseProviderModel } = await import("./model-resolution")
// #given a provider-prefixed model without extra slashes
const value = "openai/gpt-5"
// #when parsing the provider and model IDs
const result = parseProviderModel(value)
// #then provider and model are split normally
expect(result).toEqual({ providerID: "openai", modelID: "gpt-5" })
})
it("splits synthetic provider model IDs at the provider separator", async () => {
const { parseProviderModel } = await import("./model-resolution")
// #given a synthetic provider model whose model ID contains a slash
const value = "synthetic/hf:zai-org/GLM-5.1"
// #when parsing the provider and model IDs
const result = parseProviderModel(value)
// #then only the first slash separates the provider
expect(result).toEqual({ providerID: "synthetic", modelID: "hf:zai-org/GLM-5.1" })
})
})
describe("getModelResolutionInfo", () => {
// given: Model requirements are defined in model-requirements.ts
// when: Getting model resolution info
+2 -2
View File
@@ -8,8 +8,8 @@ import { buildModelResolutionDetails } from "./model-resolution-details"
import { buildEffectiveResolution, getEffectiveModel } from "./model-resolution-effective-model"
import type { AgentResolutionInfo, CategoryResolutionInfo, ModelResolutionInfo, OmoConfig } from "./model-resolution-types"
function parseProviderModel(value: string): { providerID: string; modelID: string } | null {
const slashIndex = value.lastIndexOf("/")
export function parseProviderModel(value: string): { providerID: string; modelID: string } | null {
const slashIndex = value.indexOf("/")
if (slashIndex <= 0 || slashIndex === value.length - 1) {
return null
}