fix: inject system prompt as role:system message (server ignores top-level system field)
Verified via behavior test against Qoder API (ultimate model): - system field with a directive: model ignores it (prompt_tokens=15, normal reply) - same directive in messages[0] role:system: model obeys (prompt_tokens=97, marker reply) The server's top-level `system` field in the request body is never fed to the model, so pi's systemPrompt (language prefs, tool rules, agent instructions) was silently dropped. Inject it as a leading role:system message instead, which the server honors.
This commit is contained in:
+7
-2
@@ -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: {
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ type QoderContent = string | Array<QoderTextPart | QoderImagePart>;
|
||||
|
||||
/** 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;
|
||||
|
||||
Reference in New Issue
Block a user