halbot 1993.2.26 → 1993.2.27
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/skills/70_chat.mjs +9 -10
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "halbot",
|
|
3
3
|
"description": "Just another `ChatGPT` / `Gemini` / `Ollama` Telegram bob, which is simple design, easy to use, extendable and fun.",
|
|
4
|
-
"version": "1993.2.
|
|
4
|
+
"version": "1993.2.27",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://github.com/Leask/halbot",
|
|
7
7
|
"type": "module",
|
package/skills/70_chat.mjs
CHANGED
|
@@ -3,19 +3,16 @@ import { alan, bot, utilitas } from 'utilitas';
|
|
|
3
3
|
const onProgress = { onProgress: true };
|
|
4
4
|
const [joinL1, joinL2] = [a => a.join(LN2), a => a.join(LN2)];
|
|
5
5
|
const log = content => utilitas.log(content, import.meta.url);
|
|
6
|
+
const enrich = m => m ? ` ${BOTS[m] ? `| ${BOTS[m]} ${m}` : `(${m})`}` : '';
|
|
6
7
|
const [BOT, BOTS, LN2] = [`${bot.EMOJI_BOT} `, {
|
|
7
8
|
ChatGPT: '⚛️', Gemini: '♊️', Claude: '✴️', Ollama: '🦙', 'DeepSeek-R1': '🐳',
|
|
8
9
|
}, '\n\n'];
|
|
9
10
|
|
|
10
|
-
const enrich = (name, ctx) => {
|
|
11
|
-
const m = ctx._.ai[name]?.model;
|
|
12
|
-
return m ? ` ${BOTS[m] ? `| ${BOTS[m]} ${m}` : `(${m})`}` : '';
|
|
13
|
-
};
|
|
14
11
|
|
|
15
12
|
const action = async (ctx, next) => {
|
|
16
13
|
if (!ctx.prompt && !ctx.carry.attachments.length) { return await next(); }
|
|
17
|
-
const [YOU, msgs, tts, pms, extra]
|
|
18
|
-
= [`${ctx.avatar} You:`, {}, {}, [], { buttons: [] }];
|
|
14
|
+
const [YOU, msgs, tts, rsm, pms, extra]
|
|
15
|
+
= [`${ctx.avatar} You:`, {}, {}, {}, [], { buttons: [] }];
|
|
19
16
|
let [lastMsg, lastSent, references, audio] = [null, 0, null, null];
|
|
20
17
|
const packMsg = options => {
|
|
21
18
|
const said = !options?.tts && ctx.result ? ctx.result : '';
|
|
@@ -28,7 +25,7 @@ const action = async (ctx, next) => {
|
|
|
28
25
|
const content = source[n] || '';
|
|
29
26
|
pure.push(content);
|
|
30
27
|
packed.push(joinL2([...options?.tts ? [] : [
|
|
31
|
-
`${BOTS[n]} ${n}${enrich(n
|
|
28
|
+
`${BOTS[n]} ${n}${enrich(rsm[n])}:`
|
|
32
29
|
], content]));
|
|
33
30
|
});
|
|
34
31
|
return pure.join('').trim().length ? joinL1(packed) : '';
|
|
@@ -54,7 +51,7 @@ const action = async (ctx, next) => {
|
|
|
54
51
|
});
|
|
55
52
|
};
|
|
56
53
|
ctx.carry.threadInfo.length || await ok(onProgress);
|
|
57
|
-
for (
|
|
54
|
+
for (const n of ctx.selectedAi) {
|
|
58
55
|
pms.push((async ai => {
|
|
59
56
|
try {
|
|
60
57
|
const resp = await alan.talk(ctx.prompt, {
|
|
@@ -71,10 +68,12 @@ const action = async (ctx, next) => {
|
|
|
71
68
|
tts[ai] = ctx.selectedAi.length === 1
|
|
72
69
|
&& !msgs[ai].split('\n').some(x => /^\s*```/.test(x))
|
|
73
70
|
? resp.spoken : '';
|
|
71
|
+
rsm[ai] = resp.model;
|
|
74
72
|
return resp;
|
|
75
73
|
} catch (err) {
|
|
76
|
-
msgs[ai] = err?.message || err
|
|
77
|
-
tts[ai] =
|
|
74
|
+
msgs[ai] = `⚠️ ${err?.message || err}`;
|
|
75
|
+
tts[ai] = null;
|
|
76
|
+
rsm[ai] = null;
|
|
78
77
|
log(err);
|
|
79
78
|
}
|
|
80
79
|
})(n));
|