halbot 1993.2.46 → 1993.2.48

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
@@ -1,5 +1,5 @@
1
- import { alan, bot, image, shot, speech, utilitas } from 'utilitas';
2
1
  import { parse } from 'csv-parse/sync';
2
+ import { alan, bot, image, shot, speech, utilitas } from 'utilitas';
3
3
 
4
4
  await utilitas.locate(utilitas.__(import.meta.url, 'package.json'));
5
5
  const log = content => utilitas.log(content, 'halbot');
@@ -75,16 +75,27 @@ const init = async (options) => {
75
75
  _speech.tts = speech.tts;
76
76
  }
77
77
  }
78
- if (options?.claudeApiKey) {
78
+ if (options?.claudeApiKey || (options?.claudeCredentials && options?.claudeProjectId)) {
79
79
  await alan.init({
80
80
  provider: 'CLAUDE', apiKey: options?.claudeApiKey,
81
- ...options || {},
81
+ credentials: options?.claudeCredentials,
82
+ projectId: options?.claudeProjectId, ...options || {},
82
83
  });
83
84
  ai['Claude'] = {
84
85
  engine: 'CLAUDE', priority: options?.claudePriority || 2,
85
86
  }; // only support custom model while prompting:
86
87
  engines['CLAUDE'] = { model: options?.claudeModel };
87
88
  }
89
+ if (options?.azureApiKey && options?.azureEndpoint) {
90
+ await alan.init({
91
+ provider: 'Azure', apiKey: options?.azureApiKey,
92
+ baseURL: options?.azureEndpoint, ...options || {},
93
+ });
94
+ ai['Azure'] = {
95
+ engine: 'AZURE', priority: options?.azurePriority || 3,
96
+ }; // only support custom model while prompting:
97
+ engines['AZURE'] = { model: options?.azureModel };
98
+ }
88
99
  if (options?.ollamaEnabled || options?.ollamaEndpoint) {
89
100
  await alan.init({
90
101
  provider: 'OLLAMA', host: options?.ollamaEndpoint,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "halbot",
3
3
  "description": "Just another `ChatGPT` / `Gemini` / `Ollama` Telegram bob, which is simple design, easy to use, extendable and fun.",
4
- "version": "1993.2.46",
4
+ "version": "1993.2.48",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/halbot",
7
7
  "type": "module",
@@ -29,30 +29,31 @@
29
29
  "url": "https://github.com/Leask/halbot.git"
30
30
  },
31
31
  "dependencies": {
32
- "@anthropic-ai/sdk": "^0.36.3",
32
+ "@anthropic-ai/sdk": "^0.37.0",
33
+ "@anthropic-ai/vertex-sdk": "^0.7.0",
33
34
  "@ffmpeg-installer/ffmpeg": "^1.1.0",
34
35
  "@ffprobe-installer/ffprobe": "^2.1.2",
35
36
  "@google-cloud/speech": "^6.7.0",
36
37
  "@google-cloud/text-to-speech": "^5.8.0",
37
38
  "@google-cloud/vision": "^4.3.2",
38
- "@google/generative-ai": "^0.21.0",
39
+ "@google/generative-ai": "^0.22.0",
39
40
  "@mozilla/readability": "^0.5.0",
40
41
  "csv-parse": "^5.6.0",
41
42
  "fluent-ffmpeg": "^2.1.3",
42
- "ioredis": "^5.4.2",
43
- "js-tiktoken": "^1.0.18",
43
+ "ioredis": "^5.5.0",
44
+ "js-tiktoken": "^1.0.19",
44
45
  "jsdom": "^26.0.0",
45
46
  "lorem-ipsum": "^2.0.8",
46
47
  "mime": "^4.0.6",
47
48
  "mysql2": "^3.12.0",
48
49
  "office-text-extractor": "^3.0.3",
49
- "ollama": "^0.5.12",
50
- "openai": "^4.83.0",
51
- "pg": "^8.13.1",
50
+ "ollama": "^0.5.14",
51
+ "openai": "^4.85.4",
52
+ "pg": "^8.13.3",
52
53
  "pgvector": "^0.2.0",
53
54
  "telegraf": "^4.16.3",
54
55
  "tesseract.js": "^6.0.0",
55
- "utilitas": "^1998.2.18",
56
+ "utilitas": "^1998.2.21",
56
57
  "youtube-transcript": "^1.2.1"
57
58
  }
58
59
  }
@@ -1,7 +1,7 @@
1
1
  import { alan, bot, utilitas } from 'utilitas';
2
2
 
3
3
  const NAME_HACK = {
4
- 'ChatGPT': '⚛️', 'Gemini': '♊️', 'Claude': '✴️', 'Ollama': '🦙',
4
+ 'ChatGPT': '⚛️', 'Gemini': '♊️', 'Claude': '✴️', 'Ollama': '🦙', 'Azure': '☁️',
5
5
  };
6
6
 
7
7
  const NAME_HACK_REVERSE = utilitas.reverseKeyValues(NAME_HACK);
@@ -57,8 +57,6 @@ const action = async (ctx, next) => {
57
57
  )?.[0] || ctx.firstAi];
58
58
  }
59
59
  }
60
- // grep 'ctx.multiAi' before uncommenting the following line
61
- // ctx.multiAi = ctx.selectedAi.length > 1;
62
60
  await next();
63
61
  };
64
62
 
@@ -93,7 +91,7 @@ export const { name, run, priority, func, help, args } = {
93
91
  },
94
92
  ai: {
95
93
  type: 'string', short: 'a', default: '',
96
- desc: "`(ChatGPT, Gemini, Claude, Ollama, @)` Select AI engine.",
94
+ desc: "`(ChatGPT, Gemini, Claude, Azure, Ollama, @)` Select AI engine.",
97
95
  validate: validateAi,
98
96
  },
99
97
  render: {
@@ -5,8 +5,6 @@ const action = async (ctx, next) => {
5
5
  switch (ctx.cmd.cmd) {
6
6
  case 'all':
7
7
  ctx.selectedAi = allAi;
8
- // grep 'ctx.multiAi' before uncommenting the following line
9
- // ctx.multiAi = ctx.selectedAi.length > 1;
10
8
  ctx.hello(ctx.cmd.args);
11
9
  break;
12
10
  case 'chatgpt':
@@ -30,6 +28,13 @@ const action = async (ctx, next) => {
30
28
  ctx.selectedAi = ['Claude'];
31
29
  ctx.hello(ctx.cmd.args);
32
30
  break;
31
+ case 'azure':
32
+ if (!utilitas.insensitiveHas(allAi, 'azure')) {
33
+ return await ctx.er('Azure is not available.');
34
+ }
35
+ ctx.selectedAi = ['Azure'];
36
+ ctx.hello(ctx.cmd.args);
37
+ break;
33
38
  case 'ollama':
34
39
  if (!utilitas.insensitiveHas(allAi, 'ollama')) {
35
40
  return await ctx.er('Ollama is not available.');
@@ -54,6 +59,7 @@ export const { name, run, priority, func, help, cmds } = {
54
59
  gemini: 'Use ♊️ Gemini temporary: /gemini Say hello to Gemini!',
55
60
  chatgpt: 'Use ⚛️ ChatGPT temporary: /chatgpt Say hello to ChatGPT!',
56
61
  claude: 'Use ✴️ Claude temporary: /claude Say hello to Claude!',
62
+ azure: 'Use ☁️ Azure temporary: /azure Say hello to Azure!',
57
63
  ollama: 'Use 🦙 Ollama temporary: /ollama Say hello to Ollama!',
58
64
  },
59
65
  };
@@ -7,6 +7,7 @@ const enrich = m => m ? ` ${BOTS[m.split(':')[0]]
7
7
  ? `| ${BOTS[m.split(':')[0]]} ${m}` : `(${m})`}` : '';
8
8
  const [BOT, BOTS, LN2] = [`${bot.EMOJI_BOT} `, {
9
9
  ChatGPT: '⚛️', Gemini: '♊️', Claude: '✴️', Ollama: '🦙', 'deepseek-r1': '🐳',
10
+ Azure: '☁️',
10
11
  }, '\n\n'];
11
12
 
12
13
  const action = async (ctx, next) => {