utilitas 1999.1.37 → 1999.1.39

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/lib/alan.mjs CHANGED
@@ -65,7 +65,7 @@ const [
65
65
  TOOL, silent, GEMINI_EMBEDDING_M, INVALID_FILE, tokenSafeRatio,
66
66
  GPT_QUERY_LIMIT, CONTENT_IS_REQUIRED, OPENAI_HI_RES_SIZE, k, kT, m, minute,
67
67
  hour, gb, trimTailing, EBD, GEMINI_20_FLASH_EXP, IMAGE, JINA,
68
- JINA_DEEPSEARCH, JINA_CLIP, VERTEX,
68
+ JINA_DEEPSEARCH, JINA_CLIP, VERTEX, GEMINI_25_PRO
69
69
  ] = [
70
70
  'OpenAI', 'Gemini', 'OPENAI_TRAINING', 'Ollama', 'gpt-4o-mini',
71
71
  'gpt-4o', 'o1', 'o3-mini', 'gemini-2.0-flash',
@@ -85,6 +85,7 @@ const [
85
85
  x => 1024 * 1024 * 1024 * x, x => x.replace(/[\.\s]*$/, ''),
86
86
  { embedding: true }, 'gemini-2.0-flash-exp', 'image', 'Jina',
87
87
  'jina-deepsearch-v1', 'jina-clip-v2', 'Vertex',
88
+ 'gemini-2.5-pro-exp-03-25',
88
89
  ];
89
90
 
90
91
  const [tool, messages, text]
@@ -158,6 +159,10 @@ const MODELS = {
158
159
  ...GEMINI_RULES, contextWindow: m(2), maxOutputTokens: k(8),
159
160
  json: true,
160
161
  },
162
+ [GEMINI_25_PRO]: {
163
+ ...GEMINI_RULES, contextWindow: m(1), maxOutputTokens: k(64),
164
+ json: true, reasoning: true, tools: true,
165
+ },
161
166
  [GEMMA_3_27B]: {
162
167
  contextWindow: kT(128), maxOutputTokens: k(8),
163
168
  imageCostTokens: 256, maxImageSize: 896 * 896,
package/lib/bot.mjs CHANGED
@@ -753,59 +753,63 @@ const subconscious = [{
753
753
  run: true, priority: -8860, name: 'vision', func: async (ctx, next) => {
754
754
  ctx.collect(ctx.m?.caption || '');
755
755
  const files = [];
756
- if (ctx.m.document) {
757
- let file = {
758
- asPrompt: bot._.supportedMimeTypes.has(ctx.m.document.mime_type),
759
- file_name: ctx.m.document.file_name, fileId: ctx.m.document.file_id,
760
- mime_type: ctx.m.document.mime_type, type: FILE,
761
- ocrFunc: async f => (await isTextFile(f)) && f.toString(),
762
- };
763
- if ('application/pdf' === ctx.m.document?.mime_type) {
764
- file = { ...file, ocrFunc: ctx._.vision?.read, type: 'DOCUMENT' };
765
- } else if (/^image\/.*$/ig.test(ctx.m.document?.mime_type)) {
766
- file = { ...file, ocrFunc: ctx._.vision?.see, type: 'IMAGE' };
767
- } else if (/^.*\.(docx|xlsx|pptx)$/.test(ctx.m.document?.file_name)) {
768
- file = { ...file, ocrFunc: officeParser, type: 'DOCUMENT' };
756
+ for (const m of [
757
+ ctx.m, ...ctx.m.reply_to_message ? [ctx.m.reply_to_message] : []
758
+ ]) {
759
+ if (m.document) {
760
+ let file = {
761
+ asPrompt: bot._.supportedMimeTypes.has(m.document.mime_type),
762
+ file_name: m.document.file_name, fileId: m.document.file_id,
763
+ mime_type: m.document.mime_type, type: FILE,
764
+ ocrFunc: async f => (await isTextFile(f)) && f.toString(),
765
+ };
766
+ if ('application/pdf' === m.document?.mime_type) {
767
+ file = { ...file, ocrFunc: ctx._.vision?.read, type: 'DOCUMENT' };
768
+ } else if (/^image\/.*$/ig.test(m.document?.mime_type)) {
769
+ file = { ...file, ocrFunc: ctx._.vision?.see, type: 'IMAGE' };
770
+ } else if (/^.*\.(docx|xlsx|pptx)$/.test(m.document?.file_name)) {
771
+ file = { ...file, ocrFunc: officeParser, type: 'DOCUMENT' };
772
+ }
773
+ files.push(file);
774
+ }
775
+ if (m.sticker) {
776
+ const s = m.sticker;
777
+ const url = await getFileUrl(s.file_id);
778
+ const file_name = basename(url);
779
+ const mime_type = mime.getType(file_name) || 'image';
780
+ files.push({
781
+ asPrompt: bot._.supportedMimeTypes.has(mime_type), file_name,
782
+ fileId: s.file_id, mime_type, type: 'PHOTO',
783
+ ocrFunc: ctx._.vision?.see,
784
+ });
785
+ }
786
+ if (m.photo?.[m.photo?.length - 1]) {
787
+ const p = m.photo[m.photo.length - 1];
788
+ files.push({
789
+ asPrompt: bot._.supportedMimeTypes.has(jpeg),
790
+ file_name: `${p.file_id}.jpg`, fileId: p.file_id,
791
+ mime_type: jpeg, type: 'PHOTO', ocrFunc: ctx._.vision?.see,
792
+ });
793
+ }
794
+ if (m.video_note) {
795
+ const vn = m.video_note;
796
+ const url = await getFileUrl(vn.file_id);
797
+ const file_name = basename(url);
798
+ const mime_type = mime.getType(file_name) || 'video';
799
+ files.push({
800
+ asPrompt: bot._.supportedMimeTypes.has(mime_type), file_name,
801
+ fileId: vn.file_id, mime_type, type: 'VIDEO',
802
+ });
803
+ }
804
+ if (m.video) {
805
+ const v = m.video;
806
+ const url = await getFileUrl(v.file_id);
807
+ const file_name = basename(url);
808
+ files.push({
809
+ asPrompt: bot._.supportedMimeTypes.has(v.mime_type), file_name,
810
+ fileId: v.file_id, mime_type: v.mime_type, type: 'VIDEO',
811
+ });
769
812
  }
770
- files.push(file);
771
- }
772
- if (ctx.m.sticker) {
773
- const s = ctx.m.sticker;
774
- const url = await getFileUrl(s.file_id);
775
- const file_name = basename(url);
776
- const mime_type = mime.getType(file_name) || 'image';
777
- files.push({
778
- asPrompt: bot._.supportedMimeTypes.has(mime_type), file_name,
779
- fileId: s.file_id, mime_type, type: 'PHOTO',
780
- ocrFunc: ctx._.vision?.see,
781
- });
782
- }
783
- if (ctx.m.photo?.[ctx.m.photo?.length - 1]) {
784
- const p = ctx.m.photo[ctx.m.photo.length - 1];
785
- files.push({
786
- asPrompt: bot._.supportedMimeTypes.has(jpeg),
787
- file_name: `${p.file_id}.jpg`, fileId: p.file_id,
788
- mime_type: jpeg, type: 'PHOTO', ocrFunc: ctx._.vision?.see,
789
- });
790
- }
791
- if (ctx.m.video_note) {
792
- const vn = ctx.m.video_note;
793
- const url = await getFileUrl(vn.file_id);
794
- const file_name = basename(url);
795
- const mime_type = mime.getType(file_name) || 'video';
796
- files.push({
797
- asPrompt: bot._.supportedMimeTypes.has(mime_type), file_name,
798
- fileId: vn.file_id, mime_type, type: 'VIDEO',
799
- });
800
- }
801
- if (ctx.m.video) {
802
- const v = ctx.m.video;
803
- const url = await getFileUrl(v.file_id);
804
- const file_name = basename(url);
805
- files.push({
806
- asPrompt: bot._.supportedMimeTypes.has(v.mime_type), file_name,
807
- fileId: v.file_id, mime_type: v.mime_type, type: 'VIDEO',
808
- });
809
813
  }
810
814
  if (files.length) {
811
815
  await ctx.ok(EMOJI_LOOK);
package/lib/manifest.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const manifest = {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1999.1.37",
4
+ "version": "1999.1.39",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1999.1.37",
4
+ "version": "1999.1.39",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",