fix(ai): replay DeepSeek V4 reasoning content

closes #3668
This commit is contained in:
Mario Zechner
2026-04-24 19:32:51 +02:00
parent b4e93feb8c
commit 9b103e5e41
3 changed files with 13 additions and 0 deletions

View File

@@ -6,6 +6,8 @@
- Stopped sending `tools: []` on OpenAI-compatible, Anthropic, OpenAI Responses, OpenAI Codex Responses, and Azure OpenAI Responses requests when no tools are active (e.g. `pi --no-tools`). DashScope/Aliyun Qwen (OpenAI-compatible) rejects empty tools arrays with `"[] is too short - 'tools'"` (HTTP 400); the field is now omitted unless the conversation has tool history (the existing LiteLLM/Anthropic-proxy workaround).
- Fixed `supportsXhigh()` to recognize DeepSeek V4 Pro, preserving `xhigh` reasoning requests so they map to DeepSeek's `max` effort ([#3662](https://github.com/badlogic/pi-mono/issues/3662))
- Fixed OpenAI-compatible DeepSeek V4 model replay to include empty `reasoning_content` on assistant messages when needed, preventing OpenRouter DeepSeek V4 sessions from failing after responses without reasoning deltas ([#3668](https://github.com/badlogic/pi-mono/issues/3668))
## [0.70.2] - 2026-04-24
### Fixed

View File

@@ -1063,6 +1063,15 @@ async function generateModels() {
];
allModels.push(...deepseekV4Models);
for (const candidate of allModels) {
if (candidate.api === "openai-completions" && candidate.id.includes("deepseek-v4")) {
candidate.compat = {
...candidate.compat,
requiresReasoningContentOnAssistantMessages: true,
};
}
}
const minimaxDirectSupportedIds = new Set(["MiniMax-M2.7", "MiniMax-M2.7-highspeed"]);
for (const candidate of allModels) {

View File

@@ -8240,6 +8240,7 @@ export const MODELS = {
api: "openai-completions",
provider: "openrouter",
baseUrl: "https://openrouter.ai/api/v1",
compat: {"requiresReasoningContentOnAssistantMessages":true},
reasoning: true,
input: ["text"],
cost: {
@@ -8257,6 +8258,7 @@ export const MODELS = {
api: "openai-completions",
provider: "openrouter",
baseUrl: "https://openrouter.ai/api/v1",
compat: {"requiresReasoningContentOnAssistantMessages":true},
reasoning: true,
input: ["text"],
cost: {