@futdevpro/nts-dynamo 1.10.77 → 1.11.2
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/_collections/atlas-default-db-options.const.d.ts +28 -0
- package/build/_collections/atlas-default-db-options.const.d.ts.map +1 -0
- package/build/_collections/atlas-default-db-options.const.js +10 -0
- package/build/_collections/atlas-default-db-options.const.js.map +1 -0
- package/build/_collections/get-environment-settings.util.d.ts +3 -0
- package/build/_collections/get-environment-settings.util.d.ts.map +1 -0
- package/build/_collections/get-environment-settings.util.js +45 -0
- package/build/_collections/get-environment-settings.util.js.map +1 -0
- package/build/_collections/global-settings.const.d.ts.map +1 -1
- package/build/_collections/global-settings.const.js +9 -4
- package/build/_collections/global-settings.const.js.map +1 -1
- package/build/_models/control-models/app-params.control-model.d.ts +6 -0
- package/build/_models/control-models/app-params.control-model.d.ts.map +1 -1
- package/build/_models/control-models/app-params.control-model.js +29 -2
- package/build/_models/control-models/app-params.control-model.js.map +1 -1
- package/build/_models/control-models/app-params.control-model.spec.js +5 -4
- package/build/_models/control-models/app-params.control-model.spec.js.map +1 -1
- package/build/_models/control-models/endpoint-params.control-model.js +1 -1
- package/build/_models/control-models/endpoint-params.control-model.js.map +1 -1
- package/build/_models/interfaces/environment-settings.interface.d.ts +35 -0
- package/build/_models/interfaces/environment-settings.interface.d.ts.map +1 -0
- package/build/_models/interfaces/environment-settings.interface.js +3 -0
- package/build/_models/interfaces/environment-settings.interface.js.map +1 -0
- package/build/_models/interfaces/global-settings.interface.d.ts +34 -2
- package/build/_models/interfaces/global-settings.interface.d.ts.map +1 -1
- package/build/_modules/custom-data/index.d.ts.map +1 -1
- package/build/_modules/custom-data/index.js +1 -0
- package/build/_modules/custom-data/index.js.map +1 -1
- package/build/_modules/discord-assistant/_collections/dias-global-settings.const.d.ts +3 -0
- package/build/_modules/discord-assistant/_collections/dias-global-settings.const.d.ts.map +1 -0
- package/build/_modules/discord-assistant/_collections/dias-global-settings.const.js +17 -0
- package/build/_modules/discord-assistant/_collections/dias-global-settings.const.js.map +1 -0
- package/build/_modules/discord-assistant/_collections/dias.util.d.ts +6 -0
- package/build/_modules/discord-assistant/_collections/dias.util.d.ts.map +1 -0
- package/build/_modules/discord-assistant/_collections/dias.util.js +36 -0
- package/build/_modules/discord-assistant/_collections/dias.util.js.map +1 -0
- package/build/_modules/discord-assistant/_models/dias-global-settings.interface.d.ts +18 -0
- package/build/_modules/discord-assistant/_models/dias-global-settings.interface.d.ts.map +1 -0
- package/build/_modules/discord-assistant/_models/dias-global-settings.interface.js +3 -0
- package/build/_modules/discord-assistant/_models/dias-global-settings.interface.js.map +1 -0
- package/build/_modules/discord-assistant/_models/dias-knowledge.data-model.d.ts +10 -0
- package/build/_modules/discord-assistant/_models/dias-knowledge.data-model.d.ts.map +1 -0
- package/build/_modules/discord-assistant/_models/dias-knowledge.data-model.js +41 -0
- package/build/_modules/discord-assistant/_models/dias-knowledge.data-model.js.map +1 -0
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.d.ts +14 -0
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.d.ts.map +1 -0
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.js +88 -0
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.js.map +1 -0
- package/build/_modules/discord-assistant/_services/dias-io.control-service.d.ts +10 -0
- package/build/_modules/discord-assistant/_services/dias-io.control-service.d.ts.map +1 -0
- package/build/_modules/discord-assistant/_services/dias-io.control-service.js +40 -0
- package/build/_modules/discord-assistant/_services/dias-io.control-service.js.map +1 -0
- package/build/_modules/discord-assistant/_services/dias-main.control-service.d.ts +8 -0
- package/build/_modules/discord-assistant/_services/dias-main.control-service.d.ts.map +1 -0
- package/build/_modules/discord-assistant/_services/dias-main.control-service.js +23 -0
- package/build/_modules/discord-assistant/_services/dias-main.control-service.js.map +1 -0
- package/build/_modules/discord-assistant/_services/dias.service-base.d.ts +11 -0
- package/build/_modules/discord-assistant/_services/dias.service-base.d.ts.map +1 -0
- package/build/_modules/discord-assistant/_services/dias.service-base.js +33 -0
- package/build/_modules/discord-assistant/_services/dias.service-base.js.map +1 -0
- package/build/_modules/discord-assistant/index.d.ts +10 -0
- package/build/_modules/discord-assistant/index.d.ts.map +1 -0
- package/build/_modules/discord-assistant/index.js +23 -0
- package/build/_modules/discord-assistant/index.js.map +1 -0
- package/build/_modules/discord-assistant-voiced/_services/dias-discord-bot.control-service.d.ts +4 -0
- package/build/_modules/discord-assistant-voiced/_services/dias-discord-bot.control-service.d.ts.map +1 -0
- package/build/_modules/discord-assistant-voiced/_services/dias-discord-bot.control-service.js +8 -0
- package/build/_modules/discord-assistant-voiced/_services/dias-discord-bot.control-service.js.map +1 -0
- package/build/_modules/discord-assistant-voiced/index.d.ts +3 -0
- package/build/_modules/discord-assistant-voiced/index.d.ts.map +1 -0
- package/build/_modules/discord-assistant-voiced/index.js +26 -0
- package/build/_modules/discord-assistant-voiced/index.js.map +1 -0
- package/build/_modules/discord-bot/_collections/dibo-default-commands.const.d.ts +3 -0
- package/build/_modules/discord-bot/_collections/dibo-default-commands.const.d.ts.map +1 -0
- package/build/_modules/discord-bot/_collections/dibo-default-commands.const.js +13 -0
- package/build/_modules/discord-bot/_collections/dibo-default-commands.const.js.map +1 -0
- package/build/_modules/discord-bot/_collections/dibo-global-settings.conts.d.ts +3 -0
- package/build/_modules/discord-bot/_collections/dibo-global-settings.conts.d.ts.map +1 -0
- package/build/_modules/discord-bot/_collections/dibo-global-settings.conts.js +44 -0
- package/build/_modules/discord-bot/_collections/dibo-global-settings.conts.js.map +1 -0
- package/build/_modules/discord-bot/_collections/dibo-operations.util.d.ts +22 -0
- package/build/_modules/discord-bot/_collections/dibo-operations.util.d.ts.map +1 -0
- package/build/_modules/discord-bot/_collections/dibo-operations.util.js +261 -0
- package/build/_modules/discord-bot/_collections/dibo-operations.util.js.map +1 -0
- package/build/_modules/discord-bot/_models/dibo-command.interface.d.ts +8 -0
- package/build/_modules/discord-bot/_models/dibo-command.interface.d.ts.map +1 -0
- package/build/_modules/discord-bot/_models/dibo-command.interface.js +3 -0
- package/build/_modules/discord-bot/_models/dibo-command.interface.js.map +1 -0
- package/build/_modules/discord-bot/_models/dibo-last-mention-date.inteface.d.ts +7 -0
- package/build/_modules/discord-bot/_models/dibo-last-mention-date.inteface.d.ts.map +1 -0
- package/build/_modules/discord-bot/_models/dibo-last-mention-date.inteface.js +3 -0
- package/build/_modules/discord-bot/_models/dibo-last-mention-date.inteface.js.map +1 -0
- package/build/_modules/discord-bot/_models/dibo-last-message-date.interface.d.ts +6 -0
- package/build/_modules/discord-bot/_models/dibo-last-message-date.interface.d.ts.map +1 -0
- package/build/_modules/discord-bot/_models/dibo-last-message-date.interface.js +3 -0
- package/build/_modules/discord-bot/_models/dibo-last-message-date.interface.js.map +1 -0
- package/build/_modules/discord-bot/_models/global-bot-log-settings.interface.d.ts +88 -0
- package/build/_modules/discord-bot/_models/global-bot-log-settings.interface.d.ts.map +1 -0
- package/build/_modules/discord-bot/_models/global-bot-log-settings.interface.js +3 -0
- package/build/_modules/discord-bot/_models/global-bot-log-settings.interface.js.map +1 -0
- package/build/_modules/discord-bot/_services/dibo-commands.control-service.d.ts +12 -0
- package/build/_modules/discord-bot/_services/dibo-commands.control-service.d.ts.map +1 -0
- package/build/_modules/discord-bot/_services/dibo-commands.control-service.js +72 -0
- package/build/_modules/discord-bot/_services/dibo-commands.control-service.js.map +1 -0
- package/build/_modules/discord-bot/_services/dibo-io.control-service.d.ts +19 -0
- package/build/_modules/discord-bot/_services/dibo-io.control-service.d.ts.map +1 -0
- package/build/_modules/discord-bot/_services/dibo-io.control-service.js +176 -0
- package/build/_modules/discord-bot/_services/dibo-io.control-service.js.map +1 -0
- package/build/_modules/discord-bot/_services/dibo-main.control-service.d.ts +85 -0
- package/build/_modules/discord-bot/_services/dibo-main.control-service.d.ts.map +1 -0
- package/build/_modules/discord-bot/_services/dibo-main.control-service.js +228 -0
- package/build/_modules/discord-bot/_services/dibo-main.control-service.js.map +1 -0
- package/build/_modules/discord-bot/_services/dibo-routines.control-service.d.ts +13 -0
- package/build/_modules/discord-bot/_services/dibo-routines.control-service.d.ts.map +1 -0
- package/build/_modules/discord-bot/_services/dibo-routines.control-service.js +38 -0
- package/build/_modules/discord-bot/_services/dibo-routines.control-service.js.map +1 -0
- package/build/_modules/discord-bot/index.d.ts +12 -0
- package/build/_modules/discord-bot/index.d.ts.map +1 -0
- package/build/_modules/discord-bot/index.js +30 -0
- package/build/_modules/discord-bot/index.js.map +1 -0
- package/build/_modules/oauth2/index.d.ts.map +1 -1
- package/build/_modules/oauth2/index.js +7 -0
- package/build/_modules/oauth2/index.js.map +1 -1
- package/build/_modules/open-ai/_collections/oai-chunking.util.d.ts +74 -0
- package/build/_modules/open-ai/_collections/oai-chunking.util.d.ts.map +1 -0
- package/build/_modules/open-ai/_collections/oai-chunking.util.js +385 -0
- package/build/_modules/open-ai/_collections/oai-chunking.util.js.map +1 -0
- package/build/_modules/open-ai/_collections/oai-document.util.d.ts +4 -0
- package/build/_modules/open-ai/_collections/oai-document.util.d.ts.map +1 -0
- package/build/_modules/open-ai/_collections/oai-document.util.js +12 -0
- package/build/_modules/open-ai/_collections/oai-document.util.js.map +1 -0
- package/build/_modules/open-ai/_collections/oai-global-settings.const.d.ts +3 -0
- package/build/_modules/open-ai/_collections/oai-global-settings.const.d.ts.map +1 -0
- package/build/_modules/open-ai/_collections/oai-global-settings.const.js +9 -0
- package/build/_modules/open-ai/_collections/oai-global-settings.const.js.map +1 -0
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests-hu.conts.d.ts +3 -0
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests-hu.conts.d.ts.map +1 -0
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests-hu.conts.js +75 -0
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests-hu.conts.js.map +1 -0
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests.conts.d.ts +3 -0
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests.conts.d.ts.map +1 -0
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests.conts.js +68 -0
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests.conts.js.map +1 -0
- package/build/_modules/open-ai/_enums/oai-compare-result-type.enum.d.ts +6 -0
- package/build/_modules/open-ai/_enums/oai-compare-result-type.enum.d.ts.map +1 -0
- package/build/_modules/open-ai/_enums/oai-compare-result-type.enum.js +10 -0
- package/build/_modules/open-ai/_enums/oai-compare-result-type.enum.js.map +1 -0
- package/build/_modules/open-ai/_enums/oai-gpt-message-role.enum.d.ts +18 -0
- package/build/_modules/open-ai/_enums/oai-gpt-message-role.enum.d.ts.map +1 -0
- package/build/_modules/open-ai/_enums/oai-gpt-message-role.enum.js +40 -0
- package/build/_modules/open-ai/_enums/oai-gpt-message-role.enum.js.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-chunk-compare-result.interface.d.ts +7 -0
- package/build/_modules/open-ai/_models/interfaces/oai-chunk-compare-result.interface.d.ts.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-chunk-compare-result.interface.js +3 -0
- package/build/_modules/open-ai/_models/interfaces/oai-chunk-compare-result.interface.js.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-document-page.interface.d.ts +15 -0
- package/build/_modules/open-ai/_models/interfaces/oai-document-page.interface.d.ts.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-document-page.interface.js +3 -0
- package/build/_modules/open-ai/_models/interfaces/oai-document-page.interface.js.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-global-settings.interface.d.ts +6 -0
- package/build/_modules/open-ai/_models/interfaces/oai-global-settings.interface.d.ts.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-global-settings.interface.js +3 -0
- package/build/_modules/open-ai/_models/interfaces/oai-global-settings.interface.js.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.d.ts +6 -0
- package/build/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.d.ts.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.js +3 -0
- package/build/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.js.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-llm-predefined-requests.interface.d.ts +52 -0
- package/build/_modules/open-ai/_models/interfaces/oai-llm-predefined-requests.interface.d.ts.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-llm-predefined-requests.interface.js +3 -0
- package/build/_modules/open-ai/_models/interfaces/oai-llm-predefined-requests.interface.js.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-page-compare-result.interface.d.ts +13 -0
- package/build/_modules/open-ai/_models/interfaces/oai-page-compare-result.interface.d.ts.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-page-compare-result.interface.js +3 -0
- package/build/_modules/open-ai/_models/interfaces/oai-page-compare-result.interface.js.map +1 -0
- package/build/_modules/open-ai/_models/oai-doc-chunk.data-model.d.ts +18 -0
- package/build/_modules/open-ai/_models/oai-doc-chunk.data-model.d.ts.map +1 -0
- package/build/_modules/open-ai/_models/oai-doc-chunk.data-model.js +80 -0
- package/build/_modules/open-ai/_models/oai-doc-chunk.data-model.js.map +1 -0
- package/build/_modules/open-ai/_services/oai-chunk.service-base.d.ts +13 -0
- package/build/_modules/open-ai/_services/oai-chunk.service-base.d.ts.map +1 -0
- package/build/_modules/open-ai/_services/oai-chunk.service-base.js +170 -0
- package/build/_modules/open-ai/_services/oai-chunk.service-base.js.map +1 -0
- package/build/_modules/open-ai/_services/{embedding.control-service.d.ts → oai-embedding.control-service.d.ts} +3 -3
- package/build/_modules/open-ai/_services/oai-embedding.control-service.d.ts.map +1 -0
- package/build/_modules/open-ai/_services/{embedding.control-service.js → oai-embedding.control-service.js} +5 -5
- package/build/_modules/open-ai/_services/oai-embedding.control-service.js.map +1 -0
- package/build/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts +181 -0
- package/build/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts.map +1 -0
- package/build/_modules/open-ai/_services/oai-llm-chat.service-base.js +344 -0
- package/build/_modules/open-ai/_services/oai-llm-chat.service-base.js.map +1 -0
- package/build/_modules/open-ai/_services/oai-llm.service-base.d.ts +234 -0
- package/build/_modules/open-ai/_services/oai-llm.service-base.d.ts.map +1 -0
- package/build/_modules/open-ai/_services/oai-llm.service-base.js +441 -0
- package/build/_modules/open-ai/_services/oai-llm.service-base.js.map +1 -0
- package/build/_modules/open-ai/_services/{vector-data.service.d.ts → oai-vector-data.service.d.ts} +4 -4
- package/build/_modules/open-ai/_services/oai-vector-data.service.d.ts.map +1 -0
- package/build/_modules/open-ai/_services/{vector-data.service.js → oai-vector-data.service.js} +27 -7
- package/build/_modules/open-ai/_services/oai-vector-data.service.js.map +1 -0
- package/build/_modules/open-ai/index.d.ts +19 -4
- package/build/_modules/open-ai/index.d.ts.map +1 -1
- package/build/_modules/open-ai/index.js +36 -4
- package/build/_modules/open-ai/index.js.map +1 -1
- package/build/_modules/server/index.d.ts +1 -1
- package/build/_modules/server/index.d.ts.map +1 -1
- package/build/_modules/server/index.js +16 -2
- package/build/_modules/server/index.js.map +1 -1
- package/build/_modules/server/server-status/server-status.controller.d.ts.map +1 -1
- package/build/_modules/server/server-status/server-status.controller.js +10 -0
- package/build/_modules/server/server-status/server-status.controller.js.map +1 -1
- package/build/_modules/socket/index.d.ts.map +1 -1
- package/build/_modules/socket/index.js +18 -0
- package/build/_modules/socket/index.js.map +1 -1
- package/build/_modules/test/index.d.ts.map +1 -1
- package/build/_modules/test/index.js +5 -0
- package/build/_modules/test/index.js.map +1 -1
- package/build/_modules/usage/index.d.ts.map +1 -1
- package/build/_modules/usage/index.js +5 -0
- package/build/_modules/usage/index.js.map +1 -1
- package/build/_services/base/data.service.d.ts +6 -0
- package/build/_services/base/data.service.d.ts.map +1 -1
- package/build/_services/base/data.service.js +6 -0
- package/build/_services/base/data.service.js.map +1 -1
- package/build/_services/base/db.service.d.ts +10 -0
- package/build/_services/base/db.service.d.ts.map +1 -1
- package/build/_services/base/db.service.js +10 -0
- package/build/_services/base/db.service.js.map +1 -1
- package/build/_services/server/app.server.js +1 -2
- package/build/_services/server/app.server.js.map +1 -1
- package/build/index.d.ts +3 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +26 -1
- package/build/index.js.map +1 -1
- package/package.json +40 -10
- package/src/_collections/atlas-default-db-options.const.ts +10 -0
- package/src/_collections/get-environment-settings.util.ts +49 -0
- package/src/_collections/global-settings.const.ts +15 -4
- package/src/_collections/sample.env +21 -0
- package/src/_models/control-models/app-params.control-model.spec.ts +5 -4
- package/src/_models/control-models/app-params.control-model.ts +31 -2
- package/src/_models/control-models/endpoint-params.control-model.ts +1 -1
- package/src/_models/interfaces/environment-settings.interface.ts +59 -0
- package/src/_models/interfaces/global-settings.interface.ts +41 -1
- package/src/_modules/custom-data/index.ts +3 -0
- package/src/_modules/discord-assistant/_collections/dias-global-settings.const.ts +19 -0
- package/src/_modules/discord-assistant/_collections/dias.util.ts +43 -0
- package/src/_modules/discord-assistant/_models/dias-global-settings.interface.ts +20 -0
- package/src/_modules/discord-assistant/_models/dias-knowledge.data-model.ts +46 -0
- package/src/_modules/discord-assistant/_services/dias-chunk.data-service.ts +152 -0
- package/src/_modules/discord-assistant/_services/dias-io.control-service.ts +64 -0
- package/src/_modules/discord-assistant/_services/dias-main.control-service.ts +28 -0
- package/src/_modules/discord-assistant/_services/dias.service-base.ts +49 -0
- package/src/_modules/discord-assistant/index.ts +36 -0
- package/src/_modules/discord-assistant-voiced/_services/dias-discord-bot.control-service.ts +11 -0
- package/src/_modules/discord-assistant-voiced/index.ts +36 -0
- package/src/_modules/discord-bot/_collections/dibo-default-commands.const.ts +17 -0
- package/src/_modules/discord-bot/_collections/dibo-global-settings.conts.ts +56 -0
- package/src/_modules/discord-bot/_collections/dibo-operations.util.ts +372 -0
- package/src/_modules/discord-bot/_models/dibo-command.interface.ts +12 -0
- package/src/_modules/discord-bot/_models/dibo-last-mention-date.inteface.ts +8 -0
- package/src/_modules/discord-bot/_models/dibo-last-message-date.interface.ts +6 -0
- package/src/_modules/discord-bot/_models/global-bot-log-settings.interface.ts +98 -0
- package/src/_modules/discord-bot/_services/dibo-commands.control-service.ts +120 -0
- package/src/_modules/discord-bot/_services/dibo-io.control-service.ts +245 -0
- package/src/_modules/discord-bot/_services/dibo-main.control-service.ts +304 -0
- package/src/_modules/discord-bot/_services/dibo-routines.control-service.ts +60 -0
- package/src/_modules/discord-bot/index.ts +36 -0
- package/src/_modules/oauth2/index.ts +8 -0
- package/src/_modules/open-ai/_collections/oai-chunking.util.ts +496 -0
- package/src/_modules/open-ai/_collections/oai-document.util.ts +10 -0
- package/src/_modules/open-ai/_collections/oai-global-settings.const.ts +9 -0
- package/src/_modules/open-ai/_collections/oai-llm-predefined-requests-hu.conts.ts +83 -0
- package/src/_modules/open-ai/_collections/oai-llm-predefined-requests.conts.ts +76 -0
- package/src/_modules/open-ai/_enums/oai-compare-result-type.enum.ts +7 -0
- package/src/_modules/open-ai/_enums/oai-gpt-message-role.enum.ts +45 -0
- package/src/_modules/open-ai/_models/interfaces/oai-chunk-compare-result.interface.ts +10 -0
- package/src/_modules/open-ai/_models/interfaces/oai-document-page.interface.ts +21 -0
- package/src/_modules/open-ai/_models/interfaces/oai-global-settings.interface.ts +8 -0
- package/src/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.ts +7 -0
- package/src/_modules/open-ai/_models/interfaces/oai-llm-predefined-requests.interface.ts +57 -0
- package/src/_modules/open-ai/_models/interfaces/oai-page-compare-result.interface.ts +18 -0
- package/src/_modules/open-ai/_models/oai-doc-chunk.data-model.ts +92 -0
- package/src/_modules/open-ai/_services/oai-chunk.service-base.ts +214 -0
- package/src/_modules/open-ai/_services/{embedding.control-service.ts → oai-embedding.control-service.ts} +2 -2
- package/src/_modules/open-ai/_services/oai-llm-chat.service-base.ts +621 -0
- package/src/_modules/open-ai/_services/oai-llm.service-base.ts +651 -0
- package/src/_modules/open-ai/_services/{vector-data.service.ts → oai-vector-data.service.ts} +32 -5
- package/src/_modules/open-ai/index.ts +43 -4
- package/src/_modules/server/index.ts +18 -2
- package/src/_modules/server/server-status/server-status.controller.ts +13 -0
- package/src/_modules/socket/index.ts +23 -0
- package/src/_modules/test/index.ts +8 -0
- package/src/_modules/usage/index.ts +8 -0
- package/src/_services/base/data.service.ts +6 -0
- package/src/_services/base/db.service.ts +10 -0
- package/src/_services/server/app.server.ts +1 -1
- package/src/index.ts +28 -1
- package/build/_modules/open-ai/_services/embedding.control-service.d.ts.map +0 -1
- package/build/_modules/open-ai/_services/embedding.control-service.js.map +0 -1
- package/build/_modules/open-ai/_services/gpt.service-base.d.ts +0 -98
- package/build/_modules/open-ai/_services/gpt.service-base.d.ts.map +0 -1
- package/build/_modules/open-ai/_services/gpt.service-base.js +0 -284
- package/build/_modules/open-ai/_services/gpt.service-base.js.map +0 -1
- package/build/_modules/open-ai/_services/open-ai.service-base.d.ts +0 -21
- package/build/_modules/open-ai/_services/open-ai.service-base.d.ts.map +0 -1
- package/build/_modules/open-ai/_services/open-ai.service-base.js +0 -50
- package/build/_modules/open-ai/_services/open-ai.service-base.js.map +0 -1
- package/build/_modules/open-ai/_services/vector-data.service.d.ts.map +0 -1
- package/build/_modules/open-ai/_services/vector-data.service.js.map +0 -1
- package/build/_services/server/env-set.d.ts +0 -2
- package/build/_services/server/env-set.d.ts.map +0 -1
- package/build/_services/server/env-set.js +0 -20
- package/build/_services/server/env-set.js.map +0 -1
- package/src/_modules/open-ai/_services/gpt.service-base.ts +0 -438
- package/src/_modules/open-ai/_services/open-ai.service-base.ts +0 -69
- package/src/_services/server/env-set.ts +0 -21
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
ENV={REPLACE_ENV}
|
|
4
|
+
|
|
5
|
+
MONGO_URI={REPLACE_ATLASDB_URI}
|
|
6
|
+
|
|
7
|
+
DISCORD_TOKEN={REPLACE_DISCORD_TOKEN}
|
|
8
|
+
DISCORD_CLIENT_ID={REPLACE_DISCORD_CLIENT_ID}
|
|
9
|
+
DISCORD_GUILD_ID={REPLACE_DISCORD_GUILD_ID}
|
|
10
|
+
DISCORD_OAUTH2_URL={REPLACE_DISCORD_OAUTH2_URL}
|
|
11
|
+
|
|
12
|
+
OPENAI_API_KEY={REPLACE_OPENAI_API_KEY}
|
|
13
|
+
OPENAI_ORGANIZATION={REPLACE_OPENAI_ORGANIZATION}
|
|
14
|
+
OPENAI_PROJECT={REPLACE_OPENAI_PROJECT}
|
|
15
|
+
OPENAI_TTS_API_KEY={REPLACE_OPENAI_TTS_API_KEY}
|
|
16
|
+
|
|
17
|
+
ELEVENLABS_API_KEY={REPLACE_ELEVENLABS_API_KEY}
|
|
18
|
+
|
|
19
|
+
CLICKUP_TOKEN={REPLACE_CLICKUP_TOKEN}
|
|
20
|
+
CLICKUP_WORKSPACE_ID={REPLACE_CLICKUP_WORKSPACE_ID}
|
|
21
|
+
CLICKUP_SPACE_ID={REPLACE_CLICKUP_SPACE_ID}
|
|
@@ -21,14 +21,15 @@ describe('| DyNTS_App_Params', () => {
|
|
|
21
21
|
expect(appParams.dbName).toBe('testdb');
|
|
22
22
|
expect(appParams.dbUri).toBe('mongodb://0.0.0.0:27017/testdb');
|
|
23
23
|
expect(appParams.systemName).toBe('Test-App');
|
|
24
|
-
expect(appParams.systemShortCodeName).toBe('
|
|
24
|
+
expect(appParams.systemShortCodeName).toBe('TA_LOCAL');
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
it('| should set default values when optional parameters are not provided', () => {
|
|
28
28
|
const params: DyNTS_App_Params = {
|
|
29
29
|
name: 'TestApp',
|
|
30
30
|
version: '1.0.0',
|
|
31
|
-
dbName: 'testdb'
|
|
31
|
+
dbName: 'testdb',
|
|
32
|
+
dontUseEnvInSystemShortCodeName: true,
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
const appParams = new DyNTS_App_Params(params);
|
|
@@ -47,12 +48,12 @@ describe('| DyNTS_App_Params', () => {
|
|
|
47
48
|
name: 'Test Application',
|
|
48
49
|
version: '1.0.0',
|
|
49
50
|
dbName: 'testdb',
|
|
50
|
-
systemName: 'Test-App'
|
|
51
|
+
systemName: 'Test-App',
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
const appParams = new DyNTS_App_Params(params);
|
|
54
55
|
|
|
55
|
-
expect(appParams.systemShortCodeName).toBe('
|
|
56
|
+
expect(appParams.systemShortCodeName).toBe('TA_LOCAL');
|
|
56
57
|
});
|
|
57
58
|
|
|
58
59
|
it('| should generate systemName from name if not provided', () => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DyFM_Log } from '@futdevpro/fsm-dynamo';
|
|
2
2
|
import { ConnectOptions } from 'mongoose';
|
|
3
|
+
import { DyNTS_global_settings } from '../../_collections/global-settings.const';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* This will hold and set the basic settings of an application
|
|
@@ -37,6 +38,11 @@ export class DyNTS_App_Params {
|
|
|
37
38
|
|
|
38
39
|
readonly openHost?: string;
|
|
39
40
|
readonly secureHost?: string;
|
|
41
|
+
/**
|
|
42
|
+
* specify the maximum
|
|
43
|
+
* length of the queue of pending connections.
|
|
44
|
+
* The actual length will be determined by the OS through sysctl.
|
|
45
|
+
* */
|
|
40
46
|
readonly expressBacklog?: number;
|
|
41
47
|
|
|
42
48
|
/**
|
|
@@ -47,6 +53,7 @@ export class DyNTS_App_Params {
|
|
|
47
53
|
* short code name of the system
|
|
48
54
|
*/
|
|
49
55
|
readonly systemShortCodeName?: string;
|
|
56
|
+
readonly dontUseEnvInSystemShortCodeName?: boolean;
|
|
50
57
|
|
|
51
58
|
constructor(
|
|
52
59
|
set: DyNTS_App_Params
|
|
@@ -54,15 +61,37 @@ export class DyNTS_App_Params {
|
|
|
54
61
|
this.name = set.name;
|
|
55
62
|
this.title = set.title ?? '';
|
|
56
63
|
this.version = set.version;
|
|
64
|
+
|
|
57
65
|
if (set.dbName || set.dbUri || set.dbOptions) {
|
|
58
66
|
this.dbName = set.dbName;
|
|
59
|
-
|
|
67
|
+
|
|
68
|
+
if (!set.dbUri) {
|
|
69
|
+
if (DyNTS_global_settings.env_settings.mongoUri) {
|
|
70
|
+
if (set.dbName) {
|
|
71
|
+
this.dbUri = `${DyNTS_global_settings.env_settings.mongoUri}/${set.dbName}`;
|
|
72
|
+
} else {
|
|
73
|
+
this.dbUri = DyNTS_global_settings.env_settings.mongoUri;
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
this.dbUri = `mongodb://0.0.0.0:27017/${set.dbName}`;
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
this.dbUri = set.dbUri;
|
|
80
|
+
}
|
|
81
|
+
|
|
60
82
|
this.dbOptions = set.dbOptions ?? {
|
|
61
83
|
directConnection: true,
|
|
62
84
|
};
|
|
63
85
|
}
|
|
86
|
+
|
|
64
87
|
this.systemName = set.systemName ?? this.name.replace(' ', '-');
|
|
65
|
-
|
|
88
|
+
let sysShortCodeName: string;
|
|
89
|
+
sysShortCodeName = set.systemShortCodeName ?? this.systemName.replace(/[^A-Z]/g, '');
|
|
90
|
+
if (!set.dontUseEnvInSystemShortCodeName) {
|
|
91
|
+
sysShortCodeName += '_' + DyNTS_global_settings.env_settings.environment.toUpperCase();
|
|
92
|
+
}
|
|
93
|
+
this.systemShortCodeName = sysShortCodeName;
|
|
94
|
+
|
|
66
95
|
this.openHost = set.openHost ?? '0.0.0.0';
|
|
67
96
|
this.secureHost = set.secureHost ?? '0.0.0.0';
|
|
68
97
|
this.expressBacklog = set.expressBacklog ?? 0;
|
|
@@ -348,7 +348,7 @@ export class DyNTS_Endpoint_Params<
|
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
if (
|
|
351
|
-
DyNTS_global_settings.environment === DyFM_EnvironmentFlag.prod &&
|
|
351
|
+
DyNTS_global_settings.env_settings.environment === DyFM_EnvironmentFlag.prod &&
|
|
352
352
|
error instanceof DyFM_Error
|
|
353
353
|
) {
|
|
354
354
|
delete (error as DyFM_Error).confidentialContent;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { DyFM_EnvironmentFlag } from '@futdevpro/fsm-dynamo';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export interface DyNTS_Environment_Settings {
|
|
6
|
+
/**
|
|
7
|
+
* this is the environment flag of the system
|
|
8
|
+
* e.g. local, development, production
|
|
9
|
+
*
|
|
10
|
+
* use ENV or ENVIRONMENT in the .env file to set the environment
|
|
11
|
+
*
|
|
12
|
+
* use {@link DyFM_EnvironmentFlag} for consistent system processes
|
|
13
|
+
*/
|
|
14
|
+
environment: DyFM_EnvironmentFlag;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* this is the discord settings of the system
|
|
18
|
+
*/
|
|
19
|
+
discord: {
|
|
20
|
+
token: string;
|
|
21
|
+
clientId: string;
|
|
22
|
+
guildId: string;
|
|
23
|
+
oauth2Url: string;
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* this is the mongo uri of the system
|
|
28
|
+
*/
|
|
29
|
+
mongoUri: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* this is the openai settings of the system
|
|
33
|
+
*/
|
|
34
|
+
openAi: {
|
|
35
|
+
apiKey: string;
|
|
36
|
+
organization: string;
|
|
37
|
+
project: string;
|
|
38
|
+
ttsApiKey: string;
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* this is the elevenlabs settings of the system
|
|
43
|
+
*/
|
|
44
|
+
/* elevenLabs: {
|
|
45
|
+
apiKey: string;
|
|
46
|
+
}, */
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* this is the clickup settings of the system
|
|
50
|
+
*/
|
|
51
|
+
/* clickup: {
|
|
52
|
+
apiKey: string;
|
|
53
|
+
workspaceId: string;
|
|
54
|
+
spaceId: string;
|
|
55
|
+
listId: string;
|
|
56
|
+
}, */
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
|
|
@@ -2,6 +2,7 @@ import { DyFM_EnvironmentFlag } from '@futdevpro/fsm-dynamo';
|
|
|
2
2
|
import { DyNTS_RouteSecurity } from '../../_enums/route-security.enum';
|
|
3
3
|
import { DyNTS_SocketSecurity } from '../../_modules/socket/_enums/socket-security.enum';
|
|
4
4
|
import { DyNTS_GlobalLog_Settings } from './global-log-settings.interface';
|
|
5
|
+
import { DyNTS_Environment_Settings } from './environment-settings.interface';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
*
|
|
@@ -12,6 +13,9 @@ import { DyNTS_GlobalLog_Settings } from './global-log-settings.interface';
|
|
|
12
13
|
*
|
|
13
14
|
*/
|
|
14
15
|
export interface DyNTS_Global_Settings {
|
|
16
|
+
|
|
17
|
+
env_settings: DyNTS_Environment_Settings;
|
|
18
|
+
|
|
15
19
|
/**
|
|
16
20
|
* this will be used as the main baseUrl for the application,
|
|
17
21
|
* this is not required, but we suggest to use at least a '/api' as base route
|
|
@@ -59,7 +63,7 @@ export interface DyNTS_Global_Settings {
|
|
|
59
63
|
/**
|
|
60
64
|
* this is the environment of the system
|
|
61
65
|
*/
|
|
62
|
-
environment: DyFM_EnvironmentFlag;
|
|
66
|
+
/* environment: DyFM_EnvironmentFlag; */
|
|
63
67
|
|
|
64
68
|
/**
|
|
65
69
|
* this setting will set which logs will be shown
|
|
@@ -70,4 +74,40 @@ export interface DyNTS_Global_Settings {
|
|
|
70
74
|
* this setting will set the research issues mode for the system
|
|
71
75
|
*/
|
|
72
76
|
autoResearchIssues: boolean;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* this setting will set the bot settings
|
|
80
|
+
* (this will be set in the {@link DyNTS_DiBo_Main_ControlService} constructor)
|
|
81
|
+
*
|
|
82
|
+
* {@link DyNTS_GlobalBot_Settings}
|
|
83
|
+
* default settings: {@link DyNTS_DiBo_Global_Settings}
|
|
84
|
+
*/
|
|
85
|
+
bot_settings: any;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* this setting will set the openai settings
|
|
89
|
+
* (this will be set in the {@link DyNTS_OAI_LLMChat_ServiceBase} constructor)
|
|
90
|
+
*
|
|
91
|
+
* {@link DyNTS_OpenAI_Settings}
|
|
92
|
+
* default settings: {@link DyNTS_OAI_global_settings}
|
|
93
|
+
*/
|
|
94
|
+
openAi_settings: any;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* this setting will set the dias settings
|
|
98
|
+
* (this will be set in the {@link DyNTS_OAI_LLM_ServiceBase} constructor, if not set already)
|
|
99
|
+
* ({@link DyNTS_OAI_VectorDataService} is not using this, but its own settings)
|
|
100
|
+
*
|
|
101
|
+
* {@link DyNTS_DiAs_Global_Settings}
|
|
102
|
+
* default settings: {@link DyNTS_DiAs_Global_Settings}
|
|
103
|
+
*/
|
|
104
|
+
dias_settings: any;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* this setting will set the doc chunking settings
|
|
108
|
+
*/
|
|
109
|
+
docChunking: {
|
|
110
|
+
maxChunkSize: number;
|
|
111
|
+
maxChunkCount: number;
|
|
112
|
+
};
|
|
73
113
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DyNTS_OAI_LLMDefaultPredefined_Requests } from '../../open-ai/_collections/oai-llm-predefined-requests.conts';
|
|
2
|
+
import { DyNTS_DiAs_Global_Settings } from '../_models/dias-global-settings.interface';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export const DyNTS_DiAs_global_settings: DyNTS_DiAs_Global_Settings = {
|
|
6
|
+
defaultSystemPrompt:
|
|
7
|
+
DyNTS_OAI_LLMDefaultPredefined_Requests.defaultSystemPrompt +
|
|
8
|
+
'You communicate via a multi-user interface, such as a Discord channel. ',
|
|
9
|
+
|
|
10
|
+
skipConversationMessagesFlags: [
|
|
11
|
+
'|NOISE]',
|
|
12
|
+
'[VOICE|USER|OUT_OF_CONTEXT]',
|
|
13
|
+
'[DEBUG|'
|
|
14
|
+
],
|
|
15
|
+
userTranslationFlags: [
|
|
16
|
+
'[VOICE|USER',
|
|
17
|
+
],
|
|
18
|
+
}
|
|
19
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Message } from 'discord.js';
|
|
2
|
+
import { DyNTS_OAI_GPT_Message } from '../../open-ai/_models/interfaces/oai-gpt-message.interface';
|
|
3
|
+
import { DyNTS_DiAs_global_settings } from './dias-global-settings.const';
|
|
4
|
+
import { DyNTS_OAI_GPT_Message_Role } from '../../open-ai';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export class DyNTS_DiAs_Util {
|
|
8
|
+
|
|
9
|
+
static convertDiscordMessagesToOAIConversation(
|
|
10
|
+
messages: Message[],
|
|
11
|
+
botClientId: string,
|
|
12
|
+
botDisplayName: string,
|
|
13
|
+
): DyNTS_OAI_GPT_Message[] {
|
|
14
|
+
|
|
15
|
+
return messages.map(message => {
|
|
16
|
+
if (
|
|
17
|
+
(message?.author &&
|
|
18
|
+
(message.author.bot ||
|
|
19
|
+
message.author.id === botClientId ||
|
|
20
|
+
message.author.displayName === botDisplayName))
|
|
21
|
+
) {
|
|
22
|
+
if (DyNTS_DiAs_global_settings.userTranslationFlags.some(
|
|
23
|
+
flag => message.content.includes(flag)
|
|
24
|
+
)) {
|
|
25
|
+
return {
|
|
26
|
+
role: DyNTS_OAI_GPT_Message_Role.user,
|
|
27
|
+
content: message.content,
|
|
28
|
+
};
|
|
29
|
+
} else {
|
|
30
|
+
return {
|
|
31
|
+
role: DyNTS_OAI_GPT_Message_Role.assistant,
|
|
32
|
+
content: message.content,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
return {
|
|
37
|
+
role: DyNTS_OAI_GPT_Message_Role.user,
|
|
38
|
+
content: message.content,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export interface DyNTS_DiAs_Global_Settings {
|
|
4
|
+
defaultSystemPrompt: string;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* These flags are used to skip messages from the conversation
|
|
8
|
+
* so these messages will not be included in the conversation for the LLM call
|
|
9
|
+
*
|
|
10
|
+
* default: [ '|NOISE]', '[VOICE|USER|OUT_OF_CONTEXT]', '[DEBUG|' ]
|
|
11
|
+
*/
|
|
12
|
+
skipConversationMessagesFlags: string[];
|
|
13
|
+
/**
|
|
14
|
+
* These flags are used to identify messages that are sent by the bot, but comes from the user
|
|
15
|
+
* so these messages will appear as user messages in the conversation for the LLM call
|
|
16
|
+
*
|
|
17
|
+
* default: [ '[VOICE|USER' ]
|
|
18
|
+
*/
|
|
19
|
+
userTranslationFlags: string[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { DyFM_DataModel_Params, DyFM_Metadata } from '@futdevpro/fsm-dynamo';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export class DyNTS_DiAs_Knowledge extends DyFM_Metadata {
|
|
6
|
+
|
|
7
|
+
subject?: string;
|
|
8
|
+
subjectVectorized?: number[] = [];
|
|
9
|
+
|
|
10
|
+
description?: string;
|
|
11
|
+
descriptionVectorized?: number[] = [];
|
|
12
|
+
|
|
13
|
+
constructor(
|
|
14
|
+
set?: DyNTS_DiAs_Knowledge,
|
|
15
|
+
) {
|
|
16
|
+
super(set);
|
|
17
|
+
|
|
18
|
+
if (set) {
|
|
19
|
+
Object.assign(this, set);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const DyNTS_DiAs_knowledge_dataParams = new DyFM_DataModel_Params<DyNTS_DiAs_Knowledge>({
|
|
25
|
+
dataName: 'dias_knowledge',
|
|
26
|
+
properties: {
|
|
27
|
+
subject: {
|
|
28
|
+
type: 'string', index: true,
|
|
29
|
+
required: true, unique: true,
|
|
30
|
+
},
|
|
31
|
+
subjectVectorized: {
|
|
32
|
+
type: 'number[]',
|
|
33
|
+
vectorizedFrom: 'subject',
|
|
34
|
+
vectorizeUseIndex: 'subject',
|
|
35
|
+
},
|
|
36
|
+
description: {
|
|
37
|
+
type: 'string', index: true,
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
descriptionVectorized: {
|
|
41
|
+
type: 'number[]',
|
|
42
|
+
vectorizedFrom: 'description',
|
|
43
|
+
vectorizeUseIndex: 'description',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
});
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyNTS_OAI_DocChunk } from '../../open-ai/_models/oai-doc-chunk.data-model';
|
|
3
|
+
import { DyNTS_OAI_Chunk_ServiceBase } from '../../open-ai/_services/oai-chunk.service-base';
|
|
4
|
+
import { DyFM_Error, DyFM_Log } from '@futdevpro/fsm-dynamo';
|
|
5
|
+
import { DyFM_OpenAI_Settings, DyFM_OpenAIModel } from '@futdevpro/fsm-dynamo/open-ai';
|
|
6
|
+
import { DyNTS_DiAs_Main_ControlService } from './dias-main.control-service';
|
|
7
|
+
import { DyNTS_OAI_LLMChat_ServiceBase } from '../../open-ai/_services/oai-llm-chat.service-base';
|
|
8
|
+
import { DyNTS_OAI_GPT_Message } from '../../open-ai/_models/interfaces/oai-gpt-message.interface';
|
|
9
|
+
import { DyNTS_OAI_LLMDefaultPredefined_Requests } from '../../open-ai/_collections/oai-llm-predefined-requests.conts';
|
|
10
|
+
import { DyNTS_OAI_Document_Util } from '../../open-ai/_collections/oai-document.util';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export abstract class DyNTS_DiAs_Chunk_DataService extends DyNTS_OAI_Chunk_ServiceBase {
|
|
14
|
+
|
|
15
|
+
protected abstract readonly mainDiscordBot_CS: DyNTS_DiAs_Main_ControlService;
|
|
16
|
+
|
|
17
|
+
get llmChat_CS(): DyNTS_OAI_LLMChat_ServiceBase {
|
|
18
|
+
return this.mainDiscordBot_CS.llmChat_CS;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
constructor(
|
|
22
|
+
issuer: string,
|
|
23
|
+
) {
|
|
24
|
+
super(issuer);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async resolveConversation(
|
|
28
|
+
conversation: DyNTS_OAI_GPT_Message[],
|
|
29
|
+
): Promise<string> {
|
|
30
|
+
try {
|
|
31
|
+
DyFM_Log.info('🔍 Document message received:', conversation[conversation.length - 1].content);
|
|
32
|
+
|
|
33
|
+
const vectorSearchNeeded: boolean = await this.llmChat_CS.yesNoQuestionInConversation(
|
|
34
|
+
conversation,
|
|
35
|
+
DyNTS_OAI_LLMDefaultPredefined_Requests.vectorSearch.doWeNeedVectorSearch,
|
|
36
|
+
this.issuer,
|
|
37
|
+
false,
|
|
38
|
+
{
|
|
39
|
+
systemPrompt: DyNTS_OAI_LLMDefaultPredefined_Requests.defaultSystemPrompt,
|
|
40
|
+
},
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
let result: string;
|
|
44
|
+
if (vectorSearchNeeded) {
|
|
45
|
+
result = await this.vectorSearchAndResolveConversation(conversation, 10, 200);
|
|
46
|
+
} else {
|
|
47
|
+
result = await this.llmChat_CS.resolveConversation(
|
|
48
|
+
conversation,
|
|
49
|
+
this.issuer,
|
|
50
|
+
{
|
|
51
|
+
systemPrompt: DyNTS_OAI_LLMDefaultPredefined_Requests.defaultSystemPrompt,
|
|
52
|
+
},
|
|
53
|
+
) as string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return result;
|
|
57
|
+
} catch (error) {
|
|
58
|
+
throw new DyFM_Error({
|
|
59
|
+
...this.getDefaultErrorSettings('resolveMessage', error),
|
|
60
|
+
errorCode: 'QDB-DCHDS-RM0',
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// TODO
|
|
66
|
+
// add code overview by coding policies
|
|
67
|
+
// (Milyen jellegű coding policies lehet releváns az adott kérdésben)
|
|
68
|
+
async vectorSearchAndResolveConversation(
|
|
69
|
+
conversation: DyNTS_OAI_GPT_Message[],
|
|
70
|
+
limit: number = 3,
|
|
71
|
+
numberOfCandidates: number = 100,
|
|
72
|
+
): Promise<string> {
|
|
73
|
+
try {
|
|
74
|
+
const searchResults: DyNTS_OAI_DocChunk[] = await this.vectorSearchUsingConversation(
|
|
75
|
+
conversation,
|
|
76
|
+
limit,
|
|
77
|
+
numberOfCandidates,
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const parsedSearchResults: string = searchResults.map((result) => {
|
|
81
|
+
return '' +
|
|
82
|
+
'\npage: ' + result.documentName +
|
|
83
|
+
'\npageLink: ' + DyNTS_OAI_Document_Util.getClickupPageLink(
|
|
84
|
+
result.documentName,
|
|
85
|
+
result.workspaceId,
|
|
86
|
+
result.documentId,
|
|
87
|
+
result.documentPageId
|
|
88
|
+
) +
|
|
89
|
+
'\ncontent: ' +
|
|
90
|
+
`\n${result.chunkParentedContent.replace(/\n/g, '\n ')}`
|
|
91
|
+
}).join('\n\n');
|
|
92
|
+
|
|
93
|
+
DyFM_Log.H_success(`✅ Document search results:`, parsedSearchResults);
|
|
94
|
+
|
|
95
|
+
const result: string = await this.llmChat_CS.resolveConversation(
|
|
96
|
+
conversation,
|
|
97
|
+
this.issuer,
|
|
98
|
+
{
|
|
99
|
+
systemPrompt:
|
|
100
|
+
DyNTS_OAI_LLMDefaultPredefined_Requests.defaultSystemPrompt +
|
|
101
|
+
DyNTS_OAI_LLMDefaultPredefined_Requests.vectorSearch.resolveSearchResults +
|
|
102
|
+
parsedSearchResults,
|
|
103
|
+
}
|
|
104
|
+
) as string;
|
|
105
|
+
|
|
106
|
+
return result;
|
|
107
|
+
} catch (error) {
|
|
108
|
+
throw new DyFM_Error({
|
|
109
|
+
...this.getDefaultErrorSettings('searchInfoInDocumentsAndAnswer', error),
|
|
110
|
+
errorCode: 'QDB-DCHDS-SIIA0',
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// TODO: EZT KELL HÍVNI PARANCSRA
|
|
116
|
+
async vectorSearchUsingConversation(
|
|
117
|
+
conversation: DyNTS_OAI_GPT_Message[],
|
|
118
|
+
limit: number = 3,
|
|
119
|
+
numberOfCandidates: number = 100,
|
|
120
|
+
): Promise<DyNTS_OAI_DocChunk[]> {
|
|
121
|
+
try {
|
|
122
|
+
const lastMessage: DyNTS_OAI_GPT_Message = conversation[conversation.length - 1];
|
|
123
|
+
|
|
124
|
+
const searchQuestion: string = await this.llmChat_CS.getAnswerInConversation(
|
|
125
|
+
conversation,
|
|
126
|
+
DyNTS_OAI_LLMDefaultPredefined_Requests.vectorSearch.getSearchQuestion,
|
|
127
|
+
this.issuer,
|
|
128
|
+
{
|
|
129
|
+
systemPrompt:
|
|
130
|
+
DyNTS_OAI_LLMDefaultPredefined_Requests.defaultSystemPrompt +
|
|
131
|
+
DyNTS_OAI_LLMDefaultPredefined_Requests.vectorSearch.systemPrompt,
|
|
132
|
+
},
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
DyFM_Log.testInfo('🔍 Document search question:', searchQuestion);
|
|
136
|
+
|
|
137
|
+
const searchResults: DyNTS_OAI_DocChunk[] = await this.vectorSearch(
|
|
138
|
+
searchQuestion + ' ' + lastMessage.content,
|
|
139
|
+
'chunkParentedContentVectorized',
|
|
140
|
+
limit,
|
|
141
|
+
numberOfCandidates,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
return searchResults;
|
|
145
|
+
} catch (error) {
|
|
146
|
+
throw new DyFM_Error({
|
|
147
|
+
...this.getDefaultErrorSettings('vectorSearchUsingConversation', error),
|
|
148
|
+
errorCode: 'QDB-DCHDS-VSUC0',
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Client, GatewayIntentBits, Guild, Collection, GuildMember, Message, TextChannel } from 'discord.js'
|
|
2
|
+
import * as dotenv from 'dotenv'
|
|
3
|
+
import { DyFM_Error, DyFM_Log, hour, week } from '@futdevpro/fsm-dynamo'
|
|
4
|
+
import { DyNTS_global_settings } from '../../../_collections/global-settings.const'
|
|
5
|
+
import { DyNTS_DiBo_IO_ControlService } from '../../discord-bot'
|
|
6
|
+
import { DyNTS_DiAs_Main_ControlService } from './dias-main.control-service'
|
|
7
|
+
import { DyNTS_DiBo_global_settings } from '../../discord-bot/_collections/dibo-global-settings.conts'
|
|
8
|
+
import { DyNTS_OAI_LLMChat_ServiceBase } from '../../open-ai/_services/oai-llm-chat.service-base'
|
|
9
|
+
import { DyNTS_OAI_GPT_Message } from '../../open-ai/_models/interfaces/oai-gpt-message.interface'
|
|
10
|
+
import { DyNTS_DiAs_Util } from '../_collections/dias.util'
|
|
11
|
+
|
|
12
|
+
export abstract class DyNTS_DiAs_IO_ControlService extends DyNTS_DiBo_IO_ControlService {
|
|
13
|
+
|
|
14
|
+
/* static override getInstance(): DyNTS_DiAs_IO_ControlService {
|
|
15
|
+
return DyNTS_DiAs_IO_ControlService.getSingletonInstance();
|
|
16
|
+
} */
|
|
17
|
+
|
|
18
|
+
/* abstract override getMainDiscordBotControlService(): DyNTS_DiAs_Main_ControlService; */
|
|
19
|
+
protected abstract override readonly mainDiscordBot_CS: DyNTS_DiAs_Main_ControlService;
|
|
20
|
+
/* =
|
|
21
|
+
this.getMainDiscordBotControlService(); */
|
|
22
|
+
|
|
23
|
+
get llmChat_CS(): DyNTS_OAI_LLMChat_ServiceBase {
|
|
24
|
+
return this.mainDiscordBot_CS.llmChat_CS;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
override async handleMessage(message: Message, issuer: string): Promise<void> {
|
|
28
|
+
try {
|
|
29
|
+
const messages: Message[] = await this.mainDiscordBot_CS.gatherMessages(message);
|
|
30
|
+
const oaiMessages: DyNTS_OAI_GPT_Message[] =
|
|
31
|
+
DyNTS_DiAs_Util.convertDiscordMessagesToOAIConversation(
|
|
32
|
+
messages,
|
|
33
|
+
this.mainDiscordBot_CS.botClientId,
|
|
34
|
+
this.mainDiscordBot_CS.botDisplayName,
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const gptResult: string = await this.llmChat_CS.resolveConversation(
|
|
38
|
+
oaiMessages,
|
|
39
|
+
issuer,
|
|
40
|
+
{
|
|
41
|
+
systemPrompt: this.mainDiscordBot_CS.defaultSystemPrompt,
|
|
42
|
+
}
|
|
43
|
+
) as string;
|
|
44
|
+
|
|
45
|
+
await message.reply(gptResult);
|
|
46
|
+
} catch (error) {
|
|
47
|
+
DyFM_Error.logSimple('❌❌ Error handleNewMessage:', error);
|
|
48
|
+
|
|
49
|
+
if (DyNTS_DiBo_global_settings.debugLevel >= 1) {
|
|
50
|
+
await message.reply(
|
|
51
|
+
`[SYSTEM|ERROR] Error occurred while handling the message:\n` +
|
|
52
|
+
DyFM_Error.getAnyMessage(error)
|
|
53
|
+
).catch(error => {
|
|
54
|
+
DyFM_Error.logSimple('❌❌ Error sending message to report channel:', error);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
throw new DyFM_Error({
|
|
59
|
+
...this.getDefaultErrorSettings('handleMessage', error, issuer),
|
|
60
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiAs-IOCS-H0`,
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_Error, DyFM_Log, DyFM_clone, DyFM_wait } from '@futdevpro/fsm-dynamo';
|
|
3
|
+
import { Channel, Message, Role, TextChannel } from 'discord.js';
|
|
4
|
+
import { DyNTS_DiBo_Main_ControlService } from '../../discord-bot/_services/dibo-main.control-service';
|
|
5
|
+
import { DyNTS_DiAs_ServiceBase } from './dias.service-base';
|
|
6
|
+
import { DyNTS_DiAs_IO_ControlService } from './dias-io.control-service';
|
|
7
|
+
import { DyNTS_global_settings } from '../../..';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export abstract class DyNTS_DiAs_Main_ControlService extends DyNTS_DiAs_ServiceBase {
|
|
11
|
+
|
|
12
|
+
protected abstract override botIO_CS: DyNTS_DiAs_IO_ControlService;
|
|
13
|
+
protected abstract override getBotIOControlService(): DyNTS_DiAs_IO_ControlService;
|
|
14
|
+
|
|
15
|
+
override async start(issuer: string): Promise<void> {
|
|
16
|
+
try {
|
|
17
|
+
await super.start(issuer);
|
|
18
|
+
|
|
19
|
+
this.botIO_CS = this.getBotIOControlService();
|
|
20
|
+
} catch (error) {
|
|
21
|
+
DyFM_Error.logSimple('❌❌ Error start:', error);
|
|
22
|
+
throw new DyFM_Error({
|
|
23
|
+
...this.getDefaultErrorSettings('start', error, 'system-init'),
|
|
24
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiAs-MCS-S0`,
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|