程序员阿江(Relakkes) 99caf8fdf5 fix: avoid DeepSeek OpenAI image_url rejection
DeepSeek's OpenAI-compatible chat schema accepts text content rather than OpenAI vision content parts, so forwarding Anthropic image blocks as image_url makes the upstream reject the request before the model can answer. Keep normal OpenAI Chat vision behavior as the default, but switch known DeepSeek-compatible chat proxy requests to a text-only conversion that preserves prompt text and replaces image payloads with a small omission marker.

Constraint: DeepSeek official Chat Completions docs list user message content as string text, while its Anthropic compatibility table marks image blocks as not supported.

Rejected: Expand unsupported-image error string matching only | it still surfaces the first turn as an API error and depends on provider wording.

Confidence: high

Scope-risk: narrow

Tested: bun test src/server/__tests__/proxy-transform.test.ts

Tested: bun test src/server/__tests__/providers.test.ts --test-name-pattern "handleProxyRequest|omits image_url"

Tested: bun test src/services/api/errors.test.ts tests/mediaRecoveryAndEstimation.test.ts

Tested: bun run check:server
2026-06-01 00:11:44 +08:00
..
2026-03-31 01:55:58 -07:00