diff --git a/src/stream.ts b/src/stream.ts index 8f79171..920afc0 100644 --- a/src/stream.ts +++ b/src/stream.ts @@ -189,8 +189,13 @@ export function streamQoder( chat_prompt: "", image_urls: null, aliyun_user_type: "", - system: systemText, - messages: normalizedMessages, + // Qoder's server ignores the top-level `system` field (verified: the + // model never sees it). Inject the system prompt as a leading + // role:system message instead, which the server does honor. + system: "", + messages: systemText + ? [{ role: "system", content: systemText }, ...normalizedMessages] + : normalizedMessages, tools: toolsRaw || [], parameters: { max_tokens: maxTokens }, chat_context: { diff --git a/src/transform.ts b/src/transform.ts index 13d9ee9..810c233 100644 --- a/src/transform.ts +++ b/src/transform.ts @@ -32,7 +32,7 @@ type QoderContent = string | Array; /** OpenAI-style message sent to the Qoder API. */ interface QoderMessage { - role: "user" | "assistant" | "tool"; + role: "user" | "assistant" | "tool" | "system"; content: QoderContent | null; tool_calls?: QoderToolCall[]; tool_call_id?: string;