Merge pull request #3914 from cloak1505/google-patch

Print full Google response
This commit is contained in:
Cohee
2025-04-25 21:45:05 +03:00
committed by GitHub

View File

@@ -1,4 +1,5 @@
import process from 'node:process'; import process from 'node:process';
import util from 'node:util';
import express from 'express'; import express from 'express';
import fetch from 'node-fetch'; import fetch from 'node-fetch';
@@ -498,7 +499,7 @@ async function sendMakerSuiteRequest(request, response) {
const responseContent = candidates[0].content ?? candidates[0].output; const responseContent = candidates[0].content ?? candidates[0].output;
const functionCall = (candidates?.[0]?.content?.parts ?? []).some(part => part.functionCall); const functionCall = (candidates?.[0]?.content?.parts ?? []).some(part => part.functionCall);
const inlineData = (candidates?.[0]?.content?.parts ?? []).some(part => part.inlineData); const inlineData = (candidates?.[0]?.content?.parts ?? []).some(part => part.inlineData);
console.warn('Google AI Studio response:', responseContent); console.debug('Google AI Studio response:', util.inspect(generateResponseJson, { depth: 5, colors: true }));
const responseText = typeof responseContent === 'string' ? responseContent : responseContent?.parts?.filter(part => !part.thought)?.map(part => part.text)?.join('\n\n'); const responseText = typeof responseContent === 'string' ? responseContent : responseContent?.parts?.filter(part => !part.thought)?.map(part => part.text)?.join('\n\n');
if (!responseText && !functionCall && !inlineData) { if (!responseText && !functionCall && !inlineData) {