Commit Graph
1 Commits
Author SHA1 Message Date
yetone 84ad780b65 gui: DeepSeek's image-files setting in the provider editor's Advanced (#5407)
matrix0487 on Discord (#feedback, 11-05) asked to change image-files from
the GUI: 8fbf8e0af made it CLI-only (`magpie provider set <id>
image-files=off`). The editor's Advanced now has an Images tick, "Upload
images once and send them by file id", on by default. It shows only where
the setting has effect: a provider on api.deepseek.com, the built-in
DeepSeek or a custom one with that base.

The rule has one source: provider.ImageFilesAt(to) (own key, no account or
plugin, Chat/Responses/Anthropic, host == provider.DeepSeekHost), and
TakesImageFiles for the editor. The gateway's dsFilesOn and forward's
dsSent setup ask ImageFilesAt instead of their own host checks.
/api/providers sends imageFilesOff and takesImageFiles; /api/provider/save
takes imageFilesOff as *bool, so a save that leaves it out keeps the old
value (CLI-set off stays off), false turns it on, true off. app.js sends it
only when the row is shown. Strings in zh, zh-TW, ja and de. app.js is 135
bytes under its base (four comments cut to one line); no budget raised.

Run on mote:
- provider-image-files.test.cjs: chromium + webkit, en/zh/zh-TW/ja/de,
  1100 and 420 wide, 60/60. Shown for DeepSeek and a custom
  api.deepseek.com base, hidden for another relay, toggling saves the
  field, CLI-set off shows off.
- i18n-keys, i18n-en-no-cjk, editor-advanced-align, editor-fold-clickable,
  provider-limit-rest, provider-image-files: 131/132; the red is i18n-keys
  "a plugin's words are its own" from other tests' strings ("View
  routing", "No session ID"), #5332 / #5327.
- go test -timeout 45m ./internal/provider ./internal/gateway
  ./internal/cli ok; ./internal/gui ok but TestMainWindowCorners, the
  macOS 27 red (#3949). TestProviderSaveImageFiles and
  TestCoreScriptBudget rerun after the comment cut.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows.

Broken by hand, each red then restored:
- row condition `if (false)`: GUI red (chromium en 420).
- save field renamed: GUI red (webkit zh 420).
- imageFilesOff left out of draftOf: GUI red ("one set off from the CLI").
- the old keep-only save restored: TestProviderSaveImageFiles red
  ("ticked on in the editor, still saved off").
- host rule loosened to contains "deepseek": TestProviderSaveImageFiles
  red (api.deepseek.com.example.com offered).

Not tried: a real DeepSeek key or the real app; a URL edit on an unsaved
provider doesn't show or hide the row live (it follows the saved row's
flag).
2026-11-06 08:01:14 +08:00