fix: preserve reasoning_content in multi-turn conversations

When using thinking-enabled models (like Kimi K2.5, DeepSeek), the API
expects reasoning_content on all assistant messages. The original
ChatDeepSeek stores reasoning_content in additional_kwargs but doesn't
include it when making subsequent API calls, causing "reasoning_content
is missing" errors.

This adds PatchedChatDeepSeek which overrides _get_request_payload to
restore reasoning_content from additional_kwargs into the payload.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hetaoBackend
2026-01-28 14:03:43 +08:00
parent 486a06d772
commit 9d0a0ea022
4 changed files with 93 additions and 7 deletions

View File

@@ -56,6 +56,19 @@ models:
# thinking:
# type: enabled
# Example: Kimi K2.5 model
# - name: kimi-k2.5
# display_name: Kimi K2.5
# use: src.models.patched_deepseek:PatchedChatDeepSeek
# model: kimi-k2.5
# api_base: https://api.moonshot.cn/v1
# api_key: $MOONSHOT_API_KEY
# max_tokens: 32768
# supports_thinking: true
# extra_body:
# thinking:
# type: enabled
# ============================================================================
# Tool Groups Configuration
# ============================================================================