feat(translator): Add support for openrouter image_config

This commit is contained in:
hkfires
2025-10-09 15:47:06 +08:00
parent c5d7137d66
commit a602ae859b
3 changed files with 23 additions and 0 deletions

View File

@@ -268,5 +268,12 @@ func ConvertOpenAIResponsesRequestToGemini(modelName string, inputRawJSON []byte
out, _ = sjson.SetRaw(out, "generationConfig.imageConfig", imgCfg.Raw)
}
// OpenRouter-style image_config (snake_case) support at top-level
if imgCfg := root.Get("image_config"); imgCfg.Exists() && imgCfg.IsObject() {
if ar := imgCfg.Get("aspect_ratio"); ar.Exists() && ar.Type == gjson.String {
out, _ = sjson.Set(out, "generationConfig.imageConfig.aspectRatio", ar.String())
}
}
return []byte(out)
}