Google: Fix image generation on deprecated models

560526586258522188e9eec8eb0d13463dd80aaa

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +4 -2Showing whitespace changes
src/endpoints/google.js+4 -2
@@ -426,6 +426,8 @@ router.post('/generate-image', async (request, response) => {
426426
427427 // AI Studio is stricter than Vertex AI.
428428 const isVertex = request.body.api === 'vertexai';
429+ // Is it even worth it?
430+ const isDeprecated = model.startsWith('imagegeneration');
429431
430432 const requestBody = {
431433 instances: [{
@@ -437,9 +439,9 @@ router.post('/generate-image', async (request, response) => {
437439 enhancePrompt: isVertex ? Boolean(request.body.enhance ?? false) : undefined,
438440 negativePrompt: isVertex ? (request.body.negative_prompt || undefined) : undefined,
439441 aspectRatio: String(request.body.aspect_ratio || '1:1'),
440442 personGeneration: !isDeprecated ? 'allow_all' : undefined,
441443 language: isVertex ? 'auto' : undefined,
442444 safetySetting: !isDeprecated ? (isVertex ? 'block_only_high' : 'block_low_and_above') : undefined,
443445 addWatermark: isVertex ? false : undefined,
444446 outputOptions: {
445447 mimeType: 'image/jpeg',