mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-08 10:27:46 +08:00
fix(frontend): align Vertex Gemini endpoint controls
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { getDefaultEndpointPath } from '../endpoint-default-paths'
|
||||
|
||||
const apiFormats = [
|
||||
{ value: 'gemini:generate_content', default_path: '/v1beta/models/{model}:{action}' },
|
||||
{ value: 'gemini:embedding', default_path: '/v1beta/models/{model}:{action}' },
|
||||
{ value: 'openai:responses', default_path: '/v1/responses' },
|
||||
]
|
||||
|
||||
describe('endpoint default paths', () => {
|
||||
it('uses Gemini Developer API paths for custom Gemini endpoints', () => {
|
||||
expect(getDefaultEndpointPath({
|
||||
apiFormat: 'gemini:generate_content',
|
||||
providerType: 'custom',
|
||||
apiFormats,
|
||||
})).toBe('/v1beta/models/{model}:{action}')
|
||||
|
||||
expect(getDefaultEndpointPath({
|
||||
apiFormat: 'gemini:embedding',
|
||||
providerType: 'custom',
|
||||
apiFormats,
|
||||
})).toBe('/v1beta/models/{model}:{action}')
|
||||
})
|
||||
|
||||
it('uses Vertex AI project/location paths for Vertex provider Gemini endpoints', () => {
|
||||
expect(getDefaultEndpointPath({
|
||||
apiFormat: 'gemini:generate_content',
|
||||
providerType: 'vertex_ai',
|
||||
apiFormats,
|
||||
})).toBe('/v1/projects/{project_id}/locations/{region}/publishers/google/models/{model}:{action}')
|
||||
|
||||
expect(getDefaultEndpointPath({
|
||||
apiFormat: 'gemini:embedding',
|
||||
providerType: 'vertex_ai',
|
||||
apiFormats,
|
||||
})).toBe('/v1/projects/{project_id}/locations/{region}/publishers/google/models/{model}:predict')
|
||||
})
|
||||
|
||||
it('keeps Codex Responses root path without duplicating /v1', () => {
|
||||
expect(getDefaultEndpointPath({
|
||||
apiFormat: 'openai:responses',
|
||||
providerType: 'codex',
|
||||
apiFormats,
|
||||
})).toBe('/responses')
|
||||
})
|
||||
})
|
||||
+21
@@ -350,6 +350,27 @@ describe('provider key concurrent_limit form behavior', () => {
|
||||
}))
|
||||
})
|
||||
|
||||
it('keeps Gemini embedding selectable for Vertex AI keys', async () => {
|
||||
const root = mountDialog(KeyFormDialog, {
|
||||
open: true,
|
||||
endpoint: null,
|
||||
editingKey: null,
|
||||
providerId: 'provider-vertex',
|
||||
providerType: 'vertex_ai',
|
||||
availableApiFormats: ['gemini:generate_content', 'gemini:embedding', 'claude:messages'],
|
||||
})
|
||||
await settle()
|
||||
|
||||
expect(root.textContent).toContain('Gemini Embedding')
|
||||
|
||||
const serviceAccountOption = root.querySelector<HTMLButtonElement>('[data-select-item="service_account"]')
|
||||
expect(serviceAccountOption).not.toBeNull()
|
||||
serviceAccountOption?.click()
|
||||
await settle()
|
||||
|
||||
expect(root.textContent).toContain('Gemini Embedding')
|
||||
})
|
||||
|
||||
it('hydrates and serializes a positive concurrent_limit number from the normal key form', async () => {
|
||||
const root = mountDialog(KeyFormDialog, {
|
||||
open: true,
|
||||
|
||||
Reference in New Issue
Block a user