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 +1 -1
- package/types/modeloutput.js +13 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gemini-reverse",
|
|
3
|
-
"version": "1.0.
|
|
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",
|
package/types/modeloutput.js
CHANGED
|
@@ -1,39 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
this.
|
|
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(/</g, '<')
|
|
21
|
-
.replace(/>/g, '>')
|
|
22
|
-
.replace(/"/g, '"')
|
|
23
|
-
.replace(/'/g, '\'')
|
|
24
|
-
.replace(/'/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
|
|
28
|
-
|
|
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
|
-
|
|
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 = {
|
|
24
|
+
module.exports = { ModelOutput };
|