fix api config auth and image model compatibility
Some checks failed
Build & Push Docker Image / build-and-push (push) Has been cancelled

This commit is contained in:
2026-04-17 18:41:47 +08:00
parent 531de26d48
commit 022d581c60
9 changed files with 244 additions and 8 deletions

View File

@@ -118,6 +118,29 @@ describe('generator-api gateway routing', () => {
expect(result).toEqual({ success: true, imageUrl: 'compat-template-image' })
})
it('normalizes legacy openai-compatible gemini image model ids before template gateway call', async () => {
resolveModelSelectionMock.mockResolvedValueOnce({
provider: 'openai-compatible:oa-1',
modelId: 'gemini-3.1-flash-image',
modelKey: 'openai-compatible:oa-1::gemini-3.1-flash-image',
mediaType: 'image',
compatMediaTemplate: {
version: 1,
mediaType: 'image',
mode: 'sync',
create: { method: 'POST', path: '/v1/images/generations' },
response: { outputUrlPath: '$.data[0].url' },
},
})
resolveModelGatewayRouteMock.mockReturnValueOnce('openai-compat')
await generateImage('user-1', 'openai-compatible:oa-1::gemini-3.1-flash-image', 'draw hero')
expect(generateImageViaOpenAICompatTemplateMock).toHaveBeenCalledWith(expect.objectContaining({
modelId: 'gemini-3.1-flash-image-preview',
}))
})
it('routes official image requests to provider generator', async () => {
resolveModelSelectionMock.mockResolvedValueOnce({
provider: 'google',