Fix type check for 'thinking' in message content (#2964)
* Fix type check for 'thinking' in message content When Gemini via Vertex AI returns content as a string inside an array, the in operator throws TypeError because it can't be used on primitives. * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Zil6n <136249885+Zil6n@users.noreply.github.com> Co-authored-by: Willem Jiang <willem.jiang@gmail.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -251,7 +251,7 @@ export function extractReasoningContentFromMessage(message: Message) {
|
|||||||
}
|
}
|
||||||
if (Array.isArray(message.content)) {
|
if (Array.isArray(message.content)) {
|
||||||
const part = message.content[0];
|
const part = message.content[0];
|
||||||
if (part && "thinking" in part) {
|
if (part && typeof part === "object" && "thinking" in part) {
|
||||||
return part.thinking as string;
|
return part.thinking as string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user