halbot 1993.2.93 → 1993.2.95
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 +3 -1
- package/lib/hal.mjs +2 -2
- package/package.json +2 -2
- package/skills/10_ai.mjs +3 -2
- package/skills/60_prepare.mjs +3 -2
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
|
|
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
|
@@ -256,7 +256,7 @@ const memorize = async (ctx) => {
|
|
|
256
256
|
const received = ctx.update;
|
|
257
257
|
const received_text = ctx.txt || ''; // ATTACHMENTS
|
|
258
258
|
const id = received.update_id;
|
|
259
|
-
const response = utilitas.lastItem(ctx.done.filter(x => x
|
|
259
|
+
const response = utilitas.lastItem(ctx.done.filter(x => x?.text)) || {};
|
|
260
260
|
const response_text = response?.text || '';
|
|
261
261
|
const collected = ctx.collected.filter(x => String.isString(x.content));
|
|
262
262
|
const distilled = compact(bot.lines([
|
|
@@ -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 (
|
|
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.
|
|
4
|
+
"version": "1993.2.95",
|
|
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.
|
|
54
|
+
"utilitas": "^1999.1.65",
|
|
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.
|
|
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);
|
package/skills/60_prepare.mjs
CHANGED
|
@@ -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.
|
|
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({
|