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
efd4a46a
authored
May 31, 2025
by
xqx121
Committed by
GitHub
May 31, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: Gemini2.5pro ThinkingConfig
parent
ac9df0c1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
relay/channel/gemini/relay-gemini.go
+7
-0
No files found.
relay/channel/gemini/relay-gemini.go
View file @
efd4a46a
...
...
@@ -40,6 +40,12 @@ func CovertGemini2OpenAI(textRequest dto.GeneralOpenAIRequest, info *relaycommon
if
model_setting
.
GetGeminiSettings
()
.
ThinkingAdapterEnabled
{
if
strings
.
HasSuffix
(
info
.
OriginModelName
,
"-thinking"
)
{
// 如果模型名以 gemini-2.5-pro 开头,不设置 ThinkingBudget
if
strings
.
HasPrefix
(
info
.
OriginModelName
,
"gemini-2.5-pro"
)
{
geminiRequest
.
GenerationConfig
.
ThinkingConfig
=
&
GeminiThinkingConfig
{
IncludeThoughts
:
true
,
}
}
else
{
budgetTokens
:=
model_setting
.
GetGeminiSettings
()
.
ThinkingAdapterBudgetTokensPercentage
*
float64
(
geminiRequest
.
GenerationConfig
.
MaxOutputTokens
)
if
budgetTokens
==
0
||
budgetTokens
>
24576
{
budgetTokens
=
24576
...
...
@@ -48,6 +54,7 @@ func CovertGemini2OpenAI(textRequest dto.GeneralOpenAIRequest, info *relaycommon
ThinkingBudget
:
common
.
GetPointer
(
int
(
budgetTokens
)),
IncludeThoughts
:
true
,
}
}
}
else
if
strings
.
HasSuffix
(
info
.
OriginModelName
,
"-nothinking"
)
{
geminiRequest
.
GenerationConfig
.
ThinkingConfig
=
&
GeminiThinkingConfig
{
ThinkingBudget
:
common
.
GetPointer
(
0
),
...
...
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