halbot 1989.6.31 → 1989.6.32
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/ai.mjs +8 -7
- package/skills/cmd.mjs +1 -1
- package/skills/translate.mjs +1 -1
package/package.json
CHANGED
package/skills/ai.mjs
CHANGED
|
@@ -2,29 +2,30 @@ import { utilitas } from 'utilitas';
|
|
|
2
2
|
|
|
3
3
|
const onProgress = { onProgress: true };
|
|
4
4
|
const [YOU, BOT, LN2] = ['😸 You:', '🤖️ ', '\n\n'];
|
|
5
|
-
const [joinL1, joinL2] = [a => a.join(
|
|
5
|
+
const [joinL1, joinL2] = [a => a.join(`${LN2}---${LN2}`), a => a.join(LN2)];
|
|
6
6
|
const enrich = name => name === 'Bing' ? `${name} (Sydney)` : name;
|
|
7
7
|
|
|
8
8
|
const action = async (ctx, next) => {
|
|
9
|
-
if (
|
|
9
|
+
if (!ctx.text) { return await next(); }
|
|
10
10
|
const [multiAi, msgs, tts, pms, extra]
|
|
11
11
|
= [ctx.session.ai.size > 1, {}, {}, [], {}];
|
|
12
12
|
let [lastMsg, lastSent] = ['', 0];
|
|
13
|
-
const packMsg =
|
|
14
|
-
const packed = [...ctx.
|
|
13
|
+
const packMsg = options => {
|
|
14
|
+
const packed = [...ctx.overwrite ? [joinL2([YOU, ctx.overwrite])] : []];
|
|
15
15
|
const source = options?.tts ? tts : msgs;
|
|
16
16
|
for (let name of ctx.session.ai.size ? ctx.session.ai : [ctx.firstAi]) {
|
|
17
17
|
const defaultAi = name === ctx.firstAi;
|
|
18
18
|
packed.push(joinL2([
|
|
19
|
-
...multiAi || !defaultAi || ctx.
|
|
19
|
+
...multiAi || !defaultAi || ctx.overwrite ? [`${BOT}${enrich(name)}:`] : [],
|
|
20
20
|
options?.onProgress ? (
|
|
21
|
-
source[name] ? `${source[name].trim()}
|
|
21
|
+
source[name] ? `${source[name].trim()} █` : '💬'
|
|
22
22
|
) : (source[name] || ''),
|
|
23
23
|
]));
|
|
24
24
|
}
|
|
25
|
+
console.log(packed);
|
|
25
26
|
return joinL1(packed);
|
|
26
27
|
};
|
|
27
|
-
const ok = async
|
|
28
|
+
const ok = async options => {
|
|
28
29
|
const [curTime, curMsg] = [Date.now(), packMsg(options)];
|
|
29
30
|
if (options?.onProgress && (
|
|
30
31
|
curTime - lastSent < ctx.limit || lastMsg === curMsg
|
package/skills/cmd.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { utilitas } from 'utilitas';
|
|
|
3
3
|
const matchReg = /^\/([^\ ]*)(.*)$/ig;
|
|
4
4
|
|
|
5
5
|
const action = async (ctx, next) => {
|
|
6
|
-
if (
|
|
6
|
+
if (!ctx.text) { return await next(); }
|
|
7
7
|
ctx.session.ai || (ctx.session.ai = new Set());
|
|
8
8
|
const curAi = new Set();
|
|
9
9
|
ctx.cmd = ctx.text.split('\n')?.[0]?.replace(matchReg, '$1');
|
package/skills/translate.mjs
CHANGED
|
@@ -6,7 +6,7 @@ const getPolishPrompt = () => // https://github.com/yetone/bob-plugin-openai-pol
|
|
|
6
6
|
+ ' Please note that you need to list the changes and briefly explain why: ';
|
|
7
7
|
|
|
8
8
|
const action = async (ctx, next) => {
|
|
9
|
-
if (
|
|
9
|
+
if (!ctx.text) { return await next(); }
|
|
10
10
|
switch (ctx.cmd) {
|
|
11
11
|
case '2en':
|
|
12
12
|
ctx.text = ctx.text.replace(`/${ctx.cmd}`, getTranslatePrompt('English'));
|