feat(toast): show warning only for fallback models (inherited/system-default)
category-default is the intended behavior for builtin categories, not a fallback. Only show toast warning when: - inherited: model from parent session (custom category without model) - system-default: OpenCode's global default model User-defined and category-default are both expected behaviors, so no warning is needed.
This commit is contained in:
@@ -107,16 +107,16 @@ export class TaskToastManager {
|
||||
|
||||
const lines: string[] = []
|
||||
|
||||
// Show model fallback warning for the new task if applicable
|
||||
if (newTask.modelInfo && newTask.modelInfo.type !== "user-defined") {
|
||||
const icon = "⚠️"
|
||||
const suffixMap: Partial<Record<ModelFallbackInfo["type"], string>> = {
|
||||
inherited: " (inherited)",
|
||||
"category-default": " (category default)",
|
||||
"system-default": " (system default)",
|
||||
const isFallback = newTask.modelInfo && (
|
||||
newTask.modelInfo.type === "inherited" || newTask.modelInfo.type === "system-default"
|
||||
)
|
||||
if (isFallback) {
|
||||
const suffixMap: Record<"inherited" | "system-default", string> = {
|
||||
inherited: " (inherited from parent)",
|
||||
"system-default": " (system default fallback)",
|
||||
}
|
||||
const suffix = suffixMap[newTask.modelInfo.type] ?? ""
|
||||
lines.push(`${icon} Model: ${newTask.modelInfo.model}${suffix}`)
|
||||
const suffix = suffixMap[newTask.modelInfo!.type as "inherited" | "system-default"]
|
||||
lines.push(`⚠️ Model fallback: ${newTask.modelInfo!.model}${suffix}`)
|
||||
lines.push("")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user