Unfortunately, respect the censorship

This commit is contained in:
buzz-lightsnack-2007 2024-05-01 17:59:37 +08:00
parent 2d6c571042
commit ec53a7c1ee

View file

@ -145,10 +145,14 @@ export default class gemini {
let analyze = (RESPONSE_RAW) => {
let RESPONSES = [];
// Check if the prompt has been blocked.
while (RESPONSES.length < RESPONSE_RAW[`candidates`].length) {
// Delete previous block state, if any.
delete this.blocked;
while (RESPONSES.length < RESPONSE_RAW[`candidates`].length && !this.blocked) {
this.blocked = RESPONSE_RAW[`candidates`][RESPONSES.length][`safetyRatings`][`blocked`];
// Check if the response is blocked.
if (!RESPONSE_RAW[`candidates`][RESPONSES.length][`safetyRatings`][`blocked`] && RESPONSE_RAW[`candidates`][RESPONSES.length][`content`]) {
if (!this.blocked && RESPONSE_RAW[`candidates`][RESPONSES.length][`content`]) {
let RESPONSE_CURRENT = [];
let RESPONSES_RAW_ALL = RESPONSE_RAW[`candidates`][RESPONSES.length][`content`][`parts`];