utilitas 2001.1.81 → 2001.1.83
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 +1 -1
- package/lib/bot.mjs +1 -40
- package/lib/manifest.mjs +1 -1
- package/package.json +1 -1
package/lib/alan.mjs
CHANGED
|
@@ -108,7 +108,7 @@ const FEATURE_ICONS = {
|
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
const GEMINI_RULES = {
|
|
111
|
-
source: GOOGLE, contextWindow: m(1), maxOutputTokens: k(
|
|
111
|
+
source: GOOGLE, contextWindow: m(1.05), maxOutputTokens: k(65.5),
|
|
112
112
|
hearing: true, json: true, reasoning: true, tools: true, vision: true,
|
|
113
113
|
supportedMimeTypes: [
|
|
114
114
|
MIME_PNG, MIME_JPEG, MIME_MOV, MIME_MPEG, MIME_MP4, MIME_MPG, MIME_AVI,
|
package/lib/bot.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { insensitiveCompare, log as _log, need
|
|
1
|
+
import { insensitiveCompare, log as _log, need } from './utilitas.mjs';
|
|
2
2
|
import { isPrimary, on, report } from './callosum.mjs';
|
|
3
3
|
|
|
4
4
|
const _NEED = ['telegraf'];
|
|
@@ -19,44 +19,6 @@ const parse_mode = PARSE_MODE_MD;
|
|
|
19
19
|
|
|
20
20
|
let bot;
|
|
21
21
|
|
|
22
|
-
const paging = (message, options) => {
|
|
23
|
-
let [pages, page, size, codeMark] =
|
|
24
|
-
[[], [], ~~options?.size || MESSAGE_LENGTH_LIMIT, ''];
|
|
25
|
-
const submit = () => {
|
|
26
|
-
const content = trim(lines(page));
|
|
27
|
-
content && pages.push(content + (codeMark ? '\n```' : ''));
|
|
28
|
-
page.length = 0;
|
|
29
|
-
if (codeMark) {
|
|
30
|
-
message = codeMark + '\n' + message;
|
|
31
|
-
codeMark = '';
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
while ((message || '').length) {
|
|
35
|
-
let n = message.indexOf('\n'); // check next line break
|
|
36
|
-
n === -1 && (n = message.length); // a single line remaining
|
|
37
|
-
const cat = n > size ? '...' : ''; // the row length exceeds the limit
|
|
38
|
-
const cur = lines(page).length; // get current page length
|
|
39
|
-
if (!cat && cur + n > size) {
|
|
40
|
-
submit(); // line length ok, but the current + next line will exceed
|
|
41
|
-
continue;
|
|
42
|
-
} // cut as much as possible vs cut line by line
|
|
43
|
-
const cut = cat ? (size - cur - cat.length) : (n + 1);
|
|
44
|
-
const line = message.substring(0, cut).trimEnd() + cat;
|
|
45
|
-
page.push(line);
|
|
46
|
-
/^```.{0,20}$/.test(line) && (codeMark = codeMark ? '' : line);
|
|
47
|
-
message = message.slice(cut); // cut message
|
|
48
|
-
if (cat) {
|
|
49
|
-
message = cat + message.trimStart(); // tidy up
|
|
50
|
-
submit(); // submit if line break is needed
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
submit();
|
|
54
|
-
return pages.map((p, i) => (
|
|
55
|
-
pages.length > 1 && !options?.noPageNum
|
|
56
|
-
? `📃 PAGE ${i + 1} / ${pages.length}:\n\n` : ''
|
|
57
|
-
) + p);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
22
|
const send = async (chatId, content, options) => {
|
|
61
23
|
try {
|
|
62
24
|
return (await init()).telegram.sendMessage(chatId, content, options);
|
|
@@ -105,7 +67,6 @@ export {
|
|
|
105
67
|
end,
|
|
106
68
|
init,
|
|
107
69
|
lines,
|
|
108
|
-
paging,
|
|
109
70
|
parse_mode,
|
|
110
71
|
send,
|
|
111
72
|
sendMd,
|
package/lib/manifest.mjs
CHANGED