fix: normalize developer role to system for OpenAI-format providers (#1011)
Deepseek API (and likely other providers) reject messages with role: 'developer' — only accept system, user, assistant, tool. filterToOpenAIFormat() normalizes content blocks but never touched message roles, so developer passed through unmodified and caused 400 errors (issue #773). Fix: add one-line developer → system mapping in filterToOpenAIFormat() before role-specific logic. This is the common normalization point called for all targetFormat=openai providers (Deepseek, Groq, Mistral, Perplexity, Together, Fireworks, Cerebras, xAI, NVIDIA, etc.) Closes #773
This commit is contained in:
parent
06291b290f
commit
80a2bfcfd7
1 changed files with 3 additions and 0 deletions
|
|
@ -10,6 +10,9 @@ export function filterToOpenAIFormat(body) {
|
|||
if (!body.messages || !Array.isArray(body.messages)) return body;
|
||||
|
||||
body.messages = body.messages.map(msg => {
|
||||
// Normalize developer role to system (many providers don't support developer)
|
||||
if (msg.role === "developer") msg = { ...msg, role: "system" };
|
||||
|
||||
// Keep tool messages as-is (OpenAI format)
|
||||
if (msg.role === "tool") return msg;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue