gemini-reverse 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemini-reverse",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Unofficial Node.js client for gemini.google.com — inspired by Gemini-API (Python). Supports streaming, chat sessions, gems, file uploads, and TypeScript.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,39 +1,24 @@
1
1
  'use strict';
2
2
 
3
- const { WebImage, GeneratedImage } = require('./image');
4
-
5
- class Candidate {
6
- constructor({ rcid, text, text_delta = null, thoughts = null, thoughts_delta = null, web_images = [], generated_images = [] } = {}) {
7
- this.rcid = rcid;
8
- this.text = this._decodeHtml(text);
9
- this.text_delta = text_delta;
10
- this.thoughts = thoughts ? this._decodeHtml(thoughts) : null;
11
- this.thoughts_delta = thoughts_delta;
12
- this.web_images = web_images;
13
- this.generated_images = generated_images;
14
- }
15
-
16
- _decodeHtml(str) {
17
- if (!str) return str;
18
- return str
19
- .replace(/&/g, '&')
20
- .replace(/&lt;/g, '<')
21
- .replace(/&gt;/g, '>')
22
- .replace(/&quot;/g, '"')
23
- .replace(/&#39;/g, '\'')
24
- .replace(/&apos;/g, '\'');
3
+ class ModelOutput {
4
+ constructor(metadata, candidates, chosen = 0) {
5
+ this.metadata = metadata;
6
+ this.candidates = candidates;
7
+ this.chosen = chosen;
25
8
  }
26
9
 
27
- get images() {
28
- return [...this.web_images, ...this.generated_images];
29
- }
10
+ get text() { return this.candidates[this.chosen].text; }
11
+ get text_delta() { return this.candidates[this.chosen].text_delta || ''; }
12
+ get thoughts() { return this.candidates[this.chosen].thoughts; }
13
+ get thoughts_delta() { return this.candidates[this.chosen].thoughts_delta || ''; }
14
+ get images() { return this.candidates[this.chosen].images; }
15
+ get rcid() { return this.candidates[this.chosen].rcid; }
30
16
 
31
17
  toString() { return this.text; }
32
18
 
33
19
  repr() {
34
- const preview = this.text.length <= 20 ? this.text : this.text.slice(0, 20) + '...';
35
- return `Candidate(rcid='${this.rcid}', text='${preview}', images=${this.images.length})`;
20
+ return `ModelOutput(metadata=${JSON.stringify(this.metadata)}, chosen=${this.chosen}, candidates=${this.candidates.length})`;
36
21
  }
37
22
  }
38
23
 
39
- module.exports = { Candidate };
24
+ module.exports = { ModelOutput };