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:
pereverzev
2026-05-16 12:55:34 +03:00
committed by GitHub
parent 6d611c2bf6
commit 4538c32298
+1 -1
View File
@@ -251,7 +251,7 @@ export function extractReasoningContentFromMessage(message: Message) {
}
if (Array.isArray(message.content)) {
const part = message.content[0];
if (part && "thinking" in part) {
if (part && typeof part === "object" && "thinking" in part) {
return part.thinking as string;
}
}