mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-10 03:09:50 +08:00
feat(codex): align Search and execution protocol
This commit is contained in:
@@ -9,6 +9,7 @@ const apiFormats = [
|
||||
{ value: 'gemini:embedding', default_path: '/v1beta/models/{model}:embedContent' },
|
||||
{ value: 'gemini:video', default_path: '/v1beta/models/{model}:predictLongRunning' },
|
||||
{ value: 'openai:responses', default_path: '/v1/responses' },
|
||||
{ value: 'openai:search', default_path: '/v1/alpha/search' },
|
||||
{ value: 'openai:embedding', default_path: '/v1/embeddings' },
|
||||
{ value: 'openai:rerank', default_path: '/v1/rerank' },
|
||||
{ value: 'openai:image', default_path: '/v1/images/generations' },
|
||||
@@ -75,6 +76,30 @@ describe('endpoint default paths', () => {
|
||||
})).toBe('/responses')
|
||||
})
|
||||
|
||||
it('uses the Search path relative to OpenAI and Codex api roots', () => {
|
||||
expect(getDefaultEndpointBaseUrl({
|
||||
apiFormat: 'openai:search',
|
||||
baseUrl: 'https://api.openai.com',
|
||||
})).toBe('https://api.openai.com/v1')
|
||||
expect(getDefaultEndpointPath({
|
||||
apiFormat: 'openai:search',
|
||||
providerType: 'openai',
|
||||
baseUrl: 'https://api.openai.com/v1',
|
||||
apiFormats,
|
||||
})).toBe('/alpha/search')
|
||||
|
||||
expect(getDefaultEndpointBaseUrl({
|
||||
apiFormat: 'openai:search',
|
||||
baseUrl: 'https://chatgpt.com/backend-api/codex',
|
||||
})).toBe('https://chatgpt.com/backend-api/codex')
|
||||
expect(getDefaultEndpointPath({
|
||||
apiFormat: 'openai:search',
|
||||
providerType: 'codex',
|
||||
baseUrl: 'https://chatgpt.com/backend-api/codex',
|
||||
apiFormats,
|
||||
})).toBe('/alpha/search')
|
||||
})
|
||||
|
||||
it('drops /v1 from API-root defaults because base URL is the API root', () => {
|
||||
expect(getDefaultEndpointPath({
|
||||
apiFormat: 'openai:chat',
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { fixedEndpointUpstreamStreamPolicy } from '../endpoint-protocol-policy'
|
||||
|
||||
describe('fixedEndpointUpstreamStreamPolicy', () => {
|
||||
it('uses the fixed Codex transport mode for each protocol', () => {
|
||||
expect(fixedEndpointUpstreamStreamPolicy('codex', 'openai:responses')).toBe('force_stream')
|
||||
expect(fixedEndpointUpstreamStreamPolicy('codex', 'openai:search')).toBe('force_non_stream')
|
||||
})
|
||||
|
||||
it('applies Search synchronization by format and keeps other formats configurable', () => {
|
||||
expect(fixedEndpointUpstreamStreamPolicy('custom', 'openai:search')).toBe('force_non_stream')
|
||||
expect(fixedEndpointUpstreamStreamPolicy('codex', 'openai:responses:compact')).toBeNull()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user