mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 10:20:42 +00:00
fix(openai): default GPT-5 prompt overlay
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
OPENAI_GPT5_EXECUTION_BIAS,
|
||||
OPENAI_GPT5_OUTPUT_CONTRACT,
|
||||
OPENAI_GPT5_TOOL_CALL_STYLE,
|
||||
shouldApplyOpenAIPromptOverlay,
|
||||
} from "./prompt-overlay.js";
|
||||
|
||||
const runtimeMocks = vi.hoisted(() => ({
|
||||
@@ -414,12 +415,30 @@ describe("openai plugin", () => {
|
||||
execution_bias: OPENAI_GPT5_EXECUTION_BIAS,
|
||||
},
|
||||
});
|
||||
expect(
|
||||
openaiProvider.resolveSystemPromptContribution?.({
|
||||
...contributionContext,
|
||||
modelId: "openai/gpt-5.4-mini",
|
||||
}),
|
||||
).toEqual({
|
||||
stablePrefix: [OPENAI_GPT5_OUTPUT_CONTRACT, OPENAI_GPT5_TOOL_CALL_STYLE].join("\n\n"),
|
||||
sectionOverrides: {
|
||||
interaction_style: OPENAI_FRIENDLY_PROMPT_OVERLAY,
|
||||
execution_bias: OPENAI_GPT5_EXECUTION_BIAS,
|
||||
},
|
||||
});
|
||||
expect(
|
||||
openaiProvider.resolveSystemPromptContribution?.({
|
||||
...contributionContext,
|
||||
modelId: "gpt-image-1",
|
||||
}),
|
||||
).toBeUndefined();
|
||||
expect(shouldApplyOpenAIPromptOverlay({ modelProviderId: "openai", modelId: "gpt-4.1" })).toBe(
|
||||
false,
|
||||
);
|
||||
expect(
|
||||
shouldApplyOpenAIPromptOverlay({ modelProviderId: "anthropic", modelId: "gpt-5.4" }),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("includes stronger execution guidance in the OpenAI prompt overlay", () => {
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
"type": "string",
|
||||
"enum": ["friendly", "on", "off"],
|
||||
"default": "friendly",
|
||||
"description": "Controls the default OpenAI-specific personality used for OpenAI and OpenAI Codex runs. `friendly` and `on` enable the overlay; `off` disables it."
|
||||
"description": "Controls the OpenAI-specific friendly interaction-style overlay for GPT-5 OpenAI and OpenAI Codex runs. `friendly` and `on` enable the style overlay; `off` disables only that style layer."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtime";
|
||||
|
||||
const OPENAI_PROVIDER_IDS = new Set(["openai", "openai-codex"]);
|
||||
const OPENAI_GPT5_MODEL_PREFIX = "gpt-5";
|
||||
const OPENAI_GPT5_MODEL_ID_PATTERN = /(?:^|[/:])gpt-5(?:[.-]|$)/i;
|
||||
|
||||
export const OPENAI_FRIENDLY_PROMPT_OVERLAY = `## Interaction Style
|
||||
|
||||
@@ -96,7 +96,7 @@ export function shouldApplyOpenAIPromptOverlay(params: {
|
||||
return false;
|
||||
}
|
||||
const normalizedModelId = normalizeLowercaseStringOrEmpty(params.modelId);
|
||||
return normalizedModelId.startsWith(OPENAI_GPT5_MODEL_PREFIX);
|
||||
return OPENAI_GPT5_MODEL_ID_PATTERN.test(normalizedModelId);
|
||||
}
|
||||
|
||||
export function resolveOpenAISystemPromptContribution(params: {
|
||||
|
||||
Reference in New Issue
Block a user