MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / extractGeminiText

Function extractGeminiText

out/cli.cjs:79738–79753  ·  view source on GitHub ↗
(response)

Source from the content-addressed store, hash-verified

79736 return promptFeedback.blockReasonMessage ? `Gemini response was blocked due to ${promptFeedback.blockReason}: ${promptFeedback.blockReasonMessage}` : `Gemini response was blocked due to ${promptFeedback.blockReason}`;
79737 }
79738 const firstCandidate = response.candidates?.[0];
79739 if (firstCandidate?.finishReason) {
79740 return firstCandidate.finishMessage ? `Gemini response was blocked due to ${firstCandidate.finishReason}: ${firstCandidate.finishMessage}` : `Gemini response was blocked due to ${firstCandidate.finishReason}`;
79741 }
79742 return "Gemini response did not contain usable text";
79743};
79744var extractGeminiText = (response) => {
79745 const firstCandidate = response.candidates?.[0];
79746 if (firstCandidate?.finishReason && GEMINI_BLOCKING_FINISH_REASONS.has(firstCandidate.finishReason)) {
79747 throw new Error(formatGeminiBlockMessage(response));
79748 }
79749 const text = firstCandidate?.content?.parts?.flatMap(
79750 (part) => "text" in part && typeof part.text === "string" ? [part.text] : []
79751 ).join("");
79752 if (typeof text === "string" && text.length > 0) {
79753 return text;
79754 }
79755 if (response.promptFeedback?.blockReason) {
79756 throw new Error(formatGeminiBlockMessage(response));

Callers 1

generateCommitMessageMethod · 0.70

Calls 2

formatGeminiBlockMessageFunction · 0.70
hasMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…