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
49a0db1d
authored
Dec 28, 2024
by
Yan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: add index in the tool calls when chat by stream (gemini)
parent
46fcb691
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletions
+5
-1
dto/openai_response.go
+4
-0
relay/channel/gemini/relay-gemini.go
+1
-1
No files found.
dto/openai_response.go
View file @
49a0db1d
...
...
@@ -86,6 +86,10 @@ type ToolCall struct {
Function
FunctionCall
`json:"function"`
}
func
(
c
*
ToolCall
)
SetIndex
(
i
int
)
{
c
.
Index
=
&
i
}
type
FunctionCall
struct
{
Description
string
`json:"description,omitempty"`
Name
string
`json:"name,omitempty"`
...
...
relay/channel/gemini/relay-gemini.go
View file @
49a0db1d
...
...
@@ -370,7 +370,6 @@ func responseGeminiChat2OpenAI(response *GeminiChatResponse) *dto.OpenAITextResp
choice
.
Message
.
SetToolCalls
(
tool_calls
)
is_tool_call
=
true
}
// 过滤掉空行
choice
.
Message
.
SetStringContent
(
strings
.
Join
(
texts
,
"
\n
"
))
...
...
@@ -425,6 +424,7 @@ func streamResponseGeminiChat2OpenAI(geminiResponse *GeminiChatResponse) (*dto.C
if
part
.
FunctionCall
!=
nil
{
isTools
=
true
if
call
:=
getToolCall
(
&
part
);
call
!=
nil
{
call
.
SetIndex
(
len
(
choice
.
Delta
.
ToolCalls
))
choice
.
Delta
.
ToolCalls
=
append
(
choice
.
Delta
.
ToolCalls
,
*
call
)
}
}
else
{
...
...
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