halbot 1990.1.90 → 1990.1.92
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 +20 -14
- package/package.json +13 -12
package/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ const skillPath = utilitas.__(import.meta.url, 'skills');
|
|
|
7
7
|
|
|
8
8
|
const promptSource = new Set([
|
|
9
9
|
// 'https://raw.githubusercontent.com/f/awesome-chatgpt-prompts/main/prompts.csv',
|
|
10
|
-
'https://raw.githubusercontent.com/f/awesome-chatgpt-prompts/
|
|
10
|
+
'https://raw.githubusercontent.com/f/awesome-chatgpt-prompts/82f15563c9284c01ca54f0b915ae1aeda5a0fc3a/prompts.csv'
|
|
11
11
|
]);
|
|
12
12
|
|
|
13
13
|
const fetchPrompts = async () => {
|
|
@@ -29,20 +29,26 @@ const fetchPrompts = async () => {
|
|
|
29
29
|
|
|
30
30
|
const init = async (options) => {
|
|
31
31
|
assert(options?.telegramToken, 'Telegram Bot API Token is required.');
|
|
32
|
-
const [pkg, ai, _speech
|
|
33
|
-
|
|
32
|
+
const [pkg, ai, _speech, speechOptions]
|
|
33
|
+
= [await utilitas.which(), {}, {}, { tts: true, stt: true }];
|
|
34
|
+
const info = bot.lines([
|
|
35
|
+
`[${bot.EMOJI_BOT} ${pkg.title}](${pkg.homepage})`, pkg.description
|
|
36
|
+
]);
|
|
34
37
|
const cacheOptions = options?.storage ? { store: options.storage } : null;
|
|
35
|
-
if (options?.
|
|
36
|
-
const apiKey = { apiKey: options
|
|
37
|
-
await Promise.all([
|
|
38
|
-
speech.init({ ...apiKey, tts: true, stt: true }),
|
|
39
|
-
vision.init(apiKey),
|
|
40
|
-
]);
|
|
41
|
-
}
|
|
42
|
-
if (options?.chatGptKey) {
|
|
38
|
+
if (options?.openaiApiKey) {
|
|
39
|
+
const apiKey = { apiKey: options.openaiApiKey };
|
|
43
40
|
ai['ChatGPT'] = await hal.init({
|
|
44
|
-
provider: 'CHATGPT', clientOptions:
|
|
45
|
-
|
|
41
|
+
provider: 'CHATGPT', clientOptions: apiKey, cacheOptions,
|
|
42
|
+
});
|
|
43
|
+
await speech.init({
|
|
44
|
+
...apiKey, provider: 'OPENAI', ...speechOptions
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
if (options?.googleApiKey) {
|
|
48
|
+
const apiKey = { apiKey: options.googleApiKey };
|
|
49
|
+
await vision.init(apiKey);
|
|
50
|
+
options?.openaiApiKey || await speech.init({
|
|
51
|
+
...apiKey, provider: 'GOOGLE', ...speechOptions,
|
|
46
52
|
});
|
|
47
53
|
}
|
|
48
54
|
if (options?.bingToken) {
|
|
@@ -67,7 +73,7 @@ const init = async (options) => {
|
|
|
67
73
|
provider: 'telegram',
|
|
68
74
|
session: options?.storage,
|
|
69
75
|
skillPath: options?.skillPath || skillPath,
|
|
70
|
-
speech: options?.googleApiKey && speech,
|
|
76
|
+
speech: (options?.openaiApiKey || options?.googleApiKey) && speech,
|
|
71
77
|
vision: options?.googleApiKey && vision,
|
|
72
78
|
});
|
|
73
79
|
_bot._.ai = ai; // Should be an array of a map of AIs.
|
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.92",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://github.com/Leask/halbot",
|
|
7
7
|
"type": "module",
|
|
@@ -30,21 +30,22 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
|
33
|
-
"@ffprobe-installer/ffprobe": "^2.1.
|
|
34
|
-
"@google-cloud/speech": "^
|
|
35
|
-
"@google-cloud/text-to-speech": "^
|
|
36
|
-
"@google-cloud/vision": "^
|
|
33
|
+
"@ffprobe-installer/ffprobe": "^2.1.2",
|
|
34
|
+
"@google-cloud/speech": "^6.1.0",
|
|
35
|
+
"@google-cloud/text-to-speech": "^5.0.1",
|
|
36
|
+
"@google-cloud/vision": "^4.0.2",
|
|
37
37
|
"@mozilla/readability": "^0.4.4",
|
|
38
|
-
"@waylaidwanderer/chatgpt-api": "^1.37.
|
|
39
|
-
"csv-parse": "^5.
|
|
38
|
+
"@waylaidwanderer/chatgpt-api": "^1.37.3",
|
|
39
|
+
"csv-parse": "^5.5.2",
|
|
40
40
|
"fluent-ffmpeg": "^2.1.2",
|
|
41
41
|
"ioredis": "^5.3.2",
|
|
42
42
|
"jsdom": "^22.1.0",
|
|
43
|
-
"mysql2": "^3.
|
|
44
|
-
"office-text-extractor": "^3.0.
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
43
|
+
"mysql2": "^3.6.3",
|
|
44
|
+
"office-text-extractor": "^3.0.2",
|
|
45
|
+
"openai": "^4.17.3",
|
|
46
|
+
"telegraf": "^4.15.0",
|
|
47
|
+
"tesseract.js": "^5.0.3",
|
|
48
|
+
"utilitas": "^1995.1.11",
|
|
48
49
|
"youtube-transcript": "^1.0.6"
|
|
49
50
|
}
|
|
50
51
|
}
|