@futdevpro/nts-dynamo 1.11.34 → 1.11.36
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/.github/workflows/main.yml +186 -233
- package/build/_modules/discord-assistant/_services/dias.service-base.d.ts +3 -1
- package/build/_modules/discord-assistant/_services/dias.service-base.d.ts.map +1 -1
- package/build/_modules/discord-assistant/_services/dias.service-base.js +4 -2
- package/build/_modules/discord-assistant/_services/dias.service-base.js.map +1 -1
- package/build/_modules/discord-bot/_collections/dibo-operations.util.js +3 -3
- package/build/_modules/discord-bot/_collections/dibo-operations.util.js.map +1 -1
- package/build/_modules/discord-bot/_services/dibo-io.control-service.js +3 -3
- package/build/_modules/discord-bot/_services/dibo-io.control-service.js.map +1 -1
- package/build/_modules/discord-bot/_services/dibo-main.control-service.d.ts.map +1 -1
- package/build/_modules/discord-bot/_services/dibo-main.control-service.js +15 -11
- package/build/_modules/discord-bot/_services/dibo-main.control-service.js.map +1 -1
- package/build/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts.map +1 -1
- package/build/_modules/open-ai/_services/oai-llm-chat.service-base.js +12 -4
- package/build/_modules/open-ai/_services/oai-llm-chat.service-base.js.map +1 -1
- package/build/_modules/open-ai/_services/oai-llm.service-base.d.ts.map +1 -1
- package/build/_modules/open-ai/_services/oai-llm.service-base.js +1 -1
- package/build/_modules/open-ai/_services/oai-llm.service-base.js.map +1 -1
- package/build/_services/core/api.service.d.ts.map +1 -1
- package/build/_services/core/api.service.js +1 -1
- package/build/_services/core/api.service.js.map +1 -1
- package/package.json +6 -5
- package/src/_modules/discord-assistant/_services/dias.service-base.ts +8 -2
- package/src/_modules/discord-bot/_collections/dibo-operations.util.ts +3 -3
- package/src/_modules/discord-bot/_services/dibo-io.control-service.ts +3 -3
- package/src/_modules/discord-bot/_services/dibo-main.control-service.ts +24 -11
- package/src/_modules/open-ai/_services/oai-llm-chat.service-base.ts +17 -5
- package/src/_modules/open-ai/_services/oai-llm.service-base.ts +1 -1
- package/src/_services/core/api.service.ts +5 -2
- package/tsconfig.json +11 -11
- package/test.ts +0 -0
- package/test2.js +0 -1
- package/test2.ts +0 -0
|
@@ -69,7 +69,7 @@ export abstract class DyNTS_DiBo_IO_ControlService extends DyNTS_SingletonServic
|
|
|
69
69
|
async handleNewMessage(message: Message, issuer: string): Promise<void> {
|
|
70
70
|
try {
|
|
71
71
|
if (DyNTS_DiBo_global_settings.debugLevel >= 1) {
|
|
72
|
-
DyFM_Log.
|
|
72
|
+
DyFM_Log.H_log(`incoming message: (${message.author.displayName}) ${message.content}`)
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
const isForYou = await this.getMessageIsForBotToHandle(message, issuer);
|
|
@@ -175,7 +175,7 @@ export abstract class DyNTS_DiBo_IO_ControlService extends DyNTS_SingletonServic
|
|
|
175
175
|
|
|
176
176
|
if (haveSkipFlags) {
|
|
177
177
|
if (DyNTS_DiBo_global_settings.debugLevel >= 2) {
|
|
178
|
-
DyFM_Log.warn('🚫🏳️
|
|
178
|
+
DyFM_Log.warn('🚫🏳️ not for me; this message have some skip flags:',
|
|
179
179
|
DyNTS_DiBo_global_settings.messageSettings.skipFlags.filter(
|
|
180
180
|
flag => message.content.includes(flag)
|
|
181
181
|
),
|
|
@@ -192,7 +192,7 @@ export abstract class DyNTS_DiBo_IO_ControlService extends DyNTS_SingletonServic
|
|
|
192
192
|
message.author.bot &&
|
|
193
193
|
!DyNTS_DiBo_global_settings.allowBotsInteractEachOther
|
|
194
194
|
) {
|
|
195
|
-
if (DyNTS_DiBo_global_settings.debugLevel >= 2) {
|
|
195
|
+
if (isPinged && DyNTS_DiBo_global_settings.debugLevel >= 2) {
|
|
196
196
|
DyFM_Log.warn('🚫🤖❌ not for me; this message is from a bot')
|
|
197
197
|
message.reply('[SYSTEM|REFUSE|BOT] You should not ping me!')
|
|
198
198
|
}
|
|
@@ -173,10 +173,11 @@ export abstract class DyNTS_DiBo_Main_ControlService extends DyNTS_SingletonServ
|
|
|
173
173
|
DyNTS_GlobalService.globalErrorHandler(error);
|
|
174
174
|
reject(error);
|
|
175
175
|
});
|
|
176
|
+
|
|
176
177
|
if (this.debugLog) {
|
|
177
|
-
DyFM_Log.
|
|
178
|
+
DyFM_Log.success('Error event registered\n\n', new Error().stack);
|
|
178
179
|
} else {
|
|
179
|
-
DyFM_Log.
|
|
180
|
+
DyFM_Log.success('Error event registered');
|
|
180
181
|
}
|
|
181
182
|
|
|
182
183
|
this.client.on('ready', async () => {
|
|
@@ -199,23 +200,26 @@ export abstract class DyNTS_DiBo_Main_ControlService extends DyNTS_SingletonServ
|
|
|
199
200
|
DyFM_Log.success('Discord Bot setup complete')
|
|
200
201
|
resolve();
|
|
201
202
|
});
|
|
203
|
+
|
|
202
204
|
if (this.debugLog) {
|
|
203
|
-
DyFM_Log.
|
|
205
|
+
DyFM_Log.success('Ready event registered\n\n', new Error().stack);
|
|
204
206
|
} else {
|
|
205
|
-
DyFM_Log.
|
|
207
|
+
DyFM_Log.success('Ready event registered');
|
|
206
208
|
}
|
|
207
209
|
|
|
208
210
|
this.client.on('messageCreate', (message: Message) => {
|
|
209
211
|
try {
|
|
210
212
|
this.botIO_CS.handleNewMessage(message, message?.author?.id ?? 'unknown')
|
|
211
213
|
} catch (error) {
|
|
212
|
-
|
|
214
|
+
DyFM_Error.logSimple('Error handling new message:', error);
|
|
215
|
+
|
|
213
216
|
}
|
|
214
217
|
});
|
|
218
|
+
|
|
215
219
|
if (this.debugLog) {
|
|
216
|
-
DyFM_Log.
|
|
220
|
+
DyFM_Log.success('Message create event registered\n\n', new Error().stack);
|
|
217
221
|
} else {
|
|
218
|
-
DyFM_Log.
|
|
222
|
+
DyFM_Log.success('Message create event registered');
|
|
219
223
|
}
|
|
220
224
|
|
|
221
225
|
process.on('exit', () => {
|
|
@@ -227,13 +231,14 @@ export abstract class DyNTS_DiBo_Main_ControlService extends DyNTS_SingletonServ
|
|
|
227
231
|
`Bot is shutting down...`
|
|
228
232
|
)
|
|
229
233
|
} catch (error) {
|
|
230
|
-
|
|
234
|
+
DyFM_Error.logSimple('Error sending message to report channel:', error);
|
|
231
235
|
}
|
|
232
236
|
});
|
|
237
|
+
|
|
233
238
|
if (this.debugLog) {
|
|
234
|
-
DyFM_Log.
|
|
239
|
+
DyFM_Log.success('Exit event registered\n\n', new Error().stack);
|
|
235
240
|
} else {
|
|
236
|
-
DyFM_Log.
|
|
241
|
+
DyFM_Log.success('Exit event registered');
|
|
237
242
|
}
|
|
238
243
|
|
|
239
244
|
this.client.login(DyNTS_global_settings.env_settings.discord.token).catch((error) => {
|
|
@@ -252,6 +257,8 @@ export abstract class DyNTS_DiBo_Main_ControlService extends DyNTS_SingletonServ
|
|
|
252
257
|
} catch {}
|
|
253
258
|
}
|
|
254
259
|
|
|
260
|
+
DyFM_Error.logSimple('Error during bot startup:', error);
|
|
261
|
+
|
|
255
262
|
throw new DyFM_Error({
|
|
256
263
|
...this.getDefaultErrorSettings('start', error, issuer),
|
|
257
264
|
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiBo-MCS-SE0`,
|
|
@@ -269,6 +276,8 @@ export abstract class DyNTS_DiBo_Main_ControlService extends DyNTS_SingletonServ
|
|
|
269
276
|
|
|
270
277
|
DyFM_Log.success('Discord Bot started')
|
|
271
278
|
} catch (error) {
|
|
279
|
+
DyFM_Error.logSimple('Error during bot start:', error);
|
|
280
|
+
|
|
272
281
|
throw new DyFM_Error({
|
|
273
282
|
...this.getDefaultErrorSettings('start', error, issuer),
|
|
274
283
|
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiBo-MCS-ST0`,
|
|
@@ -337,6 +346,8 @@ export abstract class DyNTS_DiBo_Main_ControlService extends DyNTS_SingletonServ
|
|
|
337
346
|
|
|
338
347
|
return await channel.send(message);
|
|
339
348
|
} catch (error) {
|
|
349
|
+
DyFM_Error.logSimple('Error sending message to channel by name:', error);
|
|
350
|
+
|
|
340
351
|
throw new DyFM_Error({
|
|
341
352
|
...this.getDefaultErrorSettings('sendMessageToChannelByName', error, issuer),
|
|
342
353
|
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiBo-MCS-SMCN0`,
|
|
@@ -361,7 +372,7 @@ export abstract class DyNTS_DiBo_Main_ControlService extends DyNTS_SingletonServ
|
|
|
361
372
|
await Promise.all(messages.map(message => {
|
|
362
373
|
return new Promise(async (resolve, reject) => {
|
|
363
374
|
await DyNTS_DiBo_Operations_Util.deleteMessage(message).catch((error) => {
|
|
364
|
-
|
|
375
|
+
DyFM_Error.logSimple('Failed to delete message', error);
|
|
365
376
|
});
|
|
366
377
|
messages = messages.filter(m => m.id !== message.id);
|
|
367
378
|
DyFM_Log.success('Deleted message', message.content);
|
|
@@ -380,6 +391,8 @@ export abstract class DyNTS_DiBo_Main_ControlService extends DyNTS_SingletonServ
|
|
|
380
391
|
|
|
381
392
|
channel.send('[SYSTEM|OPERATION|RESULT] Csatorna üzeneteinek törlése sikeresen befejeződött.');
|
|
382
393
|
} catch (error) {
|
|
394
|
+
DyFM_Error.logSimple('Error clearing channel:', error);
|
|
395
|
+
|
|
383
396
|
throw new DyFM_Error({
|
|
384
397
|
...this.getDefaultErrorSettings('clearChannel', error, issuer),
|
|
385
398
|
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiBo-MCS-CC0`,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAI } from 'openai';
|
|
2
2
|
|
|
3
3
|
import { DyFM_OpenAI_Settings, DyFM_OpenAIModel, DyFM_GPTCall_Settings } from '@futdevpro/fsm-dynamo/open-ai';
|
|
4
|
-
import { DyFM_AnyError, DyFM_Error, DyFM_Error_Settings, DyFM_getLocalStackLocation, DyFM_Log, DyFM_notNull, DyFM_Object } from '@futdevpro/fsm-dynamo';
|
|
4
|
+
import { DyFM_AnyError, DyFM_Error, DyFM_Error_Settings, DyFM_getLocalStackLocation, DyFM_Log, DyFM_notNull, DyFM_Object, DyFM_Array } from '@futdevpro/fsm-dynamo';
|
|
5
5
|
|
|
6
6
|
import { DyNTS_global_settings } from '../../../_collections/global-settings.const';
|
|
7
7
|
import { DyNTS_OAI_GPT_Message } from '../_models/interfaces/oai-gpt-message.interface';
|
|
@@ -550,7 +550,13 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
550
550
|
let stringifiedMessages = JSON.stringify(msgs);
|
|
551
551
|
|
|
552
552
|
if (this.debugLog || set.debugLog) {
|
|
553
|
-
DyFM_Log.info(
|
|
553
|
+
DyFM_Log.info(
|
|
554
|
+
' DyNTS_OAI_LLMChat_ServiceBase: before shortening conversation', {
|
|
555
|
+
stringifiedMessagesLength: stringifiedMessages.length,
|
|
556
|
+
conversationLength: clonedConversation.length,
|
|
557
|
+
lastMessage: DyFM_Array.last(clonedConversation)?.content,
|
|
558
|
+
}
|
|
559
|
+
);
|
|
554
560
|
}
|
|
555
561
|
|
|
556
562
|
let removedMessagesCount = 0;
|
|
@@ -568,8 +574,14 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
568
574
|
}
|
|
569
575
|
|
|
570
576
|
if (this.debugLog || set.debugLog) {
|
|
571
|
-
DyFM_Log.info(
|
|
572
|
-
|
|
577
|
+
DyFM_Log.info(
|
|
578
|
+
' DyNTS_OAI_LLMChat_ServiceBase: after shortening conversation', {
|
|
579
|
+
removedMessagesCount: removedMessagesCount,
|
|
580
|
+
lastStringifiedMessagesLength: lastStringifiedMessagesLength,
|
|
581
|
+
lastMessage: DyFM_Array.last(clonedConversation)?.content,
|
|
582
|
+
localStackLocation: DyFM_getLocalStackLocation(),
|
|
583
|
+
}
|
|
584
|
+
);
|
|
573
585
|
}
|
|
574
586
|
|
|
575
587
|
if (!clonedConversation.length) {
|
|
@@ -602,7 +614,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
602
614
|
}
|
|
603
615
|
) {
|
|
604
616
|
if (set.debugLog || this.debugLog) {
|
|
605
|
-
DyFM_Log.info('Conversation', DyFM_getLocalStackLocation());
|
|
617
|
+
DyFM_Log.info('Conversation log at', DyFM_getLocalStackLocation());
|
|
606
618
|
|
|
607
619
|
set.conversation.forEach(message => {
|
|
608
620
|
console.log(
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
DyFM_ErrorLevel,
|
|
8
8
|
DyFM_HttpCallType, DyFM_HttpResponseType,
|
|
9
9
|
DyFM_Log,
|
|
10
|
-
DyFM_HttpErrorResponse
|
|
10
|
+
DyFM_HttpErrorResponse,
|
|
11
|
+
DyFM_Object
|
|
11
12
|
} from '@futdevpro/fsm-dynamo';
|
|
12
13
|
|
|
13
14
|
import { DyNTS_global_settings } from '../../_collections/global-settings.const';
|
|
@@ -243,7 +244,9 @@ export class DyNTS_ApiService {
|
|
|
243
244
|
typeof (error as DyFM_Error)?.error === 'string' &&
|
|
244
245
|
callParams?.httpOptions?.responseType === DyFM_HttpResponseType.text
|
|
245
246
|
) {
|
|
246
|
-
(error as DyFM_Error).error =
|
|
247
|
+
(error as DyFM_Error).error = DyFM_Object.failableSafeParseJSON(
|
|
248
|
+
(error as DyFM_Error)?.error as any as string
|
|
249
|
+
);
|
|
247
250
|
}
|
|
248
251
|
|
|
249
252
|
if (DyFM_Error.isDyFMError((error as Axios.AxiosError)?.response?.data)) {
|
package/tsconfig.json
CHANGED
|
@@ -24,19 +24,19 @@
|
|
|
24
24
|
"forceConsistentCasingInFileNames": true,
|
|
25
25
|
"resolveJsonModule": true,
|
|
26
26
|
"paths": {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/* "@futdevpro/fsm-dynamo": [
|
|
30
|
-
"../dynamo-fsm/src/index.ts",
|
|
31
|
-
],
|
|
32
|
-
"@futdevpro/fsm-dynamo/*": [
|
|
33
|
-
"../dynamo-fsm/src/_modules/*.index.ts",
|
|
34
|
-
], */
|
|
35
|
-
|
|
36
|
-
|
|
37
27
|
}
|
|
38
28
|
},
|
|
39
29
|
"include": [
|
|
40
30
|
"src"
|
|
41
|
-
]
|
|
31
|
+
],
|
|
32
|
+
"DISABLED": {
|
|
33
|
+
"paths": {
|
|
34
|
+
"@futdevpro/fsm-dynamo": [
|
|
35
|
+
"../dynamo-fsm/src/index.ts"
|
|
36
|
+
],
|
|
37
|
+
"@futdevpro/fsm-dynamo/*": [
|
|
38
|
+
"../dynamo-fsm/src/_modules/*.index.ts"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
42
|
}
|
package/test.ts
DELETED
|
Binary file
|
package/test2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
console.log("test");
|
package/test2.ts
DELETED
|
Binary file
|