halbot 1993.2.4 → 1993.2.6
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 +3 -3
- package/skills/10_engine.mjs +12 -0
- package/skills/30_wording.mjs +1 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "halbot",
|
|
3
3
|
"description": "Just another `ChatGPT` / `Gemini` / `Mistral (by ollama)` Telegram bob, which is simple design, easy to use, extendable and fun.",
|
|
4
|
-
"version": "1993.2.
|
|
4
|
+
"version": "1993.2.6",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://github.com/Leask/halbot",
|
|
7
7
|
"type": "module",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"pg": "^8.13.1",
|
|
52
52
|
"pgvector": "^0.2.0",
|
|
53
53
|
"telegraf": "^4.16.3",
|
|
54
|
-
"tesseract.js": "^
|
|
55
|
-
"utilitas": "^1998.1.
|
|
54
|
+
"tesseract.js": "^6.0.0",
|
|
55
|
+
"utilitas": "^1998.1.8",
|
|
56
56
|
"youtube-transcript": "^1.2.1"
|
|
57
57
|
}
|
|
58
58
|
}
|
package/skills/10_engine.mjs
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { alan, bot, utilitas } from 'utilitas';
|
|
2
2
|
|
|
3
|
+
const NAME_HACK = {
|
|
4
|
+
'ChatGPT': '⚛️', 'Gemini': '♊️', 'Claude': '✴️', 'Mistral': 'Ⓜ️',
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const NAME_HACK_REVERSE = utilitas.reverseKeyValues(NAME_HACK);
|
|
8
|
+
|
|
3
9
|
let configuredAi;
|
|
4
10
|
|
|
5
11
|
const action = async (ctx, next) => {
|
|
@@ -8,6 +14,11 @@ const action = async (ctx, next) => {
|
|
|
8
14
|
k => [k, ctx._.ai[k].priority]
|
|
9
15
|
).sort((x, y) => x[1] - y[1]);
|
|
10
16
|
ctx.firstAi = arrSort[0][0];
|
|
17
|
+
if (ctx.carry?.keyboards?.length) {
|
|
18
|
+
ctx.carry.keyboards.unshift(configuredAi.slice(0, 3).map(
|
|
19
|
+
x => ({ text: `/set --ai=${NAME_HACK[x] || x}` })
|
|
20
|
+
));
|
|
21
|
+
}
|
|
11
22
|
switch (ctx.session.config?.ai) {
|
|
12
23
|
case '@': ctx.selectedAi = configuredAi; break;
|
|
13
24
|
default:
|
|
@@ -49,6 +60,7 @@ const action = async (ctx, next) => {
|
|
|
49
60
|
|
|
50
61
|
const validateAi = val => {
|
|
51
62
|
assert(configuredAi, 'Preparing data for this option. Please try later.');
|
|
63
|
+
NAME_HACK_REVERSE[val] && (val = NAME_HACK_REVERSE[val]);
|
|
52
64
|
for (let name of [...configuredAi, '', '@']) {
|
|
53
65
|
if (utilitas.insensitiveCompare(val, name)) { return name; }
|
|
54
66
|
}
|
package/skills/30_wording.mjs
CHANGED
|
@@ -56,9 +56,7 @@ export const { name, run, priority, func, cmds, help } = {
|
|
|
56
56
|
'¶ Set your default language.',
|
|
57
57
|
'Example 1: /lang Français',
|
|
58
58
|
'¶ Prompt the AI engine to translate or polish your text.',
|
|
59
|
-
|
|
60
|
-
"If `config.lang` not found, the bot's default language is used.",
|
|
61
|
-
'If bot has no default language, English is used by default.',
|
|
59
|
+
"Fallback order: `TO_LANG`, `config.lang`, `bot's lang`, `English`.",
|
|
62
60
|
'Example 2: /translate Chinese',
|
|
63
61
|
]),
|
|
64
62
|
cmds: {
|