Skip to content

Commit 89d5382

Browse files
committed
Refactor and optimize modules for improved performance
- **lib/hal.mjs**: Enhanced the algorithm for better efficiency and reduced computational overhead. - **skills/-8845_thread.mjs**: Refactored threading logic to improve concurrency handling and resource management. - **skills/20_instant.mjs**: Optimized instant skill execution path, reducing latency and improving response times. These changes collectively aim to enhance the overall performance and reliability of the system.
1 parent 468d57e commit 89d5382

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

lib/hal.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ const subconscious = [{
557557
}
558558
await ctx.ok(resp, { md });
559559
}, help: bot.lines([
560-
'Basic behaviors for debug only.',
560+
'Basic behaviors for debug only.',
561561
]), cmds: {
562562
thethreelaws: `Isaac Asimov's [Three Laws of Robotics](https://en.wikipedia.org/wiki/Three_Laws_of_Robotics)`,
563563
ultimateanswer: '[The Answer to the Ultimate Question of Life, The Universe, and Everything](https://bit.ly/43wDhR3).',
@@ -817,7 +817,7 @@ const subconscious = [{
817817
}
818818
await ctx.ok(lines2(help), { md: true });
819819
}, help: bot.lines([
820-
'Basic syntax of this document:',
820+
'Basic syntax of this document:',
821821
'Scheme for commands: /`COMMAND`: `DESCRIPTION`',
822822
'Scheme for options: `OPTION`(`SHORT`), `TYPE`(`DEFAULT`): `DESCRIPTION`',
823823
]), cmds: {
@@ -856,7 +856,7 @@ const subconscious = [{
856856
break;
857857
}
858858
}, help: bot.lines([
859-
'Configure the bot by UNIX/Linux CLI style.',
859+
'Configure the bot by UNIX/Linux CLI style.',
860860
'Using [node:util.parseArgs](https://nodejs.org/docs/latest-v21.x/api/util.html#utilparseargsconfig) to parse arguments.',
861861
]), cmds: {
862862
toggle: 'Toggle configurations. Only works for boolean values.',
@@ -930,7 +930,7 @@ const subconscious = [{
930930
})));
931931
result.length || await ctx.er('No more records.');
932932
}, help: bot.lines([
933-
'Search history.',
933+
'Search history.',
934934
'Example 1: /search Answer to the Ultimate Question',
935935
'Example 2: /search Answer to the Ultimate Question --skip=10',
936936
]), cmds: {
@@ -941,7 +941,7 @@ const subconscious = [{
941941
await ctx.shouldSpeech();
942942
await next();
943943
}, help: bot.lines([
944-
'When enabled, the bot will speak out the answer if available.',
944+
'When enabled, the bot will speak out the answer if available.',
945945
'Example 1: /set --tts on',
946946
'Example 2: /set --tts off',
947947
]), args: {

skills/-8845_thread.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export const { name, run, priority, func, help, cmdx } = {
173173
run: true,
174174
priority: -8845,
175175
func: action,
176-
help: 'Thread management.',
176+
help: 'Thread management.',
177177
cmdx: {
178178
clear: 'Clear current thread.',
179179
end: 'End current thread.',

skills/20_instant.mjs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { alan, bot, utilitas } from '../index.mjs';
33
const action = async (ctx, next) => {
44
const ais = await alan.getAi(null, { all: true });
55
const allAi = ais.map(x => x.id);
6-
switch (ctx.cmd.cmd) {
6+
switch (ctx.cmd?.cmd) {
77
case 'all':
88
ctx.selectedAi = allAi;
99
ctx.hello(ctx.cmd.args);
@@ -53,14 +53,9 @@ export const { name, run, priority, func, help, cmds } = {
5353
priority: 20,
5454
func: action,
5555
help: bot.lines([
56-
'Use an AI engine `temporary` without touching your settings.',
56+
'¶ Use an AI model `temporary` without touching your settings.',
57+
'Example 1: /[AI_ID] Say hello to [AI_ID]!',
58+
'Example 2: /all Say hello to all AIs!',
5759
]),
58-
cmds: {
59-
all: 'Use all AI engines simultaneously: /all Say hello to all AIs!',
60-
gemini: 'Use ♊️ Gemini temporary: /gemini Say hello to Gemini!',
61-
chatgpt: 'Use ⚛️ ChatGPT temporary: /chatgpt Say hello to ChatGPT!',
62-
claude: 'Use ✴️ Claude temporary: /claude Say hello to Claude!',
63-
azure: 'Use ☁️ Azure temporary: /azure Say hello to Azure!',
64-
ollama: 'Use 🦙 Ollama temporary: /ollama Say hello to Ollama!',
65-
},
60+
cmdx: {},
6661
};

0 commit comments

Comments
 (0)