fix(ai): append system prompt to codex bridge message instead of converting to input
Previously the system prompt was converted to an input message in convertMessages, then stripped out by filterPiSystemPrompts. Now the system prompt is passed directly to transformRequestBody and appended after CODEX_PI_BRIDGE in the bridge message.
This commit is contained in:
@@ -123,6 +123,7 @@ export const streamOpenAICodexResponses: StreamFunction<"openai-codex-responses"
|
||||
codexInstructions,
|
||||
codexOptions,
|
||||
options?.codexMode ?? true,
|
||||
context.systemPrompt,
|
||||
);
|
||||
|
||||
const headers = createCodexHeaders(model.headers, accountId, apiKey, transformedBody.prompt_cache_key);
|
||||
@@ -477,14 +478,6 @@ function convertMessages(model: Model<"openai-codex-responses">, context: Contex
|
||||
|
||||
const transformedMessages = transformMessages(context.messages, model);
|
||||
|
||||
if (context.systemPrompt) {
|
||||
const role = model.reasoning ? "developer" : "system";
|
||||
messages.push({
|
||||
role,
|
||||
content: sanitizeSurrogates(context.systemPrompt),
|
||||
});
|
||||
}
|
||||
|
||||
let msgIndex = 0;
|
||||
for (const msg of transformedMessages) {
|
||||
if (msg.role === "user") {
|
||||
|
||||
Reference in New Issue
Block a user