Skip to content

Commit ab8fe1a

Browse files
committed
fix(opencode-plugin-mimic): split modelId by slash to extract provider and model separately
1 parent bec314b commit ab8fe1a

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • packages/opencode-plugin-mimic/src/modules/observation

packages/opencode-plugin-mimic/src/modules/observation/observer.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,11 @@ async function analyzePatternsWithLLM(
280280
}
281281

282282
const observerConfig = "observer" in config ? config.observer : undefined;
283-
const modelId = observerConfig?.model || DEFAULT_OBSERVER_MODEL;
284-
// Extract provider from model ID (e.g., "anthropic/claude-3-haiku" -> "anthropic")
285-
// If model doesn't contain "/", split returns the original string, so validate it
286-
const extractedProvider = modelId.includes("/") ? modelId.split("/")[0] : undefined;
283+
const rawModelId = observerConfig?.model || DEFAULT_OBSERVER_MODEL;
284+
// Extract provider and model from model ID (e.g., "anthropic/claude-3-haiku" -> provider: "anthropic", model: "claude-3-haiku")
285+
const hasSlash = rawModelId.includes("/");
286+
const extractedProvider = hasSlash ? rawModelId.split("/")[0] : undefined;
287+
const modelId = hasSlash ? rawModelId.split("/").slice(1).join("/") : rawModelId;
287288
const providerId = observerConfig?.provider || extractedProvider || DEFAULT_OBSERVER_PROVIDER;
288289

289290
try {

0 commit comments

Comments
 (0)