@futdevpro/nts-dynamo 1.14.26 → 1.14.28
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/build/_modules/ai/_modules/open-ai/_enums/oai-gpt-message-role.enum.d.ts +0 -17
- package/build/_modules/ai/_modules/open-ai/_enums/oai-gpt-message-role.enum.d.ts.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_enums/oai-gpt-message-role.enum.js +42 -39
- package/build/_modules/ai/_modules/open-ai/_enums/oai-gpt-message-role.enum.js.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.d.ts +0 -5
- package/build/_modules/ai/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.d.ts.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.js +6 -2
- package/build/_modules/ai/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.js.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts +26 -129
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm-chat.service-base.js +25 -10
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm-chat.service-base.js.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.d.ts +5 -5
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.d.ts.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.js +3 -3
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.js.map +1 -1
- package/build/_modules/ai/_modules/open-ai/index.d.ts +0 -2
- package/build/_modules/ai/_modules/open-ai/index.d.ts.map +1 -1
- package/build/_modules/ai/_modules/open-ai/index.js +2 -2
- package/build/_modules/ai/_modules/open-ai/index.js.map +1 -1
- package/build/_modules/assistant/_services/ass-io.control-service.d.ts +2 -2
- package/build/_modules/assistant/_services/ass-io.control-service.d.ts.map +1 -1
- package/build/_modules/assistant/_services/ass-main.control-service.d.ts +2 -2
- package/build/_modules/assistant/_services/ass-main.control-service.d.ts.map +1 -1
- package/build/_modules/assistant/_services/ass.service-base.d.ts +5 -5
- package/build/_modules/assistant/_services/ass.service-base.d.ts.map +1 -1
- package/build/_modules/assistant/_services/ass.service-base.js.map +1 -1
- package/build/_modules/bot/_collections/bot-operations.util.d.ts +13 -13
- package/build/_modules/bot/_collections/bot-operations.util.d.ts.map +1 -1
- package/build/_modules/bot/_collections/bot-operations.util.js.map +1 -1
- package/build/_modules/bot/_enums/bot-message-provider.enum.d.ts +1 -1
- package/build/_modules/bot/_enums/bot-message-provider.enum.d.ts.map +1 -1
- package/build/_modules/bot/_enums/bot-message-provider.enum.js +9 -9
- package/build/_modules/bot/_enums/bot-message-provider.enum.js.map +1 -1
- package/build/_modules/bot/_models/bot-channel.interface.d.ts +2 -2
- package/build/_modules/bot/_models/bot-channel.interface.d.ts.map +1 -1
- package/build/_modules/bot/_models/bot-command.interface.d.ts +3 -3
- package/build/_modules/bot/_models/bot-command.interface.d.ts.map +1 -1
- package/build/_modules/bot/_models/bot-global-settings.interface.d.ts +3 -3
- package/build/_modules/bot/_models/bot-global-settings.interface.d.ts.map +1 -1
- package/build/_modules/bot/_models/bot-message-wrapper.interface.d.ts +6 -6
- package/build/_modules/bot/_models/bot-message-wrapper.interface.d.ts.map +1 -1
- package/build/_modules/bot/_models/bot-message.interface.d.ts +2 -2
- package/build/_modules/bot/_models/bot-message.interface.d.ts.map +1 -1
- package/build/_modules/bot/_models/{bot-message-provider.interface.d.ts → bot-messaging-provider.interface.d.ts} +21 -21
- package/build/_modules/bot/_models/bot-messaging-provider.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/{bot-message-provider.interface.js → bot-messaging-provider.interface.js} +1 -1
- package/build/_modules/bot/_models/bot-messaging-provider.interface.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.d.ts +2 -2
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.d.ts.map +1 -1
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.d.ts +2 -2
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.d.ts.map +1 -1
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.js.map +1 -1
- package/build/_modules/bot/_modules/discord-bot/_services/{dib-message-provider.service.d.ts → dib-messaging-provider.service.d.ts} +4 -4
- package/build/_modules/bot/_modules/discord-bot/_services/dib-messaging-provider.service.d.ts.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_services/{dib-message-provider.service.js → dib-messaging-provider.service.js} +5 -5
- package/build/_modules/bot/_modules/discord-bot/_services/dib-messaging-provider.service.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/index.d.ts +1 -1
- package/build/_modules/bot/_modules/discord-bot/index.d.ts.map +1 -1
- package/build/_modules/bot/_modules/discord-bot/index.js +1 -1
- package/build/_modules/bot/_modules/discord-bot/index.js.map +1 -1
- package/build/_modules/bot/_modules/dynamo-bot/_collections/dyb-operations.util.d.ts +3 -3
- package/build/_modules/bot/_modules/dynamo-bot/_collections/dyb-operations.util.d.ts.map +1 -1
- package/build/_modules/bot/_modules/dynamo-bot/_collections/dyb-operations.util.js.map +1 -1
- package/build/_modules/bot/_modules/dynamo-bot/_collections/dyb.util.d.ts +2 -2
- package/build/_modules/bot/_modules/dynamo-bot/_collections/dyb.util.d.ts.map +1 -1
- package/build/_modules/bot/_modules/dynamo-bot/_collections/dyb.util.js.map +1 -1
- package/build/_modules/bot/_modules/dynamo-bot/_services/{dyb-message-provider.service.d.ts → dyb-messaging-provider.service.d.ts} +5 -5
- package/build/_modules/bot/_modules/dynamo-bot/_services/dyb-messaging-provider.service.d.ts.map +1 -0
- package/build/_modules/bot/_modules/dynamo-bot/_services/{dyb-message-provider.service.js → dyb-messaging-provider.service.js} +5 -5
- package/build/_modules/bot/_modules/dynamo-bot/_services/dyb-messaging-provider.service.js.map +1 -0
- package/build/_modules/bot/_modules/dynamo-bot/index.d.ts +1 -1
- package/build/_modules/bot/_modules/dynamo-bot/index.d.ts.map +1 -1
- package/build/_modules/bot/_modules/dynamo-bot/index.js +1 -1
- package/build/_modules/bot/_modules/dynamo-bot/index.js.map +1 -1
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.d.ts +2 -2
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.d.ts.map +1 -1
- package/build/_modules/bot/_modules/slack-bot/_services/{slb-message-provider.service.d.ts → slb-messaging-provider.service.d.ts} +4 -4
- package/build/_modules/bot/_modules/slack-bot/_services/slb-messaging-provider.service.d.ts.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_services/{slb-message-provider.service.js → slb-messaging-provider.service.js} +5 -5
- package/build/_modules/bot/_modules/slack-bot/_services/slb-messaging-provider.service.js.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/index.d.ts +1 -1
- package/build/_modules/bot/_modules/slack-bot/index.d.ts.map +1 -1
- package/build/_modules/bot/_modules/slack-bot/index.js +1 -1
- package/build/_modules/bot/_modules/slack-bot/index.js.map +1 -1
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.d.ts +2 -2
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.d.ts.map +1 -1
- package/build/_modules/bot/_modules/teams-bot/_services/{teb-message-provider.service.d.ts → teb-messaging-provider.service.d.ts} +4 -4
- package/build/_modules/bot/_modules/teams-bot/_services/teb-messaging-provider.service.d.ts.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_services/{teb-message-provider.service.js → teb-messaging-provider.service.js} +5 -5
- package/build/_modules/bot/_modules/teams-bot/_services/teb-messaging-provider.service.js.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/index.d.ts +1 -1
- package/build/_modules/bot/_modules/teams-bot/index.d.ts.map +1 -1
- package/build/_modules/bot/_modules/teams-bot/index.js +1 -1
- package/build/_modules/bot/_modules/teams-bot/index.js.map +1 -1
- package/build/_modules/bot/_services/bot-commands.control-service.d.ts +6 -6
- package/build/_modules/bot/_services/bot-commands.control-service.d.ts.map +1 -1
- package/build/_modules/bot/_services/bot-commands.control-service.js.map +1 -1
- package/build/_modules/bot/_services/bot-io.control-service.d.ts +12 -12
- package/build/_modules/bot/_services/bot-io.control-service.d.ts.map +1 -1
- package/build/_modules/bot/_services/bot-io.control-service.js +4 -18
- package/build/_modules/bot/_services/bot-io.control-service.js.map +1 -1
- package/build/_modules/bot/_services/bot-main.control-service.d.ts +16 -16
- package/build/_modules/bot/_services/bot-main.control-service.d.ts.map +1 -1
- package/build/_modules/bot/_services/bot-main.control-service.js +9 -3
- package/build/_modules/bot/_services/bot-main.control-service.js.map +1 -1
- package/build/_modules/bot/_services/bot-messaging-provider-factory.service.d.ts +6 -0
- package/build/_modules/bot/_services/bot-messaging-provider-factory.service.d.ts.map +1 -0
- package/build/_modules/bot/_services/bot-messaging-provider-factory.service.js +47 -0
- package/build/_modules/bot/_services/bot-messaging-provider-factory.service.js.map +1 -0
- package/build/_modules/bot/_services/bot-routines.control-service.d.ts +2 -2
- package/build/_modules/bot/_services/bot-routines.control-service.d.ts.map +1 -1
- package/build/_modules/bot/index.d.ts +2 -2
- package/build/_modules/bot/index.d.ts.map +1 -1
- package/build/_modules/bot/index.js +2 -2
- package/build/_modules/bot/index.js.map +1 -1
- package/build/_modules/discord-assistant/_collections/dias.util.d.ts +3 -3
- package/build/_modules/discord-assistant/_collections/dias.util.d.ts.map +1 -1
- package/build/_modules/discord-assistant/_collections/dias.util.js +4 -4
- package/build/_modules/discord-assistant/_collections/dias.util.js.map +1 -1
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.d.ts +4 -4
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.d.ts.map +1 -1
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.js.map +1 -1
- package/build/_modules/discord-assistant/_services/dias.service-base.d.ts +2 -2
- package/build/_modules/discord-assistant/_services/dias.service-base.d.ts.map +1 -1
- package/build/_modules/discord-assistant/_services/dias.service-base.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 +2 -0
- package/build/_modules/discord-bot/_services/dibo-main.control-service.js.map +1 -1
- package/package.json +1 -1
- package/src/_modules/ai/_modules/open-ai/_enums/oai-gpt-message-role.enum.ts +42 -42
- package/src/_modules/ai/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.ts +6 -6
- package/src/_modules/ai/_modules/open-ai/_services/oai-llm-chat.service-base.ts +56 -158
- package/src/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.ts +8 -9
- package/src/_modules/ai/_modules/open-ai/index.ts +2 -2
- package/src/_modules/assistant/_services/ass-io.control-service.ts +3 -3
- package/src/_modules/assistant/_services/ass-main.control-service.ts +3 -3
- package/src/_modules/assistant/_services/ass.service-base.ts +15 -15
- package/src/_modules/bot/_collections/bot-operations.util.ts +14 -14
- package/src/_modules/bot/_enums/bot-message-provider.enum.ts +1 -1
- package/src/_modules/bot/_models/bot-channel.interface.ts +2 -2
- package/src/_modules/bot/_models/bot-command.interface.ts +3 -3
- package/src/_modules/bot/_models/bot-global-settings.interface.ts +3 -3
- package/src/_modules/bot/_models/bot-message-wrapper.interface.ts +8 -7
- package/src/_modules/bot/_models/bot-message.interface.ts +2 -2
- package/src/_modules/bot/_models/{bot-message-provider.interface.ts → bot-messaging-provider.interface.ts} +23 -23
- package/src/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.ts +2 -2
- package/src/_modules/bot/_modules/discord-bot/_collections/dib.util.ts +2 -2
- package/src/_modules/bot/_modules/discord-bot/_services/{dib-message-provider.service.ts → dib-messaging-provider.service.ts} +6 -6
- package/src/_modules/bot/_modules/discord-bot/index.ts +1 -1
- package/src/_modules/bot/_modules/dynamo-bot/_collections/dyb-operations.util.ts +3 -3
- package/src/_modules/bot/_modules/dynamo-bot/_collections/dyb.util.ts +2 -2
- package/src/_modules/bot/_modules/dynamo-bot/_services/{dyb-message-provider.service.ts → dyb-messaging-provider.service.ts} +7 -7
- package/src/_modules/bot/_modules/dynamo-bot/index.ts +1 -1
- package/src/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.ts +2 -2
- package/src/_modules/bot/_modules/slack-bot/_services/{slb-message-provider.service.ts → slb-messaging-provider.service.ts} +6 -6
- package/src/_modules/bot/_modules/slack-bot/index.ts +1 -1
- package/src/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.ts +2 -2
- package/src/_modules/bot/_modules/teams-bot/_services/{teb-message-provider.service.ts → teb-messaging-provider.service.ts} +6 -6
- package/src/_modules/bot/_modules/teams-bot/index.ts +1 -1
- package/src/_modules/bot/_services/bot-commands.control-service.ts +14 -14
- package/src/_modules/bot/_services/bot-io.control-service.ts +21 -38
- package/src/_modules/bot/_services/bot-main.control-service.ts +56 -49
- package/src/_modules/bot/_services/bot-messaging-provider-factory.service.ts +56 -0
- package/src/_modules/bot/_services/bot-routines.control-service.ts +3 -3
- package/src/_modules/bot/index.ts +2 -2
- package/src/_modules/discord-assistant/_collections/dias.util.ts +6 -7
- package/src/_modules/discord-assistant/_services/dias-chunk.data-service.ts +5 -5
- package/src/_modules/discord-assistant/_services/dias-io.control-service.ts +2 -2
- package/src/_modules/discord-assistant/_services/dias.service-base.ts +2 -3
- package/src/_modules/discord-bot/_services/dibo-main.control-service.ts +2 -0
- package/build/_modules/ai/_services/oai-to-ai-adapter.service.d.ts +0 -39
- package/build/_modules/ai/_services/oai-to-ai-adapter.service.d.ts.map +0 -1
- package/build/_modules/ai/_services/oai-to-ai-adapter.service.js +0 -218
- package/build/_modules/ai/_services/oai-to-ai-adapter.service.js.map +0 -1
- package/build/_modules/bot/_enums/bot-provider.enum.d.ts +0 -8
- package/build/_modules/bot/_enums/bot-provider.enum.d.ts.map +0 -1
- package/build/_modules/bot/_enums/bot-provider.enum.js +0 -12
- package/build/_modules/bot/_enums/bot-provider.enum.js.map +0 -1
- package/build/_modules/bot/_models/bot-message-provider.interface.d.ts.map +0 -1
- package/build/_modules/bot/_models/bot-message-provider.interface.js.map +0 -1
- package/build/_modules/bot/_models/bot-provider.interface.d.ts +0 -65
- package/build/_modules/bot/_models/bot-provider.interface.d.ts.map +0 -1
- package/build/_modules/bot/_models/bot-provider.interface.js +0 -3
- package/build/_modules/bot/_models/bot-provider.interface.js.map +0 -1
- package/build/_modules/bot/_modules/discord-bot/_services/dib-message-provider.service.d.ts.map +0 -1
- package/build/_modules/bot/_modules/discord-bot/_services/dib-message-provider.service.js.map +0 -1
- package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.d.ts +0 -53
- package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.d.ts.map +0 -1
- package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.js +0 -369
- package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.js.map +0 -1
- package/build/_modules/bot/_modules/dynamo-bot/_services/dyb-message-provider.service.d.ts.map +0 -1
- package/build/_modules/bot/_modules/dynamo-bot/_services/dyb-message-provider.service.js.map +0 -1
- package/build/_modules/bot/_modules/dynamo-bot/_services/dyb-provider.service.d.ts +0 -54
- package/build/_modules/bot/_modules/dynamo-bot/_services/dyb-provider.service.d.ts.map +0 -1
- package/build/_modules/bot/_modules/dynamo-bot/_services/dyb-provider.service.js +0 -310
- package/build/_modules/bot/_modules/dynamo-bot/_services/dyb-provider.service.js.map +0 -1
- package/build/_modules/bot/_modules/slack-bot/_services/slb-message-provider.service.d.ts.map +0 -1
- package/build/_modules/bot/_modules/slack-bot/_services/slb-message-provider.service.js.map +0 -1
- package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.d.ts +0 -40
- package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.d.ts.map +0 -1
- package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.js +0 -116
- package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.js.map +0 -1
- package/build/_modules/bot/_modules/teams-bot/_services/teb-message-provider.service.d.ts.map +0 -1
- package/build/_modules/bot/_modules/teams-bot/_services/teb-message-provider.service.js.map +0 -1
- package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.d.ts +0 -40
- package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.d.ts.map +0 -1
- package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.js +0 -116
- package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.js.map +0 -1
- package/build/_modules/bot/_services/bot-provider-factory.service.d.ts +0 -6
- package/build/_modules/bot/_services/bot-provider-factory.service.d.ts.map +0 -1
- package/build/_modules/bot/_services/bot-provider-factory.service.js +0 -47
- package/build/_modules/bot/_services/bot-provider-factory.service.js.map +0 -1
- package/src/_modules/bot/_services/bot-provider-factory.service.ts +0 -56
|
@@ -7,29 +7,29 @@ import { DyNTS_Bot_Message } from '../_models/bot-message.interface';
|
|
|
7
7
|
import { DyNTS_Bot_Global_Settings } from '../_models/bot-global-settings.interface';
|
|
8
8
|
import { DyNTS_Bot_User } from '../_models/bot-user.interface';
|
|
9
9
|
import { DyNTS_Bot_Channel } from '../_models/bot-channel.interface';
|
|
10
|
-
import {
|
|
10
|
+
import { DyNTS_Bot_MessagingProvider, DyNTS_Bot_MessagingProvider_Config } from '../_models/bot-messaging-provider.interface';
|
|
11
11
|
import { DyNTS_Bot_MessageWrapper } from '../_models/bot-message-wrapper.interface';
|
|
12
12
|
|
|
13
13
|
export abstract class DyNTS_Bot_Commands_ControlService<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
> =
|
|
14
|
+
T_MessagingPlatformMessage extends DyNTS_Bot_Message<any> = DyNTS_Bot_Message<any>,
|
|
15
|
+
T_MessagingPlatformChannel extends DyNTS_Bot_Channel<any> = DyNTS_Bot_Channel<any>,
|
|
16
|
+
T_MessagingPlatformUser extends DyNTS_Bot_User<any> = DyNTS_Bot_User<any>,
|
|
17
|
+
T_MessagingPlatformProvider extends DyNTS_Bot_MessagingProvider<
|
|
18
|
+
T_MessagingPlatformChannel,
|
|
19
|
+
T_MessagingPlatformMessage,
|
|
20
|
+
T_MessagingPlatformUser
|
|
21
|
+
> = DyNTS_Bot_MessagingProvider<T_MessagingPlatformChannel, T_MessagingPlatformMessage, T_MessagingPlatformUser>
|
|
22
22
|
> extends DyNTS_SingletonService {
|
|
23
23
|
|
|
24
24
|
static getInstance<T_PlatformMessage extends DyNTS_Bot_Message<any>>(): DyNTS_Bot_Commands_ControlService<T_PlatformMessage> {
|
|
25
25
|
return DyNTS_Bot_Commands_ControlService.getSingletonInstance();
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
protected abstract getMainBotControlService(): DyNTS_Bot_Main_ControlService<
|
|
29
|
-
protected readonly mainBot_CS: DyNTS_Bot_Main_ControlService<
|
|
28
|
+
protected abstract getMainBotControlService(): DyNTS_Bot_Main_ControlService<T_MessagingPlatformChannel, T_MessagingPlatformMessage, T_MessagingPlatformUser, T_MessagingPlatformProvider>;
|
|
29
|
+
protected readonly mainBot_CS: DyNTS_Bot_Main_ControlService<T_MessagingPlatformChannel, T_MessagingPlatformMessage, T_MessagingPlatformUser, T_MessagingPlatformProvider> =
|
|
30
30
|
this.getMainBotControlService();
|
|
31
31
|
|
|
32
|
-
get provider():
|
|
32
|
+
get provider(): T_MessagingPlatformProvider {
|
|
33
33
|
return this.mainBot_CS?.provider;
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -51,9 +51,9 @@ export abstract class DyNTS_Bot_Commands_ControlService<
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
async handleCommand(message:
|
|
54
|
+
async handleCommand(message: T_MessagingPlatformMessage, wrapper: DyNTS_Bot_MessageWrapper<T_MessagingPlatformMessage>, issuer: string): Promise<void> {
|
|
55
55
|
try {
|
|
56
|
-
const botSettings = DyNTS_global_settings.bot_settings as
|
|
56
|
+
const botSettings = DyNTS_global_settings.bot_settings as DyNTS_Bot_MessagingProvider_Config;
|
|
57
57
|
let haveCommandOperator = false;
|
|
58
58
|
let msg = message.content.replace(
|
|
59
59
|
`<@${this.mainBot_CS.botClientId}>`, ''
|
|
@@ -7,22 +7,22 @@ import { DyNTS_global_settings } from '../../../_collections/global-settings.con
|
|
|
7
7
|
import { DyNTS_Bot_Message } from '../_models/bot-message.interface'
|
|
8
8
|
import { DyNTS_Bot_Channel } from '../_models/bot-channel.interface'
|
|
9
9
|
import { DyNTS_Bot_User } from '../_models/bot-user.interface'
|
|
10
|
-
import {
|
|
10
|
+
import { DyNTS_Bot_MessagingProvider } from '../_models/bot-messaging-provider.interface'
|
|
11
11
|
import { DyNTS_Bot_Global_Settings } from '../_models/bot-global-settings.interface'
|
|
12
12
|
import { DyNTS_Bot_MessageWrapper } from '../_models/bot-message-wrapper.interface'
|
|
13
13
|
import { DyNTS_Msg_Integration_ControlService } from '../../messaging/_services/msg-integration.control-service'
|
|
14
14
|
|
|
15
15
|
export abstract class DyNTS_Bot_IO_ControlService<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
T_MessagingPlatformChannel extends DyNTS_Bot_Channel<any> = DyNTS_Bot_Channel<any>,
|
|
17
|
+
T_MessagingPlatformMessage extends DyNTS_Bot_Message<any> = DyNTS_Bot_Message<any>,
|
|
18
|
+
T_MessagingPlatformUser extends DyNTS_Bot_User<any> = DyNTS_Bot_User<any>,
|
|
19
|
+
T_MessagingPlatformProvider extends DyNTS_Bot_MessagingProvider<T_MessagingPlatformChannel, T_MessagingPlatformMessage, T_MessagingPlatformUser> = DyNTS_Bot_MessagingProvider<T_MessagingPlatformChannel, T_MessagingPlatformMessage, T_MessagingPlatformUser>
|
|
20
20
|
> extends DyNTS_SingletonService {
|
|
21
21
|
|
|
22
|
-
protected abstract getMainBotControlService(): DyNTS_Bot_Main_ControlService<
|
|
23
|
-
protected abstract mainBot_CS: DyNTS_Bot_Main_ControlService<
|
|
22
|
+
protected abstract getMainBotControlService(): DyNTS_Bot_Main_ControlService<T_MessagingPlatformChannel, T_MessagingPlatformMessage, T_MessagingPlatformUser, T_MessagingPlatformProvider>;
|
|
23
|
+
protected abstract mainBot_CS: DyNTS_Bot_Main_ControlService<T_MessagingPlatformChannel, T_MessagingPlatformMessage, T_MessagingPlatformUser, T_MessagingPlatformProvider>;
|
|
24
24
|
|
|
25
|
-
get provider():
|
|
25
|
+
get provider(): T_MessagingPlatformProvider {
|
|
26
26
|
return this.mainBot_CS?.provider;
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -34,8 +34,8 @@ export abstract class DyNTS_Bot_IO_ControlService<
|
|
|
34
34
|
return this.mainBot_CS.botDisplayName;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
protected abstract getCommandsControlService(): DyNTS_Bot_Commands_ControlService<
|
|
38
|
-
protected commands_CS: DyNTS_Bot_Commands_ControlService<
|
|
37
|
+
protected abstract getCommandsControlService(): DyNTS_Bot_Commands_ControlService<T_MessagingPlatformMessage>;
|
|
38
|
+
protected commands_CS: DyNTS_Bot_Commands_ControlService<T_MessagingPlatformMessage>;
|
|
39
39
|
|
|
40
40
|
dontSendErrorReply?: boolean;
|
|
41
41
|
|
|
@@ -65,22 +65,9 @@ export abstract class DyNTS_Bot_IO_ControlService<
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
async handleNewMessage(
|
|
69
|
-
// Declare variables outside try-catch for error handling
|
|
70
|
-
let wrapper: DyNTS_Bot_MessageWrapper<T_PlatformMessage>;
|
|
71
|
-
let message: T_PlatformMessage;
|
|
72
|
-
|
|
68
|
+
async handleNewMessage(wrapper: DyNTS_Bot_MessageWrapper<T_MessagingPlatformMessage>, issuer: string): Promise<void> {
|
|
73
69
|
try {
|
|
74
|
-
|
|
75
|
-
const isWrapper = 'message' in wrapperOrMessage && 'providerId' in wrapperOrMessage;
|
|
76
|
-
wrapper = isWrapper ? wrapperOrMessage as DyNTS_Bot_MessageWrapper<T_PlatformMessage> : {
|
|
77
|
-
message: wrapperOrMessage as T_PlatformMessage,
|
|
78
|
-
providerId: 'default',
|
|
79
|
-
providerType: this.provider.getProviderName() as any,
|
|
80
|
-
provider: this.provider
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
message = wrapper.message;
|
|
70
|
+
const message = wrapper.message;
|
|
84
71
|
const botSettings = DyNTS_global_settings.bot_settings as DyNTS_Bot_Global_Settings;
|
|
85
72
|
|
|
86
73
|
if (botSettings?.debugLevel >= 1) {
|
|
@@ -130,14 +117,10 @@ export abstract class DyNTS_Bot_IO_ControlService<
|
|
|
130
117
|
const botSettings = DyNTS_global_settings.bot_settings as DyNTS_Bot_Global_Settings;
|
|
131
118
|
|
|
132
119
|
if (!this.dontSendErrorReply && botSettings?.debugLevel >= 1) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (errorProvider && errorMessage) {
|
|
138
|
-
await errorProvider.replyToMessage(
|
|
139
|
-
errorMessage.id,
|
|
140
|
-
errorMessage.channelId,
|
|
120
|
+
if (wrapper.provider && wrapper.message) {
|
|
121
|
+
await wrapper.provider.replyToMessage(
|
|
122
|
+
wrapper.message.id,
|
|
123
|
+
wrapper.message.channelId,
|
|
141
124
|
`[SYSTEM|ERROR|${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-IO-H0] Error occurred while handling the message:\n` +
|
|
142
125
|
DyFM_Error.getAnyMessage(error)
|
|
143
126
|
).catch(err => {
|
|
@@ -153,11 +136,11 @@ export abstract class DyNTS_Bot_IO_ControlService<
|
|
|
153
136
|
}
|
|
154
137
|
}
|
|
155
138
|
|
|
156
|
-
abstract handleMessage(message:
|
|
139
|
+
abstract handleMessage(message: T_MessagingPlatformMessage, wrapper: DyNTS_Bot_MessageWrapper<T_MessagingPlatformMessage>, issuer: string): Promise<T_MessagingPlatformMessage>;
|
|
157
140
|
|
|
158
141
|
async getMessageIsForBotToHandle(
|
|
159
|
-
message:
|
|
160
|
-
wrapper: DyNTS_Bot_MessageWrapper<
|
|
142
|
+
message: T_MessagingPlatformMessage,
|
|
143
|
+
wrapper: DyNTS_Bot_MessageWrapper<T_MessagingPlatformMessage>,
|
|
161
144
|
issuer: string,
|
|
162
145
|
dontRemovePing?: boolean
|
|
163
146
|
): Promise<boolean> {
|
|
@@ -300,7 +283,7 @@ export abstract class DyNTS_Bot_IO_ControlService<
|
|
|
300
283
|
}
|
|
301
284
|
}
|
|
302
285
|
|
|
303
|
-
async handleIfCommand(message:
|
|
286
|
+
async handleIfCommand(message: T_MessagingPlatformMessage, wrapper: DyNTS_Bot_MessageWrapper<T_MessagingPlatformMessage>, issuer: string): Promise<boolean> {
|
|
304
287
|
try {
|
|
305
288
|
const isCommand = await this.isCommand(message, issuer);
|
|
306
289
|
|
|
@@ -317,7 +300,7 @@ export abstract class DyNTS_Bot_IO_ControlService<
|
|
|
317
300
|
}
|
|
318
301
|
}
|
|
319
302
|
|
|
320
|
-
async isCommand(message:
|
|
303
|
+
async isCommand(message: T_MessagingPlatformMessage, issuer: string): Promise<boolean> {
|
|
321
304
|
try {
|
|
322
305
|
const botSettings = DyNTS_global_settings.bot_settings as DyNTS_Bot_Global_Settings;
|
|
323
306
|
let haveCommandOperator = false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DyNTS_SingletonService } from '../../../_services/base/singleton.service';
|
|
2
2
|
import { DyFM_Async, DyFM_Error, DyFM_Log } from '@futdevpro/fsm-dynamo';
|
|
3
3
|
import { DyNTS_global_settings } from '../../../_collections/global-settings.const';
|
|
4
|
-
import {
|
|
4
|
+
import { DyNTS_Bot_MessagingProvider, DyNTS_Bot_MessagingProvider_Config } from '../_models/bot-messaging-provider.interface';
|
|
5
5
|
import { DyNTS_Bot_Message } from '../_models/bot-message.interface';
|
|
6
6
|
import { DyNTS_Bot_Channel } from '../_models/bot-channel.interface';
|
|
7
7
|
import { DyNTS_Bot_User } from '../_models/bot-user.interface';
|
|
@@ -10,7 +10,7 @@ import { DyNTS_GlobalService } from '../../../_services/core/global.service';
|
|
|
10
10
|
import { DyNTS_Bot_IO_ControlService } from './bot-io.control-service';
|
|
11
11
|
import { DyNTS_Bot_Routines_ControlService } from './bot-routines.control-service';
|
|
12
12
|
import { DyNTS_Bot_MessageWrapper } from '../_models/bot-message-wrapper.interface';
|
|
13
|
-
import {
|
|
13
|
+
import { DyNTS_Bot_MessagingProvider_Factory } from './bot-messaging-provider-factory.service';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* This is the main control service for the Bot.
|
|
@@ -24,32 +24,32 @@ import { DyNTS_Bot_Provider_Factory } from './bot-provider-factory.service';
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
export abstract class DyNTS_Bot_Main_ControlService<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
> =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
T_MessagingPlatformChannel extends DyNTS_Bot_Channel<any> = DyNTS_Bot_Channel<any>,
|
|
28
|
+
T_MessagingPlatformMessage extends DyNTS_Bot_Message<any> = DyNTS_Bot_Message<any>,
|
|
29
|
+
T_MessagingPlatformUser extends DyNTS_Bot_User<any> = DyNTS_Bot_User<any>,
|
|
30
|
+
T_MessagingPlatformProvider extends DyNTS_Bot_MessagingProvider<
|
|
31
|
+
T_MessagingPlatformChannel,
|
|
32
|
+
T_MessagingPlatformMessage,
|
|
33
|
+
T_MessagingPlatformUser
|
|
34
|
+
> = DyNTS_Bot_MessagingProvider<
|
|
35
|
+
T_MessagingPlatformChannel,
|
|
36
|
+
T_MessagingPlatformMessage,
|
|
37
|
+
T_MessagingPlatformUser
|
|
38
38
|
>
|
|
39
39
|
> extends DyNTS_SingletonService {
|
|
40
40
|
|
|
41
|
-
protected _provider:
|
|
42
|
-
protected _providers: Map<string,
|
|
41
|
+
protected _provider: T_MessagingPlatformProvider;
|
|
42
|
+
protected _providers: Map<string, T_MessagingPlatformProvider> = new Map();
|
|
43
43
|
|
|
44
|
-
get provider():
|
|
44
|
+
get provider(): T_MessagingPlatformProvider {
|
|
45
45
|
return this._provider;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
get providers(): Map<string,
|
|
48
|
+
get providers(): Map<string, T_MessagingPlatformProvider> {
|
|
49
49
|
return this._providers;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
getProviderById(providerId: string):
|
|
52
|
+
getProviderById(providerId: string): T_MessagingPlatformProvider | undefined {
|
|
53
53
|
return this._providers.get(providerId);
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -62,35 +62,35 @@ export abstract class DyNTS_Bot_Main_ControlService<
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
protected abstract getBotIOControlService(): DyNTS_Bot_IO_ControlService<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
T_MessagingPlatformChannel,
|
|
66
|
+
T_MessagingPlatformMessage,
|
|
67
|
+
T_MessagingPlatformUser,
|
|
68
|
+
T_MessagingPlatformProvider
|
|
69
69
|
>;
|
|
70
70
|
protected botIO_CS: DyNTS_Bot_IO_ControlService<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
T_MessagingPlatformChannel,
|
|
72
|
+
T_MessagingPlatformMessage,
|
|
73
|
+
T_MessagingPlatformUser,
|
|
74
|
+
T_MessagingPlatformProvider
|
|
75
75
|
>;
|
|
76
76
|
|
|
77
77
|
protected abstract getRoutinesControlService(): DyNTS_Bot_Routines_ControlService<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
T_MessagingPlatformChannel,
|
|
79
|
+
T_MessagingPlatformMessage,
|
|
80
|
+
T_MessagingPlatformUser,
|
|
81
|
+
T_MessagingPlatformProvider
|
|
82
82
|
>;
|
|
83
83
|
protected routines_CS: DyNTS_Bot_Routines_ControlService<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
T_MessagingPlatformChannel,
|
|
85
|
+
T_MessagingPlatformMessage,
|
|
86
|
+
T_MessagingPlatformUser,
|
|
87
|
+
T_MessagingPlatformProvider
|
|
88
88
|
>;
|
|
89
89
|
|
|
90
|
-
protected abstract getProvider():
|
|
90
|
+
protected abstract getProvider(): T_MessagingPlatformProvider;
|
|
91
91
|
|
|
92
92
|
private _channelsByNames: {
|
|
93
|
-
[key: string]:
|
|
93
|
+
[key: string]: T_MessagingPlatformChannel;
|
|
94
94
|
} = {};
|
|
95
95
|
|
|
96
96
|
private _rolesByNames: {
|
|
@@ -134,14 +134,14 @@ export abstract class DyNTS_Bot_Main_ControlService<
|
|
|
134
134
|
/**
|
|
135
135
|
* Get all provider configurations (supports both single and multi-provider mode)
|
|
136
136
|
*/
|
|
137
|
-
protected getProviderConfigs():
|
|
137
|
+
protected getProviderConfigs(): DyNTS_Bot_MessagingProvider_Config[] {
|
|
138
138
|
const settings = DyNTS_global_settings.bot_settings as any;
|
|
139
139
|
|
|
140
140
|
if (this.isMultiProviderMode()) {
|
|
141
141
|
return settings.providers;
|
|
142
142
|
} else {
|
|
143
143
|
// Single provider mode - wrap existing config
|
|
144
|
-
const config = settings as
|
|
144
|
+
const config = settings as DyNTS_Bot_MessagingProvider_Config;
|
|
145
145
|
if (!config.providerId) {
|
|
146
146
|
config.providerId = config.messageProvider || 'default';
|
|
147
147
|
}
|
|
@@ -209,9 +209,16 @@ export abstract class DyNTS_Bot_Main_ControlService<
|
|
|
209
209
|
DyFM_Log.success('Ready event registered');
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
this.provider.onMessage((message:
|
|
212
|
+
this.provider.onMessage((message: T_MessagingPlatformMessage, messageIssuer: string) => {
|
|
213
213
|
try {
|
|
214
|
-
|
|
214
|
+
const wrapper: DyNTS_Bot_MessageWrapper<T_MessagingPlatformMessage> = {
|
|
215
|
+
message: message,
|
|
216
|
+
providerId: 'default',
|
|
217
|
+
providerType: this.provider.getProviderName() as any,
|
|
218
|
+
provider: this.provider
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
this.botIO_CS.handleNewMessage(wrapper, messageIssuer)
|
|
215
222
|
} catch (error) {
|
|
216
223
|
DyFM_Error.logSimple('Error handling new message:', error);
|
|
217
224
|
}
|
|
@@ -275,11 +282,11 @@ export abstract class DyNTS_Bot_Main_ControlService<
|
|
|
275
282
|
}
|
|
276
283
|
|
|
277
284
|
private async setupMultipleProviders(
|
|
278
|
-
configs:
|
|
285
|
+
configs: DyNTS_Bot_MessagingProvider_Config[],
|
|
279
286
|
issuer: string
|
|
280
287
|
): Promise<void> {
|
|
281
|
-
const providers =
|
|
282
|
-
this._providers = providers as Map<string,
|
|
288
|
+
const providers = DyNTS_Bot_MessagingProvider_Factory.createProviders(configs);
|
|
289
|
+
this._providers = providers as Map<string, T_MessagingPlatformProvider>;
|
|
283
290
|
|
|
284
291
|
const setupPromises = Array.from(providers.entries()).map(([providerId, provider]) => {
|
|
285
292
|
return new Promise<void>((resolve, reject) => {
|
|
@@ -300,8 +307,8 @@ export abstract class DyNTS_Bot_Main_ControlService<
|
|
|
300
307
|
|
|
301
308
|
provider.onMessage((message, messageIssuer, msgProviderId) => {
|
|
302
309
|
try {
|
|
303
|
-
const wrapper: DyNTS_Bot_MessageWrapper<
|
|
304
|
-
message: message as
|
|
310
|
+
const wrapper: DyNTS_Bot_MessageWrapper<T_MessagingPlatformMessage> = {
|
|
311
|
+
message: message as T_MessagingPlatformMessage,
|
|
305
312
|
providerId: msgProviderId || provider.getProviderId() || providerId,
|
|
306
313
|
providerType: provider.getProviderName() as any,
|
|
307
314
|
provider: provider as any
|
|
@@ -340,7 +347,7 @@ export abstract class DyNTS_Bot_Main_ControlService<
|
|
|
340
347
|
DyFM_Log.success('All bot providers setup complete');
|
|
341
348
|
}
|
|
342
349
|
|
|
343
|
-
private getTokenForProviderConfig(config:
|
|
350
|
+
private getTokenForProviderConfig(config: DyNTS_Bot_MessagingProvider_Config): string {
|
|
344
351
|
switch (config.messageProvider) {
|
|
345
352
|
case 'discord':
|
|
346
353
|
return config.discord?.token;
|
|
@@ -392,7 +399,7 @@ export abstract class DyNTS_Bot_Main_ControlService<
|
|
|
392
399
|
return this._rolesByNames[roleName];
|
|
393
400
|
}
|
|
394
401
|
|
|
395
|
-
async getChannelByName(channelName: string): Promise<
|
|
402
|
+
async getChannelByName(channelName: string): Promise<T_MessagingPlatformChannel> {
|
|
396
403
|
if (!this._channelsByNames[channelName]) {
|
|
397
404
|
this._channelsByNames[channelName] = await this.provider.getChannelByName(channelName);
|
|
398
405
|
}
|
|
@@ -404,7 +411,7 @@ export abstract class DyNTS_Bot_Main_ControlService<
|
|
|
404
411
|
channelName: string,
|
|
405
412
|
message: string,
|
|
406
413
|
issuer: string,
|
|
407
|
-
): Promise<
|
|
414
|
+
): Promise<T_MessagingPlatformMessage> {
|
|
408
415
|
try {
|
|
409
416
|
const channel = await this.getChannelByName(channelName);
|
|
410
417
|
|
|
@@ -442,7 +449,7 @@ export abstract class DyNTS_Bot_Main_ControlService<
|
|
|
442
449
|
}
|
|
443
450
|
|
|
444
451
|
async clearChannel(
|
|
445
|
-
channel:
|
|
452
|
+
channel: T_MessagingPlatformChannel,
|
|
446
453
|
issuer: string,
|
|
447
454
|
): Promise<void> {
|
|
448
455
|
try {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { DyNTS_Bot_MessagingProvider, DyNTS_Bot_MessagingProvider_Config } from '../_models/bot-messaging-provider.interface';
|
|
2
|
+
import { DyNTS_Bot_MessagingProvider_Type } from '../_enums/bot-message-provider.enum';
|
|
3
|
+
import { DyNTS_DiB_MessagingProvider } from '../_modules/discord-bot/_services/dib-messaging-provider.service';
|
|
4
|
+
import { DyNTS_SlB_MessagingProvider } from '../_modules/slack-bot/_services/slb-messaging-provider.service';
|
|
5
|
+
import { DyNTS_TeB_MessagingProvider } from '../_modules/teams-bot/_services/teb-messaging-provider.service';
|
|
6
|
+
import { DyNTS_DyB_MessagingProvider } from '../_modules/dynamo-bot/_services/dyb-messaging-provider.service';
|
|
7
|
+
|
|
8
|
+
export class DyNTS_Bot_MessagingProvider_Factory {
|
|
9
|
+
|
|
10
|
+
static createProvider(config: DyNTS_Bot_MessagingProvider_Config): DyNTS_Bot_MessagingProvider {
|
|
11
|
+
switch (config.messageProvider) {
|
|
12
|
+
case DyNTS_Bot_MessagingProvider_Type.discord:
|
|
13
|
+
return new DyNTS_DiB_MessagingProvider();
|
|
14
|
+
|
|
15
|
+
case DyNTS_Bot_MessagingProvider_Type.slack:
|
|
16
|
+
return new DyNTS_SlB_MessagingProvider();
|
|
17
|
+
|
|
18
|
+
case DyNTS_Bot_MessagingProvider_Type.teams:
|
|
19
|
+
return new DyNTS_TeB_MessagingProvider();
|
|
20
|
+
|
|
21
|
+
case DyNTS_Bot_MessagingProvider_Type.dynamo:
|
|
22
|
+
return new DyNTS_DyB_MessagingProvider();
|
|
23
|
+
|
|
24
|
+
case DyNTS_Bot_MessagingProvider_Type.custom:
|
|
25
|
+
if (!config.messageProviderInstance) {
|
|
26
|
+
throw new Error('Custom provider instance is required when provider type is "custom"');
|
|
27
|
+
}
|
|
28
|
+
return config.messageProviderInstance;
|
|
29
|
+
|
|
30
|
+
default:
|
|
31
|
+
throw new Error(`Unsupported provider type: ${config.messageProvider}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static createProviders(configs: DyNTS_Bot_MessagingProvider_Config[]): Map<string, DyNTS_Bot_MessagingProvider> {
|
|
36
|
+
const providers = new Map<string, DyNTS_Bot_MessagingProvider>();
|
|
37
|
+
const providerIds = new Set<string>();
|
|
38
|
+
|
|
39
|
+
for (const config of configs) {
|
|
40
|
+
if (!config.providerId) {
|
|
41
|
+
throw new Error('providerId is required when using multiple providers');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (providerIds.has(config.providerId)) {
|
|
45
|
+
throw new Error(`Duplicate providerId detected: ${config.providerId}`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
providerIds.add(config.providerId);
|
|
49
|
+
|
|
50
|
+
const provider = this.createProvider(config);
|
|
51
|
+
providers.set(config.providerId, provider);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return providers;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -8,17 +8,17 @@ import { DyNTS_global_settings } from '../../../_collections/global-settings.con
|
|
|
8
8
|
import { DyNTS_Bot_Channel } from '../_models/bot-channel.interface';
|
|
9
9
|
import { DyNTS_Bot_Message } from '../_models/bot-message.interface';
|
|
10
10
|
import { DyNTS_Bot_User } from '../_models/bot-user.interface';
|
|
11
|
-
import {
|
|
11
|
+
import { DyNTS_Bot_MessagingProvider } from '../_models/bot-messaging-provider.interface';
|
|
12
12
|
|
|
13
13
|
export abstract class DyNTS_Bot_Routines_ControlService<
|
|
14
14
|
T_PlatformChannel extends DyNTS_Bot_Channel<any> = DyNTS_Bot_Channel<any>,
|
|
15
15
|
T_PlatformMessage extends DyNTS_Bot_Message<any> = DyNTS_Bot_Message<any>,
|
|
16
16
|
T_PlatformUser extends DyNTS_Bot_User<any> = DyNTS_Bot_User<any>,
|
|
17
|
-
T_PlatformProvider extends
|
|
17
|
+
T_PlatformProvider extends DyNTS_Bot_MessagingProvider<
|
|
18
18
|
T_PlatformChannel,
|
|
19
19
|
T_PlatformMessage,
|
|
20
20
|
T_PlatformUser
|
|
21
|
-
> =
|
|
21
|
+
> = DyNTS_Bot_MessagingProvider<
|
|
22
22
|
T_PlatformChannel,
|
|
23
23
|
T_PlatformMessage,
|
|
24
24
|
T_PlatformUser
|
|
@@ -13,7 +13,7 @@ export * from './_models/bot-message.interface';
|
|
|
13
13
|
export * from './_models/bot-message-wrapper.interface';
|
|
14
14
|
export * from './_models/bot-channel.interface';
|
|
15
15
|
export * from './_models/bot-user.interface';
|
|
16
|
-
export * from './_models/bot-
|
|
16
|
+
export * from './_models/bot-messaging-provider.interface';
|
|
17
17
|
export * from './_models/bot-command.interface';
|
|
18
18
|
export * from './_models/bot-global-settings.interface';
|
|
19
19
|
export * from './_models/bot-last-message-date.interface';
|
|
@@ -29,7 +29,7 @@ export * from './_services/bot-main.control-service';
|
|
|
29
29
|
export * from './_services/bot-io.control-service';
|
|
30
30
|
export * from './_services/bot-commands.control-service';
|
|
31
31
|
export * from './_services/bot-routines.control-service';
|
|
32
|
-
export * from './_services/bot-provider-factory.service';
|
|
32
|
+
export * from './_services/bot-messaging-provider-factory.service';
|
|
33
33
|
|
|
34
34
|
// PROVIDERS
|
|
35
35
|
export * from './_modules/discord-bot';
|
|
@@ -2,9 +2,8 @@ import { Message, TextChannel } from 'discord.js';
|
|
|
2
2
|
|
|
3
3
|
import { DyFM_Error } from '@futdevpro/fsm-dynamo';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { DyFM_AI_Message, DyFM_AI_MessageRole } from '@futdevpro/fsm-dynamo/ai';
|
|
6
6
|
import { DyNTS_DiAs_global_settings } from './dias-global-settings.const';
|
|
7
|
-
import { DyNTS_OAI_GPT_Message_Role } from '../../ai/_modules/open-ai/_enums/oai-gpt-message-role.enum';
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
export class DyNTS_DiAs_Util {
|
|
@@ -16,7 +15,7 @@ export class DyNTS_DiAs_Util {
|
|
|
16
15
|
botDisplayName: string,
|
|
17
16
|
issuer: string,
|
|
18
17
|
}
|
|
19
|
-
):
|
|
18
|
+
): DyFM_AI_Message[] {
|
|
20
19
|
|
|
21
20
|
return set.messages.map(message => {
|
|
22
21
|
if (
|
|
@@ -29,18 +28,18 @@ export class DyNTS_DiAs_Util {
|
|
|
29
28
|
flag => message.content.includes(flag)
|
|
30
29
|
)) {
|
|
31
30
|
return {
|
|
32
|
-
role:
|
|
31
|
+
role: DyFM_AI_MessageRole.user,
|
|
33
32
|
content: message.content,
|
|
34
33
|
};
|
|
35
34
|
} else {
|
|
36
35
|
return {
|
|
37
|
-
role:
|
|
36
|
+
role: DyFM_AI_MessageRole.assistant,
|
|
38
37
|
content: message.content,
|
|
39
38
|
};
|
|
40
39
|
}
|
|
41
40
|
} else {
|
|
42
41
|
return {
|
|
43
|
-
role:
|
|
42
|
+
role: DyFM_AI_MessageRole.user,
|
|
44
43
|
content: message.content,
|
|
45
44
|
};
|
|
46
45
|
}
|
|
@@ -55,7 +54,7 @@ export class DyNTS_DiAs_Util {
|
|
|
55
54
|
issuer: string,
|
|
56
55
|
skipFlags?: string[],
|
|
57
56
|
}
|
|
58
|
-
): Promise<
|
|
57
|
+
): Promise<DyFM_AI_Message[]> {
|
|
59
58
|
const messages: Message[] = await this.gatherMessagesForMessage(set/* message, botClientId, issuer, skipFlags */);
|
|
60
59
|
|
|
61
60
|
return DyNTS_DiAs_Util.convertDiscordMessagesToOAIConversation({
|
|
@@ -8,7 +8,7 @@ import { DyFM_DataModel_Params, DyFM_Error, DyFM_Log } from '@futdevpro/fsm-dyna
|
|
|
8
8
|
// import { DyFM_OAI_Model } from '@futdevpro/fsm-dynamo';
|
|
9
9
|
import { DyNTS_DiAs_Main_ControlService } from './dias-main.control-service';
|
|
10
10
|
import { DyNTS_AI_LLMChat_ServiceBase } from '../../ai/_services/ai-llm-chat.service-base';
|
|
11
|
-
import {
|
|
11
|
+
import { DyFM_AI_Message } from '@futdevpro/fsm-dynamo/ai';
|
|
12
12
|
import { DyNTS_OAI_LLMDefaultPredefined_Requests } from '../../ai/_modules/open-ai/_collections/oai-llm-predefined-requests.conts';
|
|
13
13
|
import { DyNTS_DAI_Document_Util } from '../../ai/_modules/document-ai/_collections/dai-document.util';
|
|
14
14
|
import { DyNTS_DAI_DocPage } from '../../ai/_modules/document-ai/_models/data-models/dai-doc-page.data-model';
|
|
@@ -54,7 +54,7 @@ export abstract class DyNTS_DiAs_Chunk_DataService<
|
|
|
54
54
|
/* abstract getPageLink(page: T_Page): string; */
|
|
55
55
|
|
|
56
56
|
async resolveConversation(
|
|
57
|
-
conversation:
|
|
57
|
+
conversation: DyFM_AI_Message[],
|
|
58
58
|
limit: number = 10,
|
|
59
59
|
numberOfCandidates: number = 200,
|
|
60
60
|
): Promise<string> {
|
|
@@ -96,7 +96,7 @@ export abstract class DyNTS_DiAs_Chunk_DataService<
|
|
|
96
96
|
// add code overview by coding policies
|
|
97
97
|
// (Milyen jellegű coding policies lehet releváns az adott kérdésben)
|
|
98
98
|
async vectorSearchAndResolveConversation(
|
|
99
|
-
conversation:
|
|
99
|
+
conversation: DyFM_AI_Message[],
|
|
100
100
|
limit: number = 3,
|
|
101
101
|
numberOfCandidates: number = 100,
|
|
102
102
|
): Promise<string> {
|
|
@@ -139,12 +139,12 @@ export abstract class DyNTS_DiAs_Chunk_DataService<
|
|
|
139
139
|
|
|
140
140
|
// TODO: EZT KELL HÍVNI PARANCSRA
|
|
141
141
|
async vectorSearchUsingConversation(
|
|
142
|
-
conversation:
|
|
142
|
+
conversation: DyFM_AI_Message[],
|
|
143
143
|
limit: number = 3,
|
|
144
144
|
numberOfCandidates: number = 100,
|
|
145
145
|
): Promise<T_Chunk[]> {
|
|
146
146
|
try {
|
|
147
|
-
const lastMessage:
|
|
147
|
+
const lastMessage: DyFM_AI_Message = conversation[conversation.length - 1];
|
|
148
148
|
|
|
149
149
|
const searchQuestion: string = await this.llmChat_CS.getAnswerInConversation({
|
|
150
150
|
conversation: conversation,
|
|
@@ -8,7 +8,7 @@ import { DyNTS_DiBo_IO_ControlService } from '../../discord-bot/_services/dibo-i
|
|
|
8
8
|
import { DyNTS_DiAs_Main_ControlService } from './dias-main.control-service'
|
|
9
9
|
import { DyNTS_DiBo_global_settings } from '../../discord-bot/_collections/dibo-global-settings.conts'
|
|
10
10
|
import { DyNTS_OAI_LLMChat_ServiceBase } from '../../ai/_modules/open-ai/_services/oai-llm-chat.service-base'
|
|
11
|
-
import {
|
|
11
|
+
import { DyFM_AI_Message } from '@futdevpro/fsm-dynamo/ai';
|
|
12
12
|
import { DyNTS_DiAs_Util } from '../_collections/dias.util'
|
|
13
13
|
|
|
14
14
|
export abstract class DyNTS_DiAs_IO_ControlService extends DyNTS_DiBo_IO_ControlService {
|
|
@@ -31,7 +31,7 @@ export abstract class DyNTS_DiAs_IO_ControlService extends DyNTS_DiBo_IO_Control
|
|
|
31
31
|
override async handleMessage(message: Message, issuer: string): Promise<Message> {
|
|
32
32
|
try {
|
|
33
33
|
const messages: Message[] = await this.mainDiscordBot_CS.gatherDiscordMessagesForMessage(message);
|
|
34
|
-
const oaiMessages:
|
|
34
|
+
const oaiMessages: DyFM_AI_Message[] =
|
|
35
35
|
DyNTS_DiAs_Util.convertDiscordMessagesToOAIConversation({
|
|
36
36
|
messages: messages,
|
|
37
37
|
botClientId: this.mainDiscordBot_CS.botClientId,
|
|
@@ -5,8 +5,7 @@ import { Client, Guild, Message, TextChannel } from 'discord.js';
|
|
|
5
5
|
import { DyNTS_DiBo_Main_ControlService } from '../../discord-bot/_services/dibo-main.control-service';
|
|
6
6
|
import { DyNTS_DiAs_global_settings } from '../_collections/dias-global-settings.const';
|
|
7
7
|
import { DyNTS_global_settings } from '../../../_collections/global-settings.const';
|
|
8
|
-
import {
|
|
9
|
-
import { DyNTS_OAI_GPT_Message_Role } from '../../ai/_modules/open-ai/_enums/oai-gpt-message-role.enum';
|
|
8
|
+
import { DyFM_AI_Message } from '@futdevpro/fsm-dynamo/ai';
|
|
10
9
|
import { DyNTS_DiAs_Util } from '../_collections/dias.util';
|
|
11
10
|
import { DyNTS_DiAs_IO_ControlService } from './dias-io.control-service';
|
|
12
11
|
|
|
@@ -65,7 +64,7 @@ export abstract class DyNTS_DiAs_ServiceBase extends DyNTS_DiBo_Main_ControlServ
|
|
|
65
64
|
async gatherMessagesAsOAIConversation(
|
|
66
65
|
message: Message,
|
|
67
66
|
issuer: string,
|
|
68
|
-
): Promise<
|
|
67
|
+
): Promise<DyFM_AI_Message[]> {
|
|
69
68
|
const messages: Message[] = await this.gatherDiscordMessagesForMessage(message);
|
|
70
69
|
|
|
71
70
|
return DyNTS_DiAs_Util.convertDiscordMessagesToOAIConversation({
|
|
@@ -242,6 +242,8 @@ export abstract class DyNTS_DiBo_Main_ControlService extends DyNTS_SingletonServ
|
|
|
242
242
|
|
|
243
243
|
this.client.on('messageCreate', (message: Message) => {
|
|
244
244
|
try {
|
|
245
|
+
// Discord-specific implementation doesn't use generic wrapper pattern
|
|
246
|
+
// It has its own handleNewMessage signature
|
|
245
247
|
this.botIO_CS.handleNewMessage(message, message?.author?.id ?? 'unknown')
|
|
246
248
|
} catch (error) {
|
|
247
249
|
DyFM_Error.logSimple('Error handling new message:', error);
|