fix(models): add image support for deepseek-v4-flash-vision-exp

deepseek/deepseek-v4-flash-vision-exp is served by the Provider API but was
missing from the hardcoded MODEL_INPUT_MODALITIES allowlist, so pi rejected
any conversation containing an image block. Notably this also rejected images
returned by the read tool via toolResult:

  Error: Selected Command Code model does not support image content in tool results

Adding the allowlist entry lets modelSupportsImageInput() return true and the
converters forward images using the current Command Code wire format.

Coverage:
- regression test for modelSupportsImageInput("deepseek/deepseek-v4-flash-vision-exp")
- end-to-end stream test for a tool-result image forwarded as a following user
  image (the concrete read reproduction), not only a user-attached image
- end-to-end stream test asserting a text-only model still rejects tool-result
  images before any network access

Refs: https://github.com/patlux/pi-commandcode-provider/issues/54
This commit is contained in:
laijxa
2026-08-25 19:42:10 +08:00
parent dc515e85b6
commit d14c2f0feb
3 changed files with 83 additions and 1 deletions
+3 -1
View File
@@ -103,11 +103,13 @@ describe("commandCodeModelsFromApiResponse()", () => {
it("matches command-code@1.32.1 image input capabilities", () => {
assert.deepEqual(inputModalitiesForModel("gpt-5.6-luna"), ["text", "image"])
assert.deepEqual(inputModalitiesForModel("meta/muse-spark-1.2"), ["text", "image"])
assert.deepEqual(inputModalitiesForModel("deepseek/deepseek-v4-flash-vision-exp"), ["text", "image"])
assert.deepEqual(inputModalitiesForModel("deepseek/deepseek-v4-pro"), ["text"])
assert.deepEqual(inputModalitiesForModel("unknown-new-model"), ["text"])
assert.equal(modelSupportsImageInput("gpt-5.6-luna"), true)
assert.equal(modelSupportsImageInput("deepseek/deepseek-v4-flash-vision-exp"), true)
assert.equal(modelSupportsImageInput("deepseek/deepseek-v4-pro"), false)
assert.equal(Object.keys(MODEL_INPUT_MODALITIES).length, 37)
assert.equal(Object.keys(MODEL_INPUT_MODALITIES).length, 38)
})
it("marks only known reasoning models as reasoning-capable", () => {