File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
packages/orchestration/src/util Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -152,20 +152,19 @@ function mergeToolCalls(
152
152
}
153
153
const mergedToolCalls = [ ...existing ] ;
154
154
for ( const toolCall of incoming ) {
155
- const existingToolCall = mergedToolCalls . find (
156
- tc => tc . id === toolCall . id
157
- ) ;
155
+ const existingToolCall = mergedToolCalls . find ( tc => tc . id === toolCall . id ) ;
158
156
if ( existingToolCall ) {
159
157
// Merge existing tool call with incoming tool call
160
158
existingToolCall . id = toolCall . id ?? existingToolCall . id ;
161
159
existingToolCall . function . name =
162
160
toolCall . function ?. name ?? existingToolCall . function . name ;
163
161
existingToolCall . function . arguments =
164
- existingToolCall . function . arguments + ( toolCall . function ?. arguments ?? '' ) ;
162
+ existingToolCall . function . arguments +
163
+ ( toolCall . function ?. arguments ?? '' ) ;
165
164
} else {
166
165
// Add new tool call
167
- mergedToolCalls . push ( transformStreamingToolCall ( toolCall ) ) ;
168
- }
166
+ mergedToolCalls . push ( transformStreamingToolCall ( toolCall ) ) ;
167
+ }
169
168
}
170
169
return mergedToolCalls ;
171
170
}
@@ -209,9 +208,7 @@ function transformStreamingToolCalls(
209
208
return toolCalls ?. map ( toolCall => transformStreamingToolCall ( toolCall ) ) ;
210
209
}
211
210
212
- function transformStreamingToolCall (
213
- toolCall : ToolCallChunk
214
- ) : MessageToolCall {
211
+ function transformStreamingToolCall ( toolCall : ToolCallChunk ) : MessageToolCall {
215
212
return {
216
213
id : toolCall . id ?? '' ,
217
214
type : toolCall . type ?? 'function' ,
You can’t perform that action at this time.
0 commit comments