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
d61524be
authored
Dec 20, 2024
by
Calcium-Ion
Committed by
GitHub
Dec 20, 2024
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #642 from MartialBE/fix_gemini_thinking
fix: 修复gemini thinking在stream下会内容丢失
parents
1dfdb44d
8504023d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
relay/channel/gemini/relay-gemini.go
+7
-3
No files found.
relay/channel/gemini/relay-gemini.go
View file @
d61524be
...
...
@@ -236,13 +236,17 @@ func streamResponseGeminiChat2OpenAI(geminiResponse *GeminiChatResponse) *dto.Ch
var
choice
dto
.
ChatCompletionsStreamResponseChoice
//choice.Delta.SetContentString(geminiResponse.GetResponseText())
if
len
(
geminiResponse
.
Candidates
)
>
0
&&
len
(
geminiResponse
.
Candidates
[
0
]
.
Content
.
Parts
)
>
0
{
respFirst
:=
geminiResponse
.
Candidates
[
0
]
.
Content
.
Parts
[
0
]
if
respFirst
.
FunctionCall
!=
nil
{
respFirst
Parts
:=
geminiResponse
.
Candidates
[
0
]
.
Content
.
Parts
if
respFirst
Parts
[
0
]
.
FunctionCall
!=
nil
{
// function response
choice
.
Delta
.
ToolCalls
=
getToolCalls
(
&
geminiResponse
.
Candidates
[
0
])
}
else
{
// text response
choice
.
Delta
.
SetContentString
(
respFirst
.
Text
)
var
texts
[]
string
for
_
,
part
:=
range
respFirstParts
{
texts
=
append
(
texts
,
part
.
Text
)
}
choice
.
Delta
.
SetContentString
(
strings
.
Join
(
texts
,
"
\n
"
))
}
}
var
response
dto
.
ChatCompletionsStreamResponse
...
...
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