halbot 1990.1.117 → 1990.1.118

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.
Files changed (3) hide show
  1. package/README.md +6 -1
  2. package/index.mjs +9 -5
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -68,11 +68,16 @@ All supported configuration fields:
68
68
  "telegramToken": "[[Telegram Bot API Token]]",
69
69
 
70
70
  // OPTIONAL, string.
71
- // Set this field if you need ChatGPT features.
71
+ // Set some of these fields if you need ChatGPT features.
72
72
  "openaiApiKey": "[[OpenAI API Key]]",
73
73
  "openaiEndpoint": "[[Custom OpenAI API endpoint]]",
74
74
  "chatGptModel": "[[Custom ChatGPT Model ID]]",
75
75
 
76
+ // OPTIONAL, string.
77
+ // Set some of these fields if you need to use custom ChatGPT API.
78
+ "chatGptApiKey": "[[Custom ChatGPT API Key]]",
79
+ "chatGptEndpoint": "[[Custom ChatGPT API endpoint]]",
80
+
76
81
  // OPTIONAL, string.
77
82
  // Set this field if you need Gemini features.
78
83
  "googleCredentials": "[[Google Cloud Credentials]]",
package/index.mjs CHANGED
@@ -35,16 +35,20 @@ const init = async (options) => {
35
35
  const info = bot.lines([
36
36
  `[${bot.EMOJI_BOT} ${pkg.title}](${pkg.homepage})`, pkg.description
37
37
  ]);
38
- if (options?.openaiApiKey) {
39
- const apiKey = { apiKey: options.openaiApiKey };
38
+ if (options?.openaiApiKey || options?.chatGptApiKey) {
39
+ const apiKey = { apiKey: options?.chatGptApiKey || options?.openaiApiKey };
40
40
  await alan.init({
41
- provider: 'openai', ...apiKey, baseURL: options?.openaiEndpoint,
41
+ provider: 'openai', ...apiKey,
42
+ baseURL: options?.chatGptEndpoint || options?.openaiEndpoint,
42
43
  });
43
- await speech.init({ ...apiKey, provider: 'OPENAI', ...speechOptions });
44
- await image.init(apiKey);
45
44
  ai['ChatGPT'] = { engine: 'CHATGPT' };
46
45
  engines['CHATGPT'] = { model: options?.chatGptModel };
47
46
  }
47
+ if (options?.openaiApiKey) {
48
+ const apiKey = { apiKey: options.openaiApiKey };
49
+ await speech.init({ ...apiKey, provider: 'OPENAI', ...speechOptions });
50
+ await image.init(apiKey);
51
+ }
48
52
  if (options?.googleApiKey) {
49
53
  const apiKey = { apiKey: options.googleApiKey };
50
54
  await vision.init(apiKey);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "halbot",
3
3
  "description": "Just another ChatGPT/Bing Chat Telegram bob, which is simple design, easy to use, extendable and fun.",
4
- "version": "1990.1.117",
4
+ "version": "1990.1.118",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/halbot",
7
7
  "type": "module",
@@ -46,7 +46,7 @@
46
46
  "openai": "^4.24.1",
47
47
  "telegraf": "^4.15.3",
48
48
  "tesseract.js": "^5.0.4",
49
- "utilitas": "^1995.2.46",
49
+ "utilitas": "^1995.2.47",
50
50
  "youtube-transcript": "^1.0.6"
51
51
  }
52
52
  }