mirror of https://github.com/buster-so/buster.git
Enhance tool result conversion by validating toolCallId
- Added checks to ensure toolCallId exists and is a valid string before processing tool results. - Preserves the original part if toolCallId is missing or invalid, improving robustness in message conversion.
This commit is contained in:
parent
980a786d21
commit
7b9afdbb2f
|
@ -167,6 +167,12 @@ function convertToolResultPart(part: unknown): unknown {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure toolCallId exists and is valid
|
||||||
|
// If it's missing or invalid, preserve the original part
|
||||||
|
if (!rest.toolCallId || typeof rest.toolCallId !== 'string') {
|
||||||
|
return part;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...rest,
|
...rest,
|
||||||
output,
|
output,
|
||||||
|
|
|
@ -166,6 +166,12 @@ function convertToolResultPart(part: unknown): unknown {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure toolCallId exists and is valid
|
||||||
|
// If it's missing or invalid, preserve the original part
|
||||||
|
if (!rest.toolCallId || typeof rest.toolCallId !== 'string') {
|
||||||
|
return part;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...rest,
|
...rest,
|
||||||
output,
|
output,
|
||||||
|
|
Loading…
Reference in New Issue