SIGN IN SIGN UP

fix: include reasoning_content field for DeepSeek Reasoner models (#11290)

* fix: include reasoning_content field for DeepSeek Reasoner models

DeepSeek Reasoner API requires the reasoning_content field on every
assistant message, even when no thinking message precedes it (e.g. in
resumed sessions). Previously, appendReasoningFieldsIfSupported returned
early when prevMessage was missing or not a thinking role, causing 400
"Missing reasoning_content field" errors. Now reasoning_content defaults
to an empty string when no thinking content is available.

Fixes #11285

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: use stripImages instead of typecast for MessageContent

Replace `as string` typecasts with stripImages() which safely handles
both string and MessagePart[] content types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
M
Matt Van Horn committed
4b6a09c9e78544f2b1a54a9db9fd57ed9b9bb0b1
Parent: eccde96
Committed by GitHub <noreply@github.com> on 3/21/2026, 1:24:31 AM