halbot 1990.1.31 → 1990.1.33
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/index.mjs +9 -2
- package/package.json +3 -2
- package/skills/prepare.mjs +1 -2
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bot, hal, shot, speech, utilitas } from 'utilitas';
|
|
1
|
+
import { bot, hal, shot, speech, utilitas, vision } from 'utilitas';
|
|
2
2
|
import { parse } from 'csv-parse/sync';
|
|
3
3
|
|
|
4
4
|
await utilitas.locate(utilitas.__(import.meta.url, 'package.json'));
|
|
@@ -31,9 +31,15 @@ const init = async (options) => {
|
|
|
31
31
|
assert(options?.telegramToken, 'Telegram Bot API Token is required.');
|
|
32
32
|
const [pkg, ai, _speech] = [await utilitas.which(), {}, {}];
|
|
33
33
|
const info = bot.lines([`[${bot.EMOJI_BOT} ${pkg.title}](${pkg.homepage})`, pkg.description]);
|
|
34
|
+
let _vision;
|
|
34
35
|
if (options?.googleApiKey) {
|
|
35
|
-
|
|
36
|
+
const apiKey = { apiKey: options?.googleApiKey };
|
|
37
|
+
await Promise.all([
|
|
38
|
+
speech.init({ ...apiKey, tts: true, stt: true }),
|
|
39
|
+
vision.init(apiKey),
|
|
40
|
+
]);
|
|
36
41
|
Object.assign(_speech, { stt: speech.stt, tts: speech.tts });
|
|
42
|
+
_vision = vision;
|
|
37
43
|
}
|
|
38
44
|
if (options?.chatGptKey) {
|
|
39
45
|
ai['ChatGPT'] = await hal.init({
|
|
@@ -62,6 +68,7 @@ const init = async (options) => {
|
|
|
62
68
|
session: options?.session,
|
|
63
69
|
skillPath: options?.skillPath || skillPath,
|
|
64
70
|
speech: _speech,
|
|
71
|
+
vision: _vision,
|
|
65
72
|
});
|
|
66
73
|
_bot._.lang = options?.lang || 'English';
|
|
67
74
|
_bot._.prompts = await fetchPrompts();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "halbot",
|
|
3
3
|
"description": "Just another ChatGPT/Bing Chat Telegram bob, which is simple design, easy to use, extendable and fun.",
|
|
4
|
-
"version": "1990.1.
|
|
4
|
+
"version": "1990.1.33",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://github.com/Leask/halbot",
|
|
7
7
|
"type": "module",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@google-cloud/speech": "^5.4.0",
|
|
33
33
|
"@google-cloud/text-to-speech": "^4.2.1",
|
|
34
|
+
"@google-cloud/vision": "^3.1.2",
|
|
34
35
|
"@mozilla/readability": "^0.4.4",
|
|
35
36
|
"@waylaidwanderer/chatgpt-api": "^1.34.0",
|
|
36
37
|
"csv-parse": "^5.3.6",
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
"jsdom": "^21.1.1",
|
|
39
40
|
"mysql2": "^3.2.0",
|
|
40
41
|
"telegraf": "^4.12.2",
|
|
41
|
-
"utilitas": "^1993.3.
|
|
42
|
+
"utilitas": "^1993.3.25",
|
|
42
43
|
"youtube-transcript": "^1.0.5"
|
|
43
44
|
}
|
|
44
45
|
}
|
package/skills/prepare.mjs
CHANGED
|
@@ -19,11 +19,10 @@ const action = async (ctx, next) => {
|
|
|
19
19
|
ctx.avatar = '😸';
|
|
20
20
|
}
|
|
21
21
|
// prompt
|
|
22
|
-
console.log(ctx.collected);
|
|
23
22
|
const additionInfo = ctx.collected.length ? ctx.collected.map(
|
|
24
23
|
x => x.content
|
|
25
24
|
).join('\n').split(' ') : [];
|
|
26
|
-
ctx.text
|
|
25
|
+
ctx.text = (ctx.text || '') + '\n\n';
|
|
27
26
|
while (countTokens(ctx.text) < 2250 && additionInfo.length) {
|
|
28
27
|
ctx.text += ` ${additionInfo.shift()}`;
|
|
29
28
|
}
|