halbot 1991.2.17 → 1991.2.18

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 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": "1991.2.17",
4
+ "version": "1991.2.18",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/halbot",
7
7
  "type": "module",
@@ -51,7 +51,7 @@
51
51
  "pgvector": "^0.2.0",
52
52
  "telegraf": "^4.16.3",
53
53
  "tesseract.js": "^5.1.0",
54
- "utilitas": "^1996.1.28",
54
+ "utilitas": "^1996.1.30",
55
55
  "youtube-transcript": "^1.2.1"
56
56
  }
57
57
  }
@@ -18,12 +18,10 @@ const action = async (ctx, next) => {
18
18
  const pure = [];
19
19
  ctx.selectedAi.map(n => {
20
20
  const content = source[n] || '';
21
- const cmd = ctx.session.context?.cmd;
22
- const context = cmd && ` > \`${cmd}\` (exit by /clear)` || '';
23
21
  pure.push(content);
24
22
  packed.push(joinL2([
25
- ...ctx.multiAi || !ctx.isDefaultAi(n) || said || context
26
- ? [`${BOTS[n]} ${enrich(n)}${context}:`] : [], content,
23
+ ...(ctx.multiAi || !ctx.isDefaultAi(n) || said) && !options?.tts
24
+ ? [`${BOTS[n]} ${enrich(n)}:`] : [], content
27
25
  ]));
28
26
  });
29
27
  return options?.tts && !pure.join('').trim().length ? '' : joinL1(packed);
@@ -34,6 +32,10 @@ const action = async (ctx, next) => {
34
32
  curTime - lastSent < ctx.limit || lastMsg === curMsg
35
33
  )) { return; }
36
34
  [lastSent, lastMsg] = [curTime, curMsg];
35
+ const cmd = ctx.session.context?.cmd;
36
+ if (options?.final && cmd) {
37
+ extra.buttons = [{ label: `End context: \`${cmd}\``, text: '/clear' }];
38
+ };
37
39
  return await ctx.ok(curMsg, { md: true, ...options || {}, ...extra });
38
40
  };
39
41
  await ok(onProgress);
@@ -61,8 +63,7 @@ const action = async (ctx, next) => {
61
63
  })());
62
64
  }
63
65
  await Promise.all(pms);
64
- await ok();
65
- // ctx.responses = msgs; // save responses-to-user for next middleware
66
+ await ok({ final: true });
66
67
  ctx.tts = packMsg({ tts: true });
67
68
  await next();
68
69
  };