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
cf6c7748
authored
Nov 30, 2025
by
Seefs
Committed by
GitHub
Nov 30, 2025
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2330 from feitianbubu/pr/fix-nano-banana-err
fix: nano-banana not compatible imageSize
parents
e3fbbb91
39017810
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
relay/channel/gemini/adaptor.go
+7
-0
No files found.
relay/channel/gemini/adaptor.go
View file @
cf6c7748
...
@@ -6,6 +6,7 @@ import (
...
@@ -6,6 +6,7 @@ import (
"fmt"
"fmt"
"io"
"io"
"net/http"
"net/http"
"slices"
"strings"
"strings"
"github.com/QuantumNous/new-api/dto"
"github.com/QuantumNous/new-api/dto"
...
@@ -170,6 +171,12 @@ func (a *Adaptor) ConvertImageRequest(c *gin.Context, info *relaycommon.RelayInf
...
@@ -170,6 +171,12 @@ func (a *Adaptor) ConvertImageRequest(c *gin.Context, info *relaycommon.RelayInf
}
}
config
:=
processSizeParameters
(
strings
.
TrimSpace
(
request
.
Size
),
request
.
Quality
)
config
:=
processSizeParameters
(
strings
.
TrimSpace
(
request
.
Size
),
request
.
Quality
)
// 兼容 nano-banana 传quality[imageSize]会报错 An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting
if
slices
.
Contains
([]
string
{
"nano-banana"
,
"gemini-2.5-flash-image"
},
info
.
UpstreamModelName
)
{
config
.
ImageSize
=
""
}
googleGenerationConfig
:=
map
[
string
]
interface
{}{
googleGenerationConfig
:=
map
[
string
]
interface
{}{
"responseModalities"
:
[]
string
{
"TEXT"
,
"IMAGE"
},
"responseModalities"
:
[]
string
{
"TEXT"
,
"IMAGE"
},
"imageConfig"
:
config
,
"imageConfig"
:
config
,
...
...
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