feat: imagen for vertex channel

This commit is contained in:
Sh1n3zZ
2025-08-18 21:49:28 +08:00
parent f6d4c586eb
commit 974b93a8be
2 changed files with 71 additions and 10 deletions

View File

@@ -59,15 +59,22 @@ func (a *Adaptor) ConvertImageRequest(c *gin.Context, info *relaycommon.RelayInf
return nil, errors.New("not supported model for image generation")
}
// convert size to aspect ratio
// convert size to aspect ratio but allow user to specify aspect ratio
aspectRatio := "1:1" // default aspect ratio
switch request.Size {
case "1024x1024":
aspectRatio = "1:1"
case "1024x1792":
aspectRatio = "9:16"
case "1792x1024":
aspectRatio = "16:9"
size := strings.TrimSpace(request.Size)
if size != "" {
if strings.Contains(size, ":") {
aspectRatio = size
} else {
switch size {
case "1024x1024":
aspectRatio = "1:1"
case "1024x1792":
aspectRatio = "9:16"
case "1792x1024":
aspectRatio = "16:9"
}
}
}
// build gemini imagen request