| 498 | const responseContent = candidates[0].content ?? candidates[0].output; | 499 | const responseContent = candidates[0].content ?? candidates[0].output; |
| 499 | const functionCall = (candidates?.[0]?.content?.parts ?? []).some(part => part.functionCall); | 500 | const functionCall = (candidates?.[0]?.content?.parts ?? []).some(part => part.functionCall); |
| 500 | const inlineData = (candidates?.[0]?.content?.parts ?? []).some(part => part.inlineData); | 501 | const inlineData = (candidates?.[0]?.content?.parts ?? []).some(part => part.inlineData); |
| 501 | console.warn('Google AI Studio response:', responseContent); | 502 | console.warn('Google AI Studio response:', util.inspect(generateResponseJson, {depth: 6, colors: true})); |
| 502 | | 503 | |
| 503 | const responseText = typeof responseContent === 'string' ? responseContent : responseContent?.parts?.filter(part => !part.thought)?.map(part => part.text)?.join('\n\n'); | 504 | const responseText = typeof responseContent === 'string' ? responseContent : responseContent?.parts?.filter(part => !part.thought)?.map(part => part.text)?.join('\n\n'); |
| 504 | if (!responseText && !functionCall && !inlineData) { | 505 | if (!responseText && !functionCall && !inlineData) { |