From 536645dc0e585232080e74de8281cce5ba0fbfc5 Mon Sep 17 00:00:00 2001 From: Manikandan Sundararajan <10191300+itsrainingmani@users.noreply.github.com> Date: Thu, 15 Jan 2026 03:31:48 -0500 Subject: [PATCH 1/3] feat(tui): show warning if user tries to input image to an unsupported model --- .../src/cli/cmd/tui/component/prompt/index.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx index 145fa9da0c3..fa4867c19dd 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx @@ -85,6 +85,14 @@ export function Prompt(props: PromptProps) { } } + function canPasteImage() { + const model = local.model.current() + if (!model) return false + const provider = sync.data.provider.find((x) => x.id === model.providerID) + const info = provider?.models[model.modelID] + return info?.capabilities?.input?.image ?? false + } + const textareaKeybindings = useTextareaKeybindings() const fileStyleId = syntax().getStyleId("extmark.file")! @@ -645,6 +653,14 @@ export function Prompt(props: PromptProps) { } async function pasteImage(file: { filename?: string; content: string; mime: string }) { + if (!canPasteImage()) { + toast.show({ + variant: "warning", + message: "Current model does not support images", + duration: 3000, + }) + return + } const currentOffset = input.visualCursor.offset const extmarkStart = currentOffset const count = store.prompt.parts.filter((x) => x.type === "file").length From 3fbb5ed90122a1f867a27c1346a63e7186d26c55 Mon Sep 17 00:00:00 2001 From: Mani Sundararajan <10191300+itsrainingmani@users.noreply.github.com> Date: Sat, 17 Jan 2026 01:52:37 -0500 Subject: [PATCH 2/3] simplify input capabilities fetching by adding to local context --- .../src/cli/cmd/tui/component/prompt/index.tsx | 12 ++---------- packages/opencode/src/cli/cmd/tui/context/local.tsx | 1 + 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx index fa4867c19dd..3da1f7ef13b 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx @@ -85,14 +85,6 @@ export function Prompt(props: PromptProps) { } } - function canPasteImage() { - const model = local.model.current() - if (!model) return false - const provider = sync.data.provider.find((x) => x.id === model.providerID) - const info = provider?.models[model.modelID] - return info?.capabilities?.input?.image ?? false - } - const textareaKeybindings = useTextareaKeybindings() const fileStyleId = syntax().getStyleId("extmark.file")! @@ -653,10 +645,10 @@ export function Prompt(props: PromptProps) { } async function pasteImage(file: { filename?: string; content: string; mime: string }) { - if (!canPasteImage()) { + if (!local.model.parsed().input?.image) { toast.show({ variant: "warning", - message: "Current model does not support images", + message: `${local.model.parsed().model} doesn't support image as input`, duration: 3000, }) return diff --git a/packages/opencode/src/cli/cmd/tui/context/local.tsx b/packages/opencode/src/cli/cmd/tui/context/local.tsx index 63f1d9743bf..22db0a80e03 100644 --- a/packages/opencode/src/cli/cmd/tui/context/local.tsx +++ b/packages/opencode/src/cli/cmd/tui/context/local.tsx @@ -214,6 +214,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({ provider: provider?.name ?? value.providerID, model: info?.name ?? value.modelID, reasoning: info?.capabilities?.reasoning ?? false, + input: info?.capabilities?.input, } }), cycle(direction: 1 | -1) { From 453c066dac60554016a11cd18b51f4f1f31f2ab3 Mon Sep 17 00:00:00 2001 From: Mani Sundararajan <10191300+itsrainingmani@users.noreply.github.com> Date: Tue, 20 Jan 2026 18:13:06 -0500 Subject: [PATCH 3/3] simplify the local model parsed() type --- packages/opencode/src/cli/cmd/tui/context/local.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/opencode/src/cli/cmd/tui/context/local.tsx b/packages/opencode/src/cli/cmd/tui/context/local.tsx index 22db0a80e03..b002165ce92 100644 --- a/packages/opencode/src/cli/cmd/tui/context/local.tsx +++ b/packages/opencode/src/cli/cmd/tui/context/local.tsx @@ -206,6 +206,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({ provider: "Connect a provider", model: "No provider selected", reasoning: false, + input: undefined, } } const provider = sync.data.provider.find((x) => x.id === value.providerID)