更新 OpenAI 使用密钥配置
This commit is contained in:
parent
b0142146af
commit
a391635191
@ -531,20 +531,21 @@ function generateOpenAIFiles(baseUrl: string, apiKey: string): FileConfig[] {
|
||||
|
||||
// config.toml content
|
||||
const configContent = `model_provider = "OpenAI"
|
||||
model = "gpt-5.4"
|
||||
review_model = "gpt-5.4"
|
||||
model = "gpt-5.5"
|
||||
review_model = "gpt-5.5"
|
||||
model_reasoning_effort = "xhigh"
|
||||
disable_response_storage = true
|
||||
network_access = "enabled"
|
||||
windows_wsl_setup_acknowledged = true
|
||||
model_context_window = 1000000
|
||||
model_auto_compact_token_limit = 900000
|
||||
|
||||
[model_providers.OpenAI]
|
||||
name = "OpenAI"
|
||||
base_url = "${baseUrl}"
|
||||
wire_api = "responses"
|
||||
requires_openai_auth = true`
|
||||
requires_openai_auth = true
|
||||
|
||||
[features]
|
||||
goals = true`
|
||||
|
||||
// auth.json content
|
||||
const authContent = `{
|
||||
@ -570,14 +571,12 @@ function generateOpenAIWsFiles(baseUrl: string, apiKey: string): FileConfig[] {
|
||||
|
||||
// config.toml content with WebSocket v2
|
||||
const configContent = `model_provider = "OpenAI"
|
||||
model = "gpt-5.4"
|
||||
review_model = "gpt-5.4"
|
||||
model = "gpt-5.5"
|
||||
review_model = "gpt-5.5"
|
||||
model_reasoning_effort = "xhigh"
|
||||
disable_response_storage = true
|
||||
network_access = "enabled"
|
||||
windows_wsl_setup_acknowledged = true
|
||||
model_context_window = 1000000
|
||||
model_auto_compact_token_limit = 900000
|
||||
|
||||
[model_providers.OpenAI]
|
||||
name = "OpenAI"
|
||||
@ -587,7 +586,8 @@ supports_websockets = true
|
||||
requires_openai_auth = true
|
||||
|
||||
[features]
|
||||
responses_websockets_v2 = true`
|
||||
responses_websockets_v2 = true
|
||||
goals = true`
|
||||
|
||||
// auth.json content
|
||||
const authContent = `{
|
||||
|
||||
@ -17,6 +17,78 @@ vi.mock('@/composables/useClipboard', () => ({
|
||||
import UseKeyModal from '../UseKeyModal.vue'
|
||||
|
||||
describe('UseKeyModal', () => {
|
||||
it('renders GPT-5.5 and goals feature in OpenAI Codex config', () => {
|
||||
const wrapper = mount(UseKeyModal, {
|
||||
props: {
|
||||
show: true,
|
||||
apiKey: 'sk-test',
|
||||
baseUrl: 'https://example.com/v1',
|
||||
platform: 'openai'
|
||||
},
|
||||
global: {
|
||||
stubs: {
|
||||
BaseDialog: {
|
||||
template: '<div><slot /><slot name="footer" /></div>'
|
||||
},
|
||||
Icon: {
|
||||
template: '<span />'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const codeBlocks = wrapper.findAll('pre code').map((code) => code.text())
|
||||
const configToml = codeBlocks.find((content) => content.includes('model_provider = "OpenAI"'))
|
||||
|
||||
expect(configToml).toBeDefined()
|
||||
expect(configToml).toContain('model = "gpt-5.5"')
|
||||
expect(configToml).toContain('review_model = "gpt-5.5"')
|
||||
expect(configToml).not.toContain('model = "gpt-5.4"')
|
||||
expect(configToml).not.toContain('model_context_window')
|
||||
expect(configToml).not.toContain('model_auto_compact_token_limit')
|
||||
expect(configToml).toContain('[features]\ngoals = true')
|
||||
})
|
||||
|
||||
it('renders GPT-5.5 and goals feature in OpenAI Codex WebSocket config', async () => {
|
||||
const wrapper = mount(UseKeyModal, {
|
||||
props: {
|
||||
show: true,
|
||||
apiKey: 'sk-test',
|
||||
baseUrl: 'https://example.com/v1',
|
||||
platform: 'openai'
|
||||
},
|
||||
global: {
|
||||
stubs: {
|
||||
BaseDialog: {
|
||||
template: '<div><slot /><slot name="footer" /></div>'
|
||||
},
|
||||
Icon: {
|
||||
template: '<span />'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const wsTab = wrapper.findAll('button').find((button) =>
|
||||
button.text().includes('keys.useKeyModal.cliTabs.codexCliWs')
|
||||
)
|
||||
|
||||
expect(wsTab).toBeDefined()
|
||||
await wsTab!.trigger('click')
|
||||
await nextTick()
|
||||
|
||||
const codeBlocks = wrapper.findAll('pre code').map((code) => code.text())
|
||||
const configToml = codeBlocks.find((content) => content.includes('supports_websockets = true'))
|
||||
|
||||
expect(configToml).toBeDefined()
|
||||
expect(configToml).toContain('model = "gpt-5.5"')
|
||||
expect(configToml).toContain('review_model = "gpt-5.5"')
|
||||
expect(configToml).not.toContain('model = "gpt-5.4"')
|
||||
expect(configToml).not.toContain('model_context_window')
|
||||
expect(configToml).not.toContain('model_auto_compact_token_limit')
|
||||
expect(configToml).toContain('[features]\nresponses_websockets_v2 = true\ngoals = true')
|
||||
})
|
||||
|
||||
it('renders GPT-5.4 mini entry in OpenCode config', async () => {
|
||||
const wrapper = mount(UseKeyModal, {
|
||||
props: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user