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
115c8539
authored
Apr 15, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: claude parallel function calling
parent
effa523a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
relay/channel/claude/relay-claude.go
+9
-2
No files found.
relay/channel/claude/relay-claude.go
View file @
115c8539
...
@@ -300,6 +300,13 @@ func StreamResponseClaude2OpenAI(reqMode int, claudeResponse *dto.ClaudeResponse
...
@@ -300,6 +300,13 @@ func StreamResponseClaude2OpenAI(reqMode int, claudeResponse *dto.ClaudeResponse
response
.
Model
=
claudeResponse
.
Model
response
.
Model
=
claudeResponse
.
Model
response
.
Choices
=
make
([]
dto
.
ChatCompletionsStreamResponseChoice
,
0
)
response
.
Choices
=
make
([]
dto
.
ChatCompletionsStreamResponseChoice
,
0
)
tools
:=
make
([]
dto
.
ToolCallResponse
,
0
)
tools
:=
make
([]
dto
.
ToolCallResponse
,
0
)
fcIdx
:=
0
if
claudeResponse
.
Index
!=
nil
{
fcIdx
=
*
claudeResponse
.
Index
-
1
if
fcIdx
<
0
{
fcIdx
=
0
}
}
var
choice
dto
.
ChatCompletionsStreamResponseChoice
var
choice
dto
.
ChatCompletionsStreamResponseChoice
if
reqMode
==
RequestModeCompletion
{
if
reqMode
==
RequestModeCompletion
{
choice
.
Delta
.
SetContentString
(
claudeResponse
.
Completion
)
choice
.
Delta
.
SetContentString
(
claudeResponse
.
Completion
)
...
@@ -319,7 +326,7 @@ func StreamResponseClaude2OpenAI(reqMode int, claudeResponse *dto.ClaudeResponse
...
@@ -319,7 +326,7 @@ func StreamResponseClaude2OpenAI(reqMode int, claudeResponse *dto.ClaudeResponse
//choice.Delta.SetContentString(claudeResponse.ContentBlock.Text)
//choice.Delta.SetContentString(claudeResponse.ContentBlock.Text)
if
claudeResponse
.
ContentBlock
.
Type
==
"tool_use"
{
if
claudeResponse
.
ContentBlock
.
Type
==
"tool_use"
{
tools
=
append
(
tools
,
dto
.
ToolCallResponse
{
tools
=
append
(
tools
,
dto
.
ToolCallResponse
{
Index
:
common
.
GetPointer
(
0
),
Index
:
common
.
GetPointer
(
fcIdx
),
ID
:
claudeResponse
.
ContentBlock
.
Id
,
ID
:
claudeResponse
.
ContentBlock
.
Id
,
Type
:
"function"
,
Type
:
"function"
,
Function
:
dto
.
FunctionResponse
{
Function
:
dto
.
FunctionResponse
{
...
@@ -338,7 +345,7 @@ func StreamResponseClaude2OpenAI(reqMode int, claudeResponse *dto.ClaudeResponse
...
@@ -338,7 +345,7 @@ func StreamResponseClaude2OpenAI(reqMode int, claudeResponse *dto.ClaudeResponse
case
"input_json_delta"
:
case
"input_json_delta"
:
tools
=
append
(
tools
,
dto
.
ToolCallResponse
{
tools
=
append
(
tools
,
dto
.
ToolCallResponse
{
Type
:
"function"
,
Type
:
"function"
,
Index
:
common
.
GetPointer
(
0
),
Index
:
common
.
GetPointer
(
fcIdx
),
Function
:
dto
.
FunctionResponse
{
Function
:
dto
.
FunctionResponse
{
Arguments
:
*
claudeResponse
.
Delta
.
PartialJson
,
Arguments
:
*
claudeResponse
.
Delta
.
PartialJson
,
},
},
...
...
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