Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2fb1fa08
authored
Nov 30, 2025
by
Seefs
Committed by
GitHub
Nov 30, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "fix: gemini image correct generationConfig"
parent
10543789
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
28 deletions
+5
-28
relay/channel/gemini/adaptor.go
+5
-18
relay/channel/gemini/relay-gemini.go
+0
-10
No files found.
relay/channel/gemini/adaptor.go
View file @
2fb1fa08
...
@@ -87,25 +87,12 @@ func getImageSizeMapping() QualityMapping {
...
@@ -87,25 +87,12 @@ func getImageSizeMapping() QualityMapping {
func
getSizeMappings
()
map
[
string
]
SizeMapping
{
func
getSizeMappings
()
map
[
string
]
SizeMapping
{
return
map
[
string
]
SizeMapping
{
return
map
[
string
]
SizeMapping
{
// Gemini 2.5 Flash Image - default 1K resolutions
"1024x1024"
:
{
AspectRatio
:
"1:1"
,
ImageSize
:
""
},
"832x1248"
:
{
AspectRatio
:
"2:3"
,
ImageSize
:
""
},
"1248x832"
:
{
AspectRatio
:
"3:2"
,
ImageSize
:
""
},
"864x1184"
:
{
AspectRatio
:
"3:4"
,
ImageSize
:
""
},
"1184x864"
:
{
AspectRatio
:
"4:3"
,
ImageSize
:
""
},
"896x1152"
:
{
AspectRatio
:
"4:5"
,
ImageSize
:
""
},
"1152x896"
:
{
AspectRatio
:
"5:4"
,
ImageSize
:
""
},
"768x1344"
:
{
AspectRatio
:
"9:16"
,
ImageSize
:
""
},
"1344x768"
:
{
AspectRatio
:
"16:9"
,
ImageSize
:
""
},
"1536x672"
:
{
AspectRatio
:
"21:9"
,
ImageSize
:
""
},
// Gemini 3 Pro Image Preview resolutions
"1536x1024"
:
{
AspectRatio
:
"3:2"
,
ImageSize
:
""
},
"1536x1024"
:
{
AspectRatio
:
"3:2"
,
ImageSize
:
""
},
"1024x1536"
:
{
AspectRatio
:
"2:3"
,
ImageSize
:
""
},
"1024x1536"
:
{
AspectRatio
:
"2:3"
,
ImageSize
:
""
},
"1024x1792"
:
{
AspectRatio
:
"9:16"
,
ImageSize
:
""
},
"1024x1792"
:
{
AspectRatio
:
"9:16"
,
ImageSize
:
""
},
"1792x1024"
:
{
AspectRatio
:
"16:9"
,
ImageSize
:
""
},
"1792x1024"
:
{
AspectRatio
:
"16:9"
,
ImageSize
:
""
},
"2048x2048"
:
{
AspectRatio
:
"
1:1
"
,
ImageSize
:
"2K"
},
"2048x2048"
:
{
AspectRatio
:
""
,
ImageSize
:
"2K"
},
"4096x4096"
:
{
AspectRatio
:
"
1:1
"
,
ImageSize
:
"4K"
},
"4096x4096"
:
{
AspectRatio
:
""
,
ImageSize
:
"4K"
},
}
}
}
}
...
@@ -178,13 +165,13 @@ func (a *Adaptor) ConvertImageRequest(c *gin.Context, info *relaycommon.RelayInf
...
@@ -178,13 +165,13 @@ func (a *Adaptor) ConvertImageRequest(c *gin.Context, info *relaycommon.RelayInf
}
}
googleGenerationConfig
:=
map
[
string
]
interface
{}{
googleGenerationConfig
:=
map
[
string
]
interface
{}{
"response
M
odalities"
:
[]
string
{
"TEXT"
,
"IMAGE"
},
"response
_m
odalities"
:
[]
string
{
"TEXT"
,
"IMAGE"
},
"image
C
onfig"
:
config
,
"image
_c
onfig"
:
config
,
}
}
extraBody
:=
map
[
string
]
interface
{}{
extraBody
:=
map
[
string
]
interface
{}{
"google"
:
map
[
string
]
interface
{}{
"google"
:
map
[
string
]
interface
{}{
"generation
C
onfig"
:
googleGenerationConfig
,
"generation
_c
onfig"
:
googleGenerationConfig
,
},
},
}
}
chatRequest
.
ExtraBody
,
_
=
json
.
Marshal
(
extraBody
)
chatRequest
.
ExtraBody
,
_
=
json
.
Marshal
(
extraBody
)
...
...
relay/channel/gemini/relay-gemini.go
View file @
2fb1fa08
...
@@ -239,16 +239,6 @@ func CovertOpenAI2Gemini(c *gin.Context, textRequest dto.GeneralOpenAIRequest, i
...
@@ -239,16 +239,6 @@ func CovertOpenAI2Gemini(c *gin.Context, textRequest dto.GeneralOpenAIRequest, i
}
}
}
}
}
}
if
generationConfig
,
ok
:=
googleBody
[
"generationConfig"
]
.
(
map
[
string
]
any
);
ok
{
generationConfigBytes
,
err
:=
json
.
Marshal
(
generationConfig
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to marshal generationConfig: %w"
,
err
)
}
if
err
:=
json
.
Unmarshal
(
generationConfigBytes
,
&
geminiRequest
.
GenerationConfig
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to unmarshal generationConfig: %w"
,
err
)
}
}
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment