mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-09-24 16:05:44 +08:00
Merge pull request #3549 from dftian478/codex/中文-gpt55-codex-instructions
修复 OpenAI GPT-5.5 的 Codex 指令选择
This commit is contained in:
@@ -25,6 +25,7 @@ func TestCodexBaseInstructionsForModel(t *testing.T) {
|
||||
{"gpt-5.1-codex-max", "You are Codex, based on GPT-5"},
|
||||
{"gpt-5.2-codex", "You are Codex, based on GPT-5"},
|
||||
{"gpt-5.5", "You are Codex, a coding agent based on GPT-5"},
|
||||
{" GPT-5.5 ", "You are Codex, a coding agent based on GPT-5"},
|
||||
{"gpt-5.2", "You are GPT-5.2 running in the Codex CLI"},
|
||||
{"gpt-5.1", "You are GPT-5.1 running in the Codex CLI"},
|
||||
{"gpt-5", "You are Codex, a coding agent based on GPT-5"}, // 回退到最新(GPT-5.5)
|
||||
|
||||
@@ -61,6 +61,8 @@ func TestApplyCodexClientMetadata(t *testing.T) {
|
||||
// defaultCodexSynthInstructions:按模型选用真实 Codex base prompt。
|
||||
func TestDefaultCodexSynthInstructionsModelAware(t *testing.T) {
|
||||
require.True(t, strings.Contains(defaultCodexSynthInstructions("gpt-5-codex"), "You are Codex, based on GPT-5"))
|
||||
require.True(t, strings.Contains(defaultCodexSynthInstructions("gpt-5.5"), "You are Codex, a coding agent based on GPT-5"))
|
||||
require.False(t, strings.Contains(defaultCodexSynthInstructions("gpt-5.5"), "You are GPT-5.1 running in the Codex CLI"))
|
||||
require.True(t, strings.Contains(defaultCodexSynthInstructions("gpt-5.2"), "You are GPT-5.2 running in the Codex CLI"))
|
||||
require.True(t, strings.Contains(defaultCodexSynthInstructions("gpt-5.1"), "You are GPT-5.1 running in the Codex CLI"))
|
||||
}
|
||||
|
||||
@@ -1008,6 +1008,21 @@ func TestApplyCodexOAuthTransform_CodexCLI_SuppliesDefaultWhenEmpty(t *testing.T
|
||||
require.True(t, result.Modified)
|
||||
}
|
||||
|
||||
func TestApplyCodexOAuthTransform_GPT55SuppliesModelSpecificInstructions(t *testing.T) {
|
||||
reqBody := map[string]any{
|
||||
"model": "gpt-5.5",
|
||||
"instructions": " ",
|
||||
}
|
||||
|
||||
result := applyCodexOAuthTransform(reqBody, true, false)
|
||||
|
||||
instructions, ok := reqBody["instructions"].(string)
|
||||
require.True(t, ok)
|
||||
require.Contains(t, instructions, "You are Codex, a coding agent based on GPT-5")
|
||||
require.NotContains(t, instructions, "You are GPT-5.1 running in the Codex CLI")
|
||||
require.True(t, result.Modified)
|
||||
}
|
||||
|
||||
func TestApplyCodexOAuthTransform_NonCodexCLI_PreservesExistingInstructions(t *testing.T) {
|
||||
// 非 Codex CLI 场景:已有 instructions 时保留客户端的值,不再覆盖
|
||||
|
||||
|
||||
Reference in New Issue
Block a user