mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 02:10:24 +00:00
fix: default OpenAI personality overlay to friendly
This commit is contained in:
@@ -322,9 +322,37 @@ describe("openai plugin", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("defaults to no OpenAI interaction-style overlay", async () => {
|
||||
it("defaults to the friendly OpenAI interaction-style overlay", async () => {
|
||||
const { on, providers } = await registerOpenAIPluginWithHook();
|
||||
|
||||
expect(on).not.toHaveBeenCalledWith("before_prompt_build", expect.any(Function));
|
||||
const openaiProvider = requireRegisteredProvider(providers, "openai");
|
||||
expect(
|
||||
openaiProvider.resolveSystemPromptContribution?.({
|
||||
config: undefined,
|
||||
agentDir: undefined,
|
||||
workspaceDir: undefined,
|
||||
provider: "openai",
|
||||
modelId: "gpt-5.4",
|
||||
promptMode: "full",
|
||||
runtimeChannel: undefined,
|
||||
runtimeCapabilities: undefined,
|
||||
agentId: undefined,
|
||||
}),
|
||||
).toEqual({
|
||||
stablePrefix: OPENAI_GPT5_OUTPUT_CONTRACT,
|
||||
sectionOverrides: {
|
||||
interaction_style: OPENAI_FRIENDLY_PROMPT_OVERLAY,
|
||||
execution_bias: OPENAI_GPT5_EXECUTION_BIAS,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("supports opting out of the friendly prompt overlay via plugin config", async () => {
|
||||
const { on, providers } = await registerOpenAIPluginWithHook({
|
||||
pluginConfig: { personality: "off" },
|
||||
});
|
||||
|
||||
expect(on).not.toHaveBeenCalledWith("before_prompt_build", expect.any(Function));
|
||||
const openaiProvider = requireRegisteredProvider(providers, "openai");
|
||||
expect(
|
||||
@@ -347,7 +375,7 @@ describe("openai plugin", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("supports opting into the friendly prompt overlay via plugin config", async () => {
|
||||
it("supports explicitly configuring the friendly prompt overlay", async () => {
|
||||
const { on, providers } = await registerOpenAIPluginWithHook({
|
||||
pluginConfig: { personality: "friendly" },
|
||||
});
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
"personality": {
|
||||
"type": "string",
|
||||
"enum": ["friendly", "off"],
|
||||
"default": "off",
|
||||
"default": "friendly",
|
||||
"description": "Controls the default OpenAI-specific personality used for OpenAI and OpenAI Codex runs."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ export type OpenAIPromptOverlayMode = "friendly" | "off";
|
||||
export function resolveOpenAIPromptOverlayMode(
|
||||
pluginConfig?: Record<string, unknown>,
|
||||
): OpenAIPromptOverlayMode {
|
||||
return pluginConfig?.personality === "friendly" ? "friendly" : "off";
|
||||
return pluginConfig?.personality === "off" ? "off" : "friendly";
|
||||
}
|
||||
|
||||
export function shouldApplyOpenAIPromptOverlay(params: {
|
||||
|
||||
Reference in New Issue
Block a user