Harded code assist converter. (#18656)

This commit is contained in:
Jacob Richman
2026-02-09 12:45:55 -08:00
committed by GitHub
parent 08dca3e1d6
commit 07056c8f16
2 changed files with 17 additions and 3 deletions
+7 -3
View File
@@ -133,14 +133,18 @@ export function toGenerateContentRequest(
export function fromGenerateContentResponse(
res: CaGenerateContentResponse,
): GenerateContentResponse {
const inres = res.response;
const out = new GenerateContentResponse();
out.candidates = inres.candidates;
out.responseId = res.traceId;
const inres = res.response;
if (!inres) {
out.candidates = [];
return out;
}
out.candidates = inres.candidates ?? [];
out.automaticFunctionCallingHistory = inres.automaticFunctionCallingHistory;
out.promptFeedback = inres.promptFeedback;
out.usageMetadata = inres.usageMetadata;
out.modelVersion = inres.modelVersion;
out.responseId = res.traceId;
return out;
}