utilitas 1999.1.24 → 1999.1.26
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/README.md +0 -1
- package/dist/utilitas.lite.mjs +1 -1
- package/dist/utilitas.lite.mjs.map +1 -1
- package/lib/alan.mjs +3 -2
- package/lib/bot.mjs +20 -16
- package/lib/manifest.mjs +1 -1
- package/package.json +1 -1
package/lib/alan.mjs
CHANGED
|
@@ -180,11 +180,12 @@ const MODELS = {
|
|
|
180
180
|
[JINA_CLIP]: {
|
|
181
181
|
maxInputTokens: k(8), maxImageSize: 512 * 512, dimension: k(1),
|
|
182
182
|
},
|
|
183
|
-
[CLOUD_37_SONNET]: {
|
|
183
|
+
[CLOUD_37_SONNET]: {
|
|
184
184
|
contextWindow: kT(200), maxOutputTokens: kT(64),
|
|
185
185
|
documentCostTokens: 3000 * 100, maxDocumentFile: m(32),
|
|
186
186
|
maxDocumentPages: 100, imageCostTokens: ~~(v8k / 750),
|
|
187
|
-
maxImagePerPrompt: 100,
|
|
187
|
+
maxImagePerPrompt: Math.min(/*Anthropic:*/100, /*Vertex:*/20),
|
|
188
|
+
maxFileSize: /*Vertex*/m(5), maxImageSize: 2000 * 2000,
|
|
188
189
|
supportedMimeTypes: [png, jpeg, gif, webp, pdf],
|
|
189
190
|
json: true, reasoning: true, tools: true, vision: true,
|
|
190
191
|
defaultProvider: [ANTHROPIC, VERTEX_ANTHROPIC],
|
package/lib/bot.mjs
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
// @todo: New text of the message, 1-4096 characters after entities parsing
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
log as _log,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
need, parseJson, prettyJson, splitArgs,
|
|
9
|
-
throwError,
|
|
10
|
-
timeout, trim, which,
|
|
4
|
+
log as _log, base64Encode, countKeys, ensureArray, ensureString,
|
|
5
|
+
getTimeIcon, humanReadableBoolean, ignoreErrFunc, insensitiveCompare,
|
|
6
|
+
insensitiveHas, isSet, lastItem, need, parseJson, prettyJson, splitArgs,
|
|
7
|
+
throwError, timeout, trim, which,
|
|
11
8
|
} from './utilitas.mjs';
|
|
12
9
|
|
|
13
10
|
import { readdirSync } from 'fs';
|
|
@@ -34,7 +31,6 @@ const lines = (arr, sep = '\n') => arr.join(sep);
|
|
|
34
31
|
const lines2 = arr => lines(arr, '\n\n');
|
|
35
32
|
const uList = arr => lines(arr.map(x => `- ${x}`));
|
|
36
33
|
const oList = arr => lines(arr.map((v, k) => `${k + 1}. ${v}`));
|
|
37
|
-
const map = obj => uList(Object.entries(obj).map(([k, v]) => `${k}: ${v}`));
|
|
38
34
|
const isMarkdownError = e => e?.description?.includes?.("can't parse entities");
|
|
39
35
|
const sendMd = (cId, cnt, opt) => send(cId, cnt, { parse_mode, ...opt || {} });
|
|
40
36
|
const getFile = async (id, op) => (await get(await getFileUrl(id), op)).content;
|
|
@@ -424,12 +420,14 @@ const subconscious = [{
|
|
|
424
420
|
ctx.complete = async (options) => await ctx.ok('☑️', options);
|
|
425
421
|
ctx.json = async (obj, options) => await ctx.ok(json(obj), options);
|
|
426
422
|
ctx.list = async (list, options) => await ctx.ok(uList(list), options);
|
|
427
|
-
ctx.map = async (obj, options) => await ctx.ok(map(obj), options);
|
|
428
423
|
ctx.media = async (fnc, src, options) => ctx.done.push(await ctx[fnc]({
|
|
429
424
|
[src?.toLowerCase?.()?.startsWith?.('http') ? 'url' : 'source']: src
|
|
430
425
|
}, getExtra(ctx, options)));
|
|
431
426
|
ctx.audio = async (sr, op) => await ctx.media('replyWithAudio', sr, op);
|
|
432
427
|
ctx.image = async (sr, op) => await ctx.media('replyWithPhoto', sr, op);
|
|
428
|
+
ctx.sendConfig = async (obj, options) => await ctx.ok(prettyJson(
|
|
429
|
+
obj, { code: true, md: true }
|
|
430
|
+
), options);
|
|
433
431
|
ctx.speech = async (cnt, options) => {
|
|
434
432
|
let file;
|
|
435
433
|
if (Buffer.isBuffer(cnt)) {
|
|
@@ -897,8 +895,8 @@ const subconscious = [{
|
|
|
897
895
|
}
|
|
898
896
|
};
|
|
899
897
|
assert(countKeys(ctx.config), 'No option matched.');
|
|
900
|
-
Object.keys(ctx.config).map(x => _config[x] += '
|
|
901
|
-
await ctx.
|
|
898
|
+
Object.keys(ctx.config).map(x => _config[x] += ' 🖋');
|
|
899
|
+
await ctx.sendConfig(_config);
|
|
902
900
|
} catch (err) {
|
|
903
901
|
await ctx.er(err.message || err);
|
|
904
902
|
}
|
|
@@ -1155,14 +1153,20 @@ export {
|
|
|
1155
1153
|
COMMAND_LIMIT,
|
|
1156
1154
|
EMOJI_BOT,
|
|
1157
1155
|
EMOJI_SPEECH,
|
|
1158
|
-
EMOJI_THINKING,
|
|
1159
|
-
|
|
1156
|
+
EMOJI_THINKING,
|
|
1157
|
+
GROUP_LIMIT,
|
|
1158
|
+
HELLO,
|
|
1159
|
+
MESSAGE_LENGTH_LIMIT,
|
|
1160
|
+
MESSAGE_SOFT_LIMIT,
|
|
1161
|
+
PRIVATE_LIMIT,
|
|
1162
|
+
end,
|
|
1163
|
+
init,
|
|
1160
1164
|
lines,
|
|
1161
1165
|
lines2,
|
|
1162
|
-
|
|
1163
|
-
MESSAGE_SOFT_LIMIT, newCommand,
|
|
1166
|
+
newCommand,
|
|
1164
1167
|
oList,
|
|
1165
|
-
paging,
|
|
1168
|
+
paging,
|
|
1169
|
+
send,
|
|
1166
1170
|
sendMd,
|
|
1167
1171
|
uList
|
|
1168
1172
|
};
|
package/lib/manifest.mjs
CHANGED