Fix noise in headless mode on STDOUT (#1184)

This commit is contained in:
Allen Hutchison
2025-06-18 11:40:15 -07:00
committed by GitHub
parent 589a7b59c6
commit fbc79c34c9
4 changed files with 9 additions and 2 deletions

View File

@@ -27,6 +27,11 @@ function getResponseText(response: GenerateContentResponse): string | null {
candidate.content.parts &&
candidate.content.parts.length > 0
) {
// We are running in headless mode so we don't need to return thoughts to STDOUT.
const thoughtPart = candidate.content.parts[0];
if (thoughtPart?.thought) {
return null;
}
return candidate.content.parts
.filter((part) => part.text)
.map((part) => part.text)