halbot 1993.2.94 → 1993.2.96

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 CHANGED
@@ -116,7 +116,9 @@ const init = async (options = {}) => {
116
116
  cmds.push(hal.newCommand(`ai_${x.id}`, `${x.name}: ${x.features}`));
117
117
  return x.model;
118
118
  }).map(x => [
119
- ...x.supportedMimeTypes || [], ...x.supportedAudioTypes || [],
119
+ ...x.supportedMimeTypes,
120
+ ...x.supportedDocTypes,
121
+ ...x.supportedAudioTypes,
120
122
  ]).flat().map(x => x.toLowerCase()));
121
123
  // init hal
122
124
  const _hal = await hal.init({
package/lib/hal.mjs CHANGED
@@ -717,7 +717,7 @@ const subconscious = [{
717
717
  mime_type: m.document.mime_type, type: storage.FILE,
718
718
  ocrFunc: async f => (await storage.isTextFile(f)) && f.toString(),
719
719
  };
720
- if ('application/pdf' === m.document?.mime_type) {
720
+ if (storage.MIME_PDF === m.document?.mime_type) {
721
721
  file = { ...file, ocrFunc: ctx._.vision?.read, type: 'DOCUMENT' };
722
722
  } else if (/^image\/.*$/ig.test(m.document?.mime_type)) {
723
723
  file = { ...file, ocrFunc: ctx._.vision?.see, type: 'IMAGE' };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "halbot",
3
3
  "description": "Just another `ChatGPT` / `Gemini` / `Claude` / `Azure` / `Jina` / `Ollama` Telegram bob, which is simple design, easy to use, extendable and fun.",
4
- "version": "1993.2.94",
4
+ "version": "1993.2.96",
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": "^6.0.1",
54
- "utilitas": "^1999.1.64",
54
+ "utilitas": "^1999.1.66",
55
55
  "youtube-transcript": "^1.2.1"
56
56
  }
57
57
  }
package/skills/10_ai.mjs CHANGED
@@ -27,8 +27,9 @@ const action = async (ctx, next) => {
27
27
  const supported = {};
28
28
  for (const x of ais) {
29
29
  const supportedMimeTypes = [
30
- ...x.model.supportedMimeTypes || [],
31
- ...x.model.supportedAudioTypes || [],
30
+ ...x.model.supportedMimeTypes,
31
+ ...x.model.supportedDocTypes,
32
+ ...x.model.supportedAudioTypes,
32
33
  ];
33
34
  for (const i of ctx.collected) {
34
35
  supported[x.id] || (supported[x.id] = 0);
@@ -8,8 +8,9 @@ const checkUnsupportedMimeType = async ctx => {
8
8
  ctx.selectedAi.map(y => {
9
9
  const ai = ais.find(z => z.id === y);
10
10
  if (![
11
- ...ai.model.supportedMimeTypes || [],
12
- ...ai.model.supportedAudioTypes || [],
11
+ ...ai.model.supportedMimeTypes,
12
+ ...ai.model.supportedDocTypes,
13
+ ...ai.model.supportedAudioTypes,
13
14
  ].includes(x?.content?.mime_type)) { notSupported = true; }
14
15
  });
15
16
  notSupported ? await x.content.analyze() : ctx.carry.attachments.push({