Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Generate text and images via the reverse-engineered Gemini Web API with multi-turn conversation support.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
scripts/gemini-webapi/types/candidate.ts
1import { GeneratedImage, type Image, WebImage } from './image.js';23function decode_html(s: string | null | undefined): string | null | undefined {4if (s == null) return s;5return s6.replace(/&/g, '&')7.replace(/</g, '<')8.replace(/>/g, '>')9.replace(/"/g, '"')10.replace(/'/g, "'")11.replace(/'/g, "'")12.replace(/ /g, ' ')13.replace(/&#x([0-9a-fA-F]+);/g, (_, hex) => String.fromCodePoint(parseInt(hex, 16)))14.replace(/&#(\d+);/g, (_, dec) => String.fromCodePoint(parseInt(dec, 10)));15}1617export class Candidate {18public rcid: string;19public text: string;20public thoughts: string | null;21public web_images: WebImage[];22public generated_images: GeneratedImage[];2324constructor(params: {25rcid: string;26text: string;27thoughts?: string | null;28web_images?: WebImage[];29generated_images?: GeneratedImage[];30}) {31this.rcid = params.rcid;32this.text = decode_html(params.text) ?? '';33this.thoughts = decode_html(params.thoughts) ?? null;34this.web_images = params.web_images ?? [];35this.generated_images = params.generated_images ?? [];36}3738toString(): string {39return this.text;40}4142get images(): Image[] {43return [...this.web_images, ...this.generated_images];44}45}46