halbot 1990.1.10 → 1990.1.12
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 +1 -0
- package/package.json +1 -1
- package/skills/engine.mjs +13 -11
- package/skills/prompt.mjs +6 -6
- package/skills/{translate.mjs → wording.mjs} +27 -5
package/index.mjs
CHANGED
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.12",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://github.com/Leask/halbot",
|
|
7
7
|
"type": "module",
|
package/skills/engine.mjs
CHANGED
|
@@ -3,6 +3,11 @@ import { bot, utilitas } from 'utilitas';
|
|
|
3
3
|
let configuredAi;
|
|
4
4
|
|
|
5
5
|
const action = async (ctx, next) => {
|
|
6
|
+
ctx.isDefaultAi = name => name === ctx.firstAi;
|
|
7
|
+
ctx.clear = () => (ctx.selectedAi || []).map(n => {
|
|
8
|
+
ctx._.ai[n].clear(ctx.chatId);
|
|
9
|
+
ctx.hello();
|
|
10
|
+
});
|
|
6
11
|
ctx.firstAi = (configuredAi = Object.keys(ctx._.ai))[0];
|
|
7
12
|
switch (ctx.session.config?.ai) {
|
|
8
13
|
case '': ctx.selectedAi = [ctx.firstAi]; break;
|
|
@@ -11,11 +16,6 @@ const action = async (ctx, next) => {
|
|
|
11
16
|
? ctx.session.config?.ai : ctx.firstAi];
|
|
12
17
|
}
|
|
13
18
|
ctx.multiAi = ctx.selectedAi.length > 1;
|
|
14
|
-
ctx.isDefaultAi = name => name === ctx.firstAi;
|
|
15
|
-
ctx.clear = () => (ctx.selectedAi || []).map(n => {
|
|
16
|
-
ctx._.ai[n].clear(ctx.chatId);
|
|
17
|
-
ctx.hello();
|
|
18
|
-
});
|
|
19
19
|
await next();
|
|
20
20
|
};
|
|
21
21
|
|
|
@@ -32,12 +32,14 @@ export const { run, priority, func, help, args } = {
|
|
|
32
32
|
priority: 10,
|
|
33
33
|
func: action,
|
|
34
34
|
help: bot.lines([
|
|
35
|
-
'Set initial prompt to the AI engine.',
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
"Tip
|
|
39
|
-
|
|
40
|
-
'
|
|
35
|
+
'¶ Set initial prompt to the AI engine.',
|
|
36
|
+
"Tip 1: Set `hello=''` to reset to default initial prompt.",
|
|
37
|
+
'¶ Select between AI engines.',
|
|
38
|
+
"Tip 2: Set `ai=''` to use default AI engine.",
|
|
39
|
+
'Tip 3: Set `ai=@` to use all AI engines simultaneously.',
|
|
40
|
+
'¶ Tweak enhanced output rendering.',
|
|
41
|
+
'Example 1: /set --render on',
|
|
42
|
+
'Example 2: /set --render off',
|
|
41
43
|
]),
|
|
42
44
|
args: {
|
|
43
45
|
hello: {
|
package/skills/prompt.mjs
CHANGED
|
@@ -60,15 +60,15 @@ export const { run, priority, func, help, cmds } = {
|
|
|
60
60
|
priority: 30,
|
|
61
61
|
func: action,
|
|
62
62
|
help: bot.lines([
|
|
63
|
-
'Maintain custom prompts.',
|
|
64
|
-
'Example 1: /add code > Code with me
|
|
65
|
-
'Example 2: /del code',
|
|
66
|
-
|
|
63
|
+
'¶ Maintain custom prompts.',
|
|
64
|
+
'Example 1: /add `code` > `Code with me.`',
|
|
65
|
+
'Example 2: /del `code`',
|
|
66
|
+
`¶ Get interesting prompts from ${ACP}.`,
|
|
67
67
|
]),
|
|
68
68
|
cmds: {
|
|
69
69
|
prompts: 'List all custom prompts.',
|
|
70
|
-
add: 'Add or edit a custom prompt:
|
|
71
|
-
del: 'Delete a custom prompt:
|
|
70
|
+
add: 'Add or edit a custom prompt: /add `COMMAND` > `PROMPT`.',
|
|
71
|
+
del: 'Delete a custom prompt: /del `COMMAND`.',
|
|
72
72
|
acplist: `List prompts from ${ACP}.`,
|
|
73
73
|
acpdetail: `Show details of ${ACP}.`,
|
|
74
74
|
clear: 'Clear current AI conversation session and start a new one.',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bot } from 'utilitas';
|
|
1
|
+
import { bot, utilitas } from 'utilitas';
|
|
2
2
|
|
|
3
3
|
// Inspired by:
|
|
4
4
|
// https://github.com/yetone/bob-plugin-openai-translator/blob/main/src/main.js
|
|
@@ -14,8 +14,25 @@ const getPolishPrompt = () =>
|
|
|
14
14
|
|
|
15
15
|
const action = async (ctx, next) => {
|
|
16
16
|
switch (ctx.cmd.cmd) {
|
|
17
|
+
case 'lang':
|
|
18
|
+
if (!ctx.cmd.args) {
|
|
19
|
+
return await ctx.ok('Please specify a language.');
|
|
20
|
+
}
|
|
21
|
+
const cnf = {
|
|
22
|
+
...ctx.session.config = {
|
|
23
|
+
...ctx.session.config, ...ctx.config = {
|
|
24
|
+
lang: ctx.cmd.args,
|
|
25
|
+
hello: `Hello! I speak ${ctx.cmd.args}.`,
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
Object.keys(ctx.config).map(x => cnf[x] = `${cnf[x]} <-- SET`);
|
|
30
|
+
await ctx.map(cnf);
|
|
31
|
+
await utilitas.timeout(1000);
|
|
32
|
+
await ctx.hello();
|
|
33
|
+
break;
|
|
17
34
|
case 'translate':
|
|
18
|
-
ctx.overwrite(getTranslatePrompt(ctx.cmd.args ||
|
|
35
|
+
ctx.overwrite(getTranslatePrompt(ctx.cmd.args || ctx.session.config?.lang || ctx._.lang));
|
|
19
36
|
break;
|
|
20
37
|
case 'polish':
|
|
21
38
|
ctx.overwrite(getPolishPrompt());
|
|
@@ -41,11 +58,16 @@ export const { run, priority, func, cmds, help } = {
|
|
|
41
58
|
priority: 50,
|
|
42
59
|
func: action,
|
|
43
60
|
help: bot.lines([
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
61
|
+
'¶ Set your default language.',
|
|
62
|
+
'Example 1: /lang Français',
|
|
63
|
+
'¶ Prompt the AI engine to translate or polish your text.',
|
|
64
|
+
'If `TO_LANG` is not specified, `config.lang` is used by default.',
|
|
65
|
+
"If `config.lang` not found, the bot's default language is used.",
|
|
66
|
+
'If bot has no default language, English is used by default.',
|
|
67
|
+
'Example 2: /translate Chinese',
|
|
47
68
|
]),
|
|
48
69
|
cmds: {
|
|
70
|
+
lang: 'Set your default language: /lang `LANG`',
|
|
49
71
|
translate: 'Translate your text to any language: /translate `TO_LANG`',
|
|
50
72
|
polish: 'Polish your text.',
|
|
51
73
|
toen: 'Translate your text to English.',
|