halbot 1992.1.12 → 1992.1.13
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 +15 -15
- package/package.json +2 -2
- package/skills/70_chat.mjs +3 -3
package/index.mjs
CHANGED
|
@@ -36,20 +36,6 @@ const init = async (options) => {
|
|
|
36
36
|
]);
|
|
37
37
|
let embedding;
|
|
38
38
|
// init ai engines
|
|
39
|
-
if (options?.openaiApiKey || options?.chatGptApiKey) {
|
|
40
|
-
await alan.init({
|
|
41
|
-
provider: 'OPENAI',
|
|
42
|
-
apiKey: options?.openaiApiKey || options?.chatGptApiKey,
|
|
43
|
-
...options || {},
|
|
44
|
-
});
|
|
45
|
-
ai['ChatGPT'] = {
|
|
46
|
-
engine: 'CHATGPT', priority: options?.chatGptPriority || 0,
|
|
47
|
-
};
|
|
48
|
-
engines['CHATGPT'] = {
|
|
49
|
-
// only support custom model while prompting
|
|
50
|
-
model: options?.chatGptModel,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
39
|
if (options?.googleApiKey) {
|
|
54
40
|
await alan.init({
|
|
55
41
|
provider: 'GEMINI', apiKey: options?.googleApiKey,
|
|
@@ -57,13 +43,27 @@ const init = async (options) => {
|
|
|
57
43
|
...options || {},
|
|
58
44
|
});
|
|
59
45
|
ai['Gemini'] = {
|
|
60
|
-
engine: 'GEMINI', priority: options?.geminiPriority ||
|
|
46
|
+
engine: 'GEMINI', priority: options?.geminiPriority || 0,
|
|
61
47
|
};
|
|
62
48
|
engines['GEMINI'] = {
|
|
63
49
|
// save for reference not for prompting
|
|
64
50
|
model: options?.geminiModel,
|
|
65
51
|
};
|
|
66
52
|
}
|
|
53
|
+
if (options?.openaiApiKey || options?.chatGptApiKey) {
|
|
54
|
+
await alan.init({
|
|
55
|
+
provider: 'OPENAI',
|
|
56
|
+
apiKey: options?.openaiApiKey || options?.chatGptApiKey,
|
|
57
|
+
...options || {},
|
|
58
|
+
});
|
|
59
|
+
ai['ChatGPT'] = {
|
|
60
|
+
engine: 'CHATGPT', priority: options?.chatGptPriority || 1,
|
|
61
|
+
};
|
|
62
|
+
engines['CHATGPT'] = {
|
|
63
|
+
// only support custom model while prompting
|
|
64
|
+
model: options?.chatGptModel,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
67
|
if (options?.claudeApiKey) {
|
|
68
68
|
await alan.init({
|
|
69
69
|
provider: 'CLAUDE', apiKey: options?.claudeApiKey,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "halbot",
|
|
3
3
|
"description": "Just another `ChatGPT` / `Gemini` / `Mistral (by ollama)` Telegram bob, which is simple design, easy to use, extendable and fun.",
|
|
4
|
-
"version": "1992.1.
|
|
4
|
+
"version": "1992.1.13",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://github.com/Leask/halbot",
|
|
7
7
|
"type": "module",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"pgvector": "^0.2.0",
|
|
52
52
|
"telegraf": "^4.16.3",
|
|
53
53
|
"tesseract.js": "^5.1.1",
|
|
54
|
-
"utilitas": "^1997.1.
|
|
54
|
+
"utilitas": "^1997.1.45",
|
|
55
55
|
"youtube-transcript": "^1.2.1"
|
|
56
56
|
}
|
|
57
57
|
}
|
package/skills/70_chat.mjs
CHANGED
|
@@ -57,14 +57,14 @@ const action = async (ctx, next) => {
|
|
|
57
57
|
const resp = await alan.talk(ctx.prompt, {
|
|
58
58
|
engine: ctx._.ai[n].engine, ...ctx.carry,
|
|
59
59
|
stream: async r => {
|
|
60
|
-
msgs[n] = r
|
|
60
|
+
msgs[n] = r.text;
|
|
61
61
|
ctx.carry.threadInfo.length || await ok(onProgress);
|
|
62
62
|
},
|
|
63
63
|
});
|
|
64
64
|
references = resp.references;
|
|
65
|
-
audio = resp.audio
|
|
65
|
+
audio = resp.audio;
|
|
66
66
|
msgs[n] = ctx.session.config?.render === false
|
|
67
|
-
? resp.text : resp.
|
|
67
|
+
? resp.text : resp.richText;
|
|
68
68
|
tts[n] = ctx.selectedAi.length === 1
|
|
69
69
|
&& !msgs[n].split('\n').some(x => /^\s*```/.test(x))
|
|
70
70
|
? resp.spoken : '';
|