- Claude Code commands (user, project scope): sanitize model to undefined - OpenCode commands (opencode, opencode-project scope): preserve model as-is 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
13 lines
334 B
TypeScript
13 lines
334 B
TypeScript
type CommandSource = "claude-code" | "opencode"
|
|
|
|
export function sanitizeModelField(model: unknown, source: CommandSource = "claude-code"): string | undefined {
|
|
if (source === "claude-code") {
|
|
return undefined
|
|
}
|
|
|
|
if (typeof model === "string" && model.trim().length > 0) {
|
|
return model.trim()
|
|
}
|
|
return undefined
|
|
}
|