Google Imagen: Add personGeneration setting to config.yaml

This commit is contained in:
Cohee
2025-11-28 00:26:31 +02:00
parent 0a22856faf
commit 2b7003a6da
2 changed files with 7 additions and 1 deletions
+4
View File
@@ -287,6 +287,10 @@ claude:
gemini:
# API endpoint version ("v1beta" or "v1alpha")
apiVersion: 'v1beta'
# https://ai.google.dev/gemini-api/docs/imagen#imagen-configuration
image:
# Leave empty to use the API-default value.
personGeneration: 'allow_adult'
# -- SERVER PLUGIN CONFIGURATION --
enableServerPlugins: false
# Attempt to automatically update server plugins on startup
+3 -1
View File
@@ -438,6 +438,8 @@ router.post('/generate-image', async (request, response) => {
const isVertex = request.body.api === 'vertexai';
// Is it even worth it?
const isDeprecated = model.startsWith('imagegeneration');
// Get person generation setting from config
const personGeneration = getConfigValue('gemini.image.personGeneration', 'allow_adult');
const requestBody = {
instances: [{
@@ -449,7 +451,7 @@ router.post('/generate-image', async (request, response) => {
enhancePrompt: isVertex ? Boolean(request.body.enhance ?? false) : undefined,
negativePrompt: isVertex ? (request.body.negative_prompt || undefined) : undefined,
aspectRatio: String(request.body.aspect_ratio || '1:1'),
personGeneration: !isDeprecated ? 'allow_adult' : undefined,
personGeneration: !isDeprecated && personGeneration ? personGeneration : undefined,
language: isVertex ? 'auto' : undefined,
safetySetting: !isDeprecated ? (isVertex ? 'block_only_high' : 'block_low_and_above') : undefined,
addWatermark: isVertex ? false : undefined,