@futdevpro/nts-dynamo 1.15.1 → 1.15.3
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/.cursor/rules/__assistant_guide.mdc +30 -0
- package/.cursor/rules/__main.mdc +62 -0
- package/.cursor/rules/_ag_backend-structure.mdc +86 -0
- package/.cursor/rules/_ag_backend.mdc +16 -0
- package/.cursor/rules/_ag_debug.mdc +8 -0
- package/.cursor/rules/_ag_documentation_writing_rules.mdc +372 -0
- package/.cursor/rules/_ag_file-refactoring.mdc +113 -0
- package/.cursor/rules/_ag_fixes_rules.mdc +6 -0
- package/.cursor/rules/_ag_frontend-structure.mdc +87 -0
- package/.cursor/rules/_ag_frontend.mdc +40 -0
- package/.cursor/rules/_ag_import-rules.mdc +45 -0
- package/.cursor/rules/_ag_naming.mdc +116 -0
- package/.cursor/rules/_ag_running_commands.mdc +5 -0
- package/.cursor/rules/_ag_server-controller.mdc +6 -0
- package/.cursor/rules/_ag_should-be.mdc +7 -0
- package/.cursor/rules/_ag_swearing.mdc +47 -0
- package/.cursor/rules/ai_development_guide.md +61 -0
- package/.cursor/rules/ai_directives.md +114 -0
- package/.cursor/rules/cursor-rules.md +160 -0
- package/.cursor/rules/default-command.mdc +229 -0
- package/.cursor/rules/error_code_pattern.md +40 -0
- package/.cursor/rules/saved rule mcp server use.md +16 -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 +6 -1
- package/build/_models/control-models/app-params.control-model.js.map +1 -1
- package/build/_modules/custom-data/custom-data.controller.d.ts.map +1 -1
- package/build/_modules/custom-data/custom-data.controller.js +1 -2
- package/build/_modules/custom-data/custom-data.controller.js.map +1 -1
- package/build/_services/core/api.service.d.ts.map +1 -1
- package/build/_services/core/api.service.js +1 -0
- package/build/_services/core/api.service.js.map +1 -1
- package/build/_services/server/app.server.d.ts.map +1 -1
- package/build/_services/server/app.server.js +11 -0
- package/build/_services/server/app.server.js.map +1 -1
- package/package.json +5 -4
- package/scripts/run-coverage-tests.js +5 -1
- package/spec/support/helpers/spec-reporter-loader.js +359 -0
- package/spec/support/helpers/ts-node-helper.js +84 -0
- package/spec/support/jasmine.coverage.json +2 -1
- package/spec/support/jasmine.json +3 -3
- package/src/_collections/archive.util.spec.ts +36 -0
- package/src/_collections/get-environment-settings.util.spec.ts +210 -0
- package/src/_collections/star.controller.spec.ts +224 -0
- package/src/_models/control-models/api-call-params.control-model.spec.ts +62 -3
- package/src/_models/control-models/app-ext-system-controls.control-model.spec.ts +52 -0
- package/src/_models/control-models/app-params.control-model.spec.ts +158 -2
- package/src/_models/control-models/app-params.control-model.ts +8 -2
- package/src/_models/control-models/endpoint-params.control-model.spec.ts +578 -0
- package/src/_modules/ai/_modules/document-ai/_collections/dai-chunking.util.spec.ts +242 -0
- package/src/_modules/ai/_modules/document-ai/_collections/dai-document.util.spec.ts +209 -0
- package/src/_modules/ai/_modules/open-ai/_services/data-services/oai-document.data-service.spec.ts +342 -0
- package/src/_modules/ai/_modules/open-ai/_services/data-services/oai-vector-data.service.spec.ts +550 -0
- package/src/_modules/ai/_modules/open-ai/_services/oai-embedding.control-service.spec.ts +240 -0
- package/src/_modules/ai/_modules/open-ai/_services/oai-llm-chat.service-base.spec.ts +462 -0
- package/src/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.spec.ts +437 -0
- package/src/_modules/ai/_services/ai-embedding.service-base.spec.ts +98 -0
- package/src/_modules/ai/_services/ai-llm-chat.service-base.spec.ts +229 -0
- package/src/_modules/ai/_services/ai-llm.service-base.spec.ts +250 -0
- package/src/_modules/ai/_services/ai-provider.service-base.spec.ts +79 -0
- package/src/_modules/assistant/_collections/ass.util.spec.ts +176 -0
- package/src/_modules/assistant/_services/ass-io.control-service.spec.ts +140 -0
- package/src/_modules/assistant/_services/ass-main.control-service.spec.ts +192 -0
- package/src/_modules/bot/_modules/discord-bot/_services/dib-messaging-provider.control-service.spec.ts +431 -0
- package/src/_modules/bot/_modules/dynamo-bot/_collections/dyb-operations.util.spec.ts +160 -0
- package/src/_modules/bot/_modules/dynamo-bot/_services/dyb-messaging-provider.control-service.spec.ts +374 -0
- package/src/_modules/bot/_modules/slack-bot/_services/slb-messaging-provider.control-service.spec.ts +344 -0
- package/src/_modules/bot/_modules/teams-bot/_services/teb-messaging-provider.control-service.spec.ts +345 -0
- package/src/_modules/bot/_services/bot-commands.control-service.spec.ts +116 -0
- package/src/_modules/bot/_services/bot-io.control-service.spec.ts +285 -0
- package/src/_modules/bot/_services/bot-main.control-service.spec.ts +208 -0
- package/src/_modules/bot/_services/bot-messaging-provider.service-base.spec.ts +349 -0
- package/src/_modules/bot/_services/bot-routines.control-service.spec.ts +111 -0
- package/src/_modules/custom-data/custom-data.controller.spec.ts +49 -0
- package/src/_modules/custom-data/custom-data.controller.ts +1 -3
- package/src/_modules/custom-data/custom-data.data-service.spec.ts +54 -0
- package/src/_modules/custom-data/get-custom-data-routing-module.util.spec.ts +28 -0
- package/src/_modules/defaults/_services/default-auth.service.spec.ts +269 -0
- package/src/_modules/defaults/_services/default-socket-events.service.spec.ts +42 -0
- package/src/_modules/defaults/_services/default-user.data-service.spec.ts +187 -0
- package/src/_modules/discord-assistant/_collections/dias.util.spec.ts +366 -0
- package/src/_modules/discord-assistant/_services/dias-io.control-service.spec.ts +108 -0
- package/src/_modules/discord-assistant/_services/dias-main.control-service.spec.ts +22 -0
- package/src/_modules/discord-assistant/_services/dias.service-base.spec.ts +195 -0
- package/src/_modules/discord-assistant-voiced/_services/dias-discord-bot.control-service.spec.ts +34 -0
- package/src/_modules/discord-bot/_collections/dibo-operations.util.spec.ts +214 -0
- package/src/_modules/discord-bot/_services/dibo-commands.control-service.spec.ts +154 -0
- package/src/_modules/discord-bot/_services/dibo-io.control-service.spec.ts +264 -0
- package/src/_modules/discord-bot/_services/dibo-main.control-service.spec.ts +408 -0
- package/src/_modules/discord-bot/_services/dibo-routines.control-service.spec.ts +105 -0
- package/src/_modules/local-vector-search/_services/lvs-doc-chunk-data.service.spec.ts +418 -0
- package/src/_modules/local-vector-search/_services/lvs-local-vector-search.data-service.spec.ts +345 -0
- package/src/_modules/messaging/_collections/msg.util.spec.ts +226 -0
- package/src/_modules/messaging/_services/msg-events.service.spec.ts +219 -0
- package/src/_modules/messaging/_services/msg-main.control-service.spec.ts +147 -0
- package/src/_modules/messaging/_services/msg.controller.spec.ts +201 -0
- package/src/_modules/mock/data-model.mock.spec.ts +27 -24
- package/src/_modules/oauth2/_routes/oauth2.controller.spec.ts +107 -0
- package/src/_modules/oauth2/_services/oauth2.auth-service.spec.ts +254 -0
- package/src/_modules/oauth2/_services/oauth2.control-service.spec.ts +585 -0
- package/src/_modules/server/errors/errors.control-service.spec.ts +230 -0
- package/src/_modules/server/errors/errors.controller.spec.ts +165 -0
- package/src/_modules/server/errors/errors.data-service.spec.ts +355 -0
- package/src/_modules/server/server-status/server-status-snapshot.control-service.spec.ts +70 -0
- package/src/_modules/server/server-status/server-status-snapshot.data-service.spec.ts +77 -0
- package/src/_modules/server/server-status/server-status.control-service.spec.ts +516 -0
- package/src/_modules/server/server-status/server-status.controller.spec.ts +156 -0
- package/src/_modules/socket/_models/socket-client-service-params.control-model.spec.ts +6 -3
- package/src/_modules/socket/_models/socket-presence.control-model.spec.ts +164 -0
- package/src/_modules/socket/_services/socket-client.service.spec.ts +15 -0
- package/src/_modules/test/get-test-routing-module.util.spec.ts +28 -0
- package/src/_modules/test/test.controller.spec.ts +72 -0
- package/src/_modules/usage/usage.controller.spec.ts +81 -0
- package/src/_modules/usage/usage.data-service.spec.ts +332 -0
- package/src/_services/base/api.service-base.spec.ts +125 -0
- package/src/_services/base/archive-data.service.spec.ts +196 -0
- package/src/_services/base/data.service.spec.ts +493 -0
- package/src/_services/base/db.service.spec.ts +59 -18
- package/src/_services/base/singleton.service-base.spec.ts +28 -0
- package/src/_services/base/singleton.service.spec.ts +114 -0
- package/src/_services/core/api.service.ts +1 -0
- package/src/_services/core/auth.service.spec.ts +159 -0
- package/src/_services/core/email.service.spec.ts +14 -22
- package/src/_services/core/global.service.spec.ts +275 -0
- package/src/_services/core/service-collection.service.spec.ts +46 -0
- package/src/_services/route/routing-module.service.spec.ts +8 -6
- package/src/_services/server/app.server.ts +12 -0
- package/src/_services/shared.static-service.spec.ts +89 -0
- package/build/_collections/archive.util.spec.d.ts +0 -2
- package/build/_collections/archive.util.spec.d.ts.map +0 -1
- package/build/_collections/archive.util.spec.js +0 -21
- package/build/_collections/archive.util.spec.js.map +0 -1
- package/build/_models/control-models/api-call-params.control-model.spec.d.ts +0 -2
- package/build/_models/control-models/api-call-params.control-model.spec.d.ts.map +0 -1
- package/build/_models/control-models/api-call-params.control-model.spec.js +0 -80
- package/build/_models/control-models/api-call-params.control-model.spec.js.map +0 -1
- package/build/_models/control-models/app-params.control-model.spec.d.ts +0 -2
- package/build/_models/control-models/app-params.control-model.spec.d.ts.map +0 -1
- package/build/_models/control-models/app-params.control-model.spec.js +0 -59
- package/build/_models/control-models/app-params.control-model.spec.js.map +0 -1
- package/build/_models/control-models/app-system-controls.control-model.spec.d.ts +0 -2
- package/build/_models/control-models/app-system-controls.control-model.spec.d.ts.map +0 -1
- package/build/_models/control-models/app-system-controls.control-model.spec.js +0 -26
- package/build/_models/control-models/app-system-controls.control-model.spec.js.map +0 -1
- package/build/_models/control-models/http-settings.control-model.spec.d.ts +0 -2
- package/build/_models/control-models/http-settings.control-model.spec.d.ts.map +0 -1
- package/build/_models/control-models/http-settings.control-model.spec.js +0 -62
- package/build/_models/control-models/http-settings.control-model.spec.js.map +0 -1
- package/build/_models/control-models/system-control.control-model.spec.d.ts +0 -2
- package/build/_models/control-models/system-control.control-model.spec.d.ts.map +0 -1
- package/build/_models/control-models/system-control.control-model.spec.js +0 -24
- package/build/_models/control-models/system-control.control-model.spec.js.map +0 -1
- package/build/_modules/local-vector-search/_services/lvs-vector-pool.control-service.spec.d.ts +0 -2
- package/build/_modules/local-vector-search/_services/lvs-vector-pool.control-service.spec.d.ts.map +0 -1
- package/build/_modules/local-vector-search/_services/lvs-vector-pool.control-service.spec.js +0 -294
- package/build/_modules/local-vector-search/_services/lvs-vector-pool.control-service.spec.js.map +0 -1
- package/build/_modules/mock/app-params.mock.spec.d.ts +0 -2
- package/build/_modules/mock/app-params.mock.spec.d.ts.map +0 -1
- package/build/_modules/mock/app-params.mock.spec.js +0 -19
- package/build/_modules/mock/app-params.mock.spec.js.map +0 -1
- package/build/_modules/mock/auth-service.mock.spec.d.ts +0 -2
- package/build/_modules/mock/auth-service.mock.spec.d.ts.map +0 -1
- package/build/_modules/mock/auth-service.mock.spec.js +0 -40
- package/build/_modules/mock/auth-service.mock.spec.js.map +0 -1
- package/build/_modules/mock/controller.mock.spec.d.ts +0 -2
- package/build/_modules/mock/controller.mock.spec.d.ts.map +0 -1
- package/build/_modules/mock/controller.mock.spec.js +0 -23
- package/build/_modules/mock/controller.mock.spec.js.map +0 -1
- package/build/_modules/mock/data-model.mock.spec.d.ts +0 -2
- package/build/_modules/mock/data-model.mock.spec.d.ts.map +0 -1
- package/build/_modules/mock/data-model.mock.spec.js +0 -98
- package/build/_modules/mock/data-model.mock.spec.js.map +0 -1
- package/build/_modules/mock/email-service-collection.mock.spec.d.ts +0 -2
- package/build/_modules/mock/email-service-collection.mock.spec.d.ts.map +0 -1
- package/build/_modules/mock/email-service-collection.mock.spec.js +0 -21
- package/build/_modules/mock/email-service-collection.mock.spec.js.map +0 -1
- package/build/_modules/mock/email-service.mock.spec.d.ts +0 -2
- package/build/_modules/mock/email-service.mock.spec.d.ts.map +0 -1
- package/build/_modules/mock/email-service.mock.spec.js +0 -14
- package/build/_modules/mock/email-service.mock.spec.js.map +0 -1
- package/build/_modules/mock/socket-client.mock.spec.d.ts +0 -2
- package/build/_modules/mock/socket-client.mock.spec.d.ts.map +0 -1
- package/build/_modules/mock/socket-client.mock.spec.js +0 -32
- package/build/_modules/mock/socket-client.mock.spec.js.map +0 -1
- package/build/_modules/mock/socket-server.mock.spec.d.ts +0 -2
- package/build/_modules/mock/socket-server.mock.spec.d.ts.map +0 -1
- package/build/_modules/mock/socket-server.mock.spec.js +0 -36
- package/build/_modules/mock/socket-server.mock.spec.js.map +0 -1
- package/build/_modules/socket/_models/socket-client-service-params.control-model.spec.d.ts +0 -2
- package/build/_modules/socket/_models/socket-client-service-params.control-model.spec.d.ts.map +0 -1
- package/build/_modules/socket/_models/socket-client-service-params.control-model.spec.js +0 -22
- package/build/_modules/socket/_models/socket-client-service-params.control-model.spec.js.map +0 -1
- package/build/_modules/socket/_models/socket-server-service-params.control-model.spec.d.ts +0 -2
- package/build/_modules/socket/_models/socket-server-service-params.control-model.spec.d.ts.map +0 -1
- package/build/_modules/socket/_models/socket-server-service-params.control-model.spec.js +0 -29
- package/build/_modules/socket/_models/socket-server-service-params.control-model.spec.js.map +0 -1
- package/build/_modules/socket/_services/socket-server.service.spec.d.ts +0 -2
- package/build/_modules/socket/_services/socket-server.service.spec.d.ts.map +0 -1
- package/build/_modules/socket/_services/socket-server.service.spec.js +0 -9
- package/build/_modules/socket/_services/socket-server.service.spec.js.map +0 -1
- package/build/_modules/socket/app-extended.server.spec.d.ts +0 -2
- package/build/_modules/socket/app-extended.server.spec.d.ts.map +0 -1
- package/build/_modules/socket/app-extended.server.spec.js +0 -149
- package/build/_modules/socket/app-extended.server.spec.js.map +0 -1
- package/build/_services/base/db.service.spec.d.ts +0 -1
- package/build/_services/base/db.service.spec.d.ts.map +0 -1
- package/build/_services/base/db.service.spec.js +0 -28
- package/build/_services/base/db.service.spec.js.map +0 -1
- package/build/_services/core/api.service.spec.d.ts +0 -2
- package/build/_services/core/api.service.spec.d.ts.map +0 -1
- package/build/_services/core/api.service.spec.js +0 -109
- package/build/_services/core/api.service.spec.js.map +0 -1
- package/build/_services/core/email.service.spec.d.ts +0 -2
- package/build/_services/core/email.service.spec.d.ts.map +0 -1
- package/build/_services/core/email.service.spec.js +0 -77
- package/build/_services/core/email.service.spec.js.map +0 -1
- package/build/_services/route/controller.service.spec.d.ts +0 -2
- package/build/_services/route/controller.service.spec.d.ts.map +0 -1
- package/build/_services/route/controller.service.spec.js +0 -48
- package/build/_services/route/controller.service.spec.js.map +0 -1
- package/build/_services/route/routing-module.service.spec.d.ts +0 -2
- package/build/_services/route/routing-module.service.spec.d.ts.map +0 -1
- package/build/_services/route/routing-module.service.spec.js +0 -64
- package/build/_services/route/routing-module.service.spec.js.map +0 -1
- package/build/_services/server/app.server.spec.d.ts +0 -2
- package/build/_services/server/app.server.spec.d.ts.map +0 -1
- package/build/_services/server/app.server.spec.js +0 -80
- package/build/_services/server/app.server.spec.js.map +0 -1
- package/build/_services/shared.static-service.spec.d.ts +0 -2
- package/build/_services/shared.static-service.spec.d.ts.map +0 -1
- package/build/_services/shared.static-service.spec.js +0 -12
- package/build/_services/shared.static-service.spec.js.map +0 -1
- package/src/_modules/socket/app-extended.server.spec.ts +0 -227
- package/src/_services/server/app.server.spec.ts +0 -138
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyNTS_AI_LLMChat_ServiceBase } from './ai-llm-chat.service-base';
|
|
3
|
+
import { DyNTS_AI_LLM_ServiceBase } from './ai-llm.service-base';
|
|
4
|
+
import { DyFM_AI_CallSettings, DyFM_AI_MessageRole, DyFM_AI_Message } from '@futdevpro/fsm-dynamo/ai';
|
|
5
|
+
import { DyFM_AI_ConversationBase_Input, DyFM_AI_ConversationGenericSelect_Input, DyFM_AI_ConversationGenericMultiSelect_Input, DyFM_AI_ConversationJSONKeysDescription_Input, DyFM_AI_ConversationJSONExactKeys_Input } from '../_models/ai-input-interfaces';
|
|
6
|
+
|
|
7
|
+
class TestLLMChatService extends DyNTS_AI_LLMChat_ServiceBase<DyFM_AI_CallSettings> {
|
|
8
|
+
readonly aiProvider: any = {} as any;
|
|
9
|
+
readonly capabilities: any = {} as any;
|
|
10
|
+
setup = (config: any): void => {};
|
|
11
|
+
testConnection = async (issuer: string): Promise<boolean> => true;
|
|
12
|
+
readonly defaultSettings: DyFM_AI_CallSettings = {
|
|
13
|
+
systemPrompt: 'Test system prompt',
|
|
14
|
+
useModel: 'test-model',
|
|
15
|
+
debugLog: false,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
readonly predefinedRequests = {
|
|
19
|
+
yesNo: {
|
|
20
|
+
upperCaseYes: 'YES',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
requestSimpleMessage = async (set: any): Promise<string> => { return ''; };
|
|
25
|
+
requestYesNo = async (set: any): Promise<boolean> => { return false; };
|
|
26
|
+
requestPercentage = async (set: any): Promise<number> => { return 0; };
|
|
27
|
+
requestSelect = async <T>(set: any): Promise<T | { unparsableResult: string }> => { return null as any; };
|
|
28
|
+
requestMultiselect = async <T>(set: any): Promise<T[] | { unparsableResult: string }> => { return []; };
|
|
29
|
+
requestJSON = async <T>(set: any): Promise<T | { unparsableResult: string }> => { return null as any; };
|
|
30
|
+
requestJSONQuestionWithKeysDescription = async <T>(set: any): Promise<T | { unparsableResult: string }> => { return null as any; };
|
|
31
|
+
requestJSONWithExactKeys = async <T>(set: any): Promise<T | { unparsableResult: string }> => { return null as any; };
|
|
32
|
+
requestList = async <T>(set: any): Promise<T[] | { unparsableResult: string }> => { return []; };
|
|
33
|
+
|
|
34
|
+
async requestSimpleMessageInConversation(set: DyFM_AI_ConversationBase_Input<DyFM_AI_CallSettings>): Promise<string> {
|
|
35
|
+
return 'Test response';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async requestYesNoInConversation(set: DyFM_AI_ConversationBase_Input<DyFM_AI_CallSettings>): Promise<boolean> {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async requestPercentageInConversation(set: DyFM_AI_ConversationBase_Input<DyFM_AI_CallSettings>): Promise<number> {
|
|
43
|
+
return 50;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async requestSelectInConversation<T>(set: DyFM_AI_ConversationGenericSelect_Input<T, DyFM_AI_CallSettings>): Promise<T | { unparsableResult: string }> {
|
|
47
|
+
return null as any;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async requestMultiselectInConversation<T>(set: DyFM_AI_ConversationGenericMultiSelect_Input<T, DyFM_AI_CallSettings>): Promise<T[] | { unparsableResult: string }> {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async requestJSONInConversation<T = any>(set: DyFM_AI_ConversationBase_Input<DyFM_AI_CallSettings>): Promise<T | { unparsableResult: string }> {
|
|
55
|
+
return null as any;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async requestJSONInConversationWithKeysDescription<T>(set: DyFM_AI_ConversationJSONKeysDescription_Input<DyFM_AI_CallSettings>): Promise<T | { unparsableResult: string }> {
|
|
59
|
+
return null as any;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async requestJSONInConversationWithExactKeys<T>(set: DyFM_AI_ConversationJSONExactKeys_Input<DyFM_AI_CallSettings>): Promise<T | { unparsableResult: string }> {
|
|
63
|
+
return null as any;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async requestListInConversation(set: DyFM_AI_ConversationBase_Input<DyFM_AI_CallSettings>): Promise<string[] | { unparsableResult: string }> {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static getInstance(): TestLLMChatService {
|
|
71
|
+
return TestLLMChatService.getSingletonInstance();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
describe('| DyNTS_AI_LLMChat_ServiceBase', () => {
|
|
76
|
+
let service: TestLLMChatService;
|
|
77
|
+
|
|
78
|
+
beforeEach(() => {
|
|
79
|
+
service = new (TestLLMChatService as any)();
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
describe('| constructor', () => {
|
|
83
|
+
it('| should extend LLM service base', () => {
|
|
84
|
+
expect(service).toBeInstanceOf(DyNTS_AI_LLM_ServiceBase);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe('| requestSimpleMessageInConversation', () => {
|
|
89
|
+
it('| should request simple message in conversation', async () => {
|
|
90
|
+
const input: DyFM_AI_ConversationBase_Input<DyFM_AI_CallSettings> = {
|
|
91
|
+
conversation: [
|
|
92
|
+
{ role: DyFM_AI_MessageRole.user, content: 'Hello' },
|
|
93
|
+
],
|
|
94
|
+
issuer: 'test-issuer',
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const result = await service.requestSimpleMessageInConversation(input);
|
|
98
|
+
|
|
99
|
+
expect(result).toBe('Test response');
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
describe('| requestYesNoInConversation', () => {
|
|
104
|
+
it('| should request yes/no in conversation', async () => {
|
|
105
|
+
const input: DyFM_AI_ConversationBase_Input<DyFM_AI_CallSettings> = {
|
|
106
|
+
conversation: [
|
|
107
|
+
{ role: DyFM_AI_MessageRole.user, content: 'Is this true?' },
|
|
108
|
+
],
|
|
109
|
+
issuer: 'test-issuer',
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const result = await service.requestYesNoInConversation(input);
|
|
113
|
+
|
|
114
|
+
expect(result).toBe(true);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
describe('| requestPercentageInConversation', () => {
|
|
119
|
+
it('| should request percentage in conversation', async () => {
|
|
120
|
+
const input: DyFM_AI_ConversationBase_Input<DyFM_AI_CallSettings> = {
|
|
121
|
+
conversation: [
|
|
122
|
+
{ role: DyFM_AI_MessageRole.user, content: 'What percentage?' },
|
|
123
|
+
],
|
|
124
|
+
issuer: 'test-issuer',
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const result = await service.requestPercentageInConversation(input);
|
|
128
|
+
|
|
129
|
+
expect(result).toBe(50);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
describe('| requestSelectInConversation', () => {
|
|
134
|
+
it('| should request select in conversation', async () => {
|
|
135
|
+
const input: DyFM_AI_ConversationGenericSelect_Input<string, DyFM_AI_CallSettings> = {
|
|
136
|
+
conversation: [
|
|
137
|
+
{ role: DyFM_AI_MessageRole.user, content: 'Choose one' },
|
|
138
|
+
],
|
|
139
|
+
selectFrom: ['option1', 'option2'],
|
|
140
|
+
issuer: 'test-issuer',
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const result = await service.requestSelectInConversation(input);
|
|
144
|
+
|
|
145
|
+
expect(result).toBeDefined();
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
describe('| requestMultiselectInConversation', () => {
|
|
150
|
+
it('| should request multiselect in conversation', async () => {
|
|
151
|
+
const input: DyFM_AI_ConversationGenericMultiSelect_Input<string, DyFM_AI_CallSettings> = {
|
|
152
|
+
conversation: [
|
|
153
|
+
{ role: DyFM_AI_MessageRole.user, content: 'Choose multiple' },
|
|
154
|
+
],
|
|
155
|
+
options: ['option1', 'option2'],
|
|
156
|
+
issuer: 'test-issuer',
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const result = await service.requestMultiselectInConversation(input);
|
|
160
|
+
|
|
161
|
+
expect(result).toBeDefined();
|
|
162
|
+
expect(Array.isArray(result)).toBe(true);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
describe('| requestJSONInConversation', () => {
|
|
167
|
+
it('| should request JSON in conversation', async () => {
|
|
168
|
+
const input: DyFM_AI_ConversationBase_Input<DyFM_AI_CallSettings> = {
|
|
169
|
+
conversation: [
|
|
170
|
+
{ role: DyFM_AI_MessageRole.user, content: 'Return JSON' },
|
|
171
|
+
],
|
|
172
|
+
issuer: 'test-issuer',
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const result = await service.requestJSONInConversation(input);
|
|
176
|
+
|
|
177
|
+
expect(result).toBeDefined();
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
describe('| requestJSONInConversationWithKeysDescription', () => {
|
|
182
|
+
it('| should request JSON with keys description in conversation', async () => {
|
|
183
|
+
const input: DyFM_AI_ConversationJSONKeysDescription_Input<DyFM_AI_CallSettings> = {
|
|
184
|
+
conversation: [
|
|
185
|
+
{ role: DyFM_AI_MessageRole.user, content: 'Return JSON with keys' },
|
|
186
|
+
],
|
|
187
|
+
keysDescription: 'key1: Description 1',
|
|
188
|
+
issuer: 'test-issuer',
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const result = await service.requestJSONInConversationWithKeysDescription(input);
|
|
192
|
+
|
|
193
|
+
expect(result).toBeDefined();
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
describe('| requestJSONInConversationWithExactKeys', () => {
|
|
198
|
+
it('| should request JSON with exact keys in conversation', async () => {
|
|
199
|
+
const input: DyFM_AI_ConversationJSONExactKeys_Input<DyFM_AI_CallSettings> = {
|
|
200
|
+
conversation: [
|
|
201
|
+
{ role: DyFM_AI_MessageRole.user, content: 'Return JSON with exact keys' },
|
|
202
|
+
],
|
|
203
|
+
keys: ['key1', 'key2'],
|
|
204
|
+
issuer: 'test-issuer',
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const result = await service.requestJSONInConversationWithExactKeys(input);
|
|
208
|
+
|
|
209
|
+
expect(result).toBeDefined();
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
describe('| requestListInConversation', () => {
|
|
214
|
+
it('| should request list in conversation', async () => {
|
|
215
|
+
const input: DyFM_AI_ConversationBase_Input<DyFM_AI_CallSettings> = {
|
|
216
|
+
conversation: [
|
|
217
|
+
{ role: DyFM_AI_MessageRole.user, content: 'Return list' },
|
|
218
|
+
],
|
|
219
|
+
issuer: 'test-issuer',
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const result = await service.requestListInConversation(input);
|
|
223
|
+
|
|
224
|
+
expect(result).toBeDefined();
|
|
225
|
+
expect(Array.isArray(result)).toBe(true);
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyNTS_AI_LLM_ServiceBase } from './ai-llm.service-base';
|
|
3
|
+
import { DyFM_AI_CallSettings, DyFM_AI_MessageRole } from '@futdevpro/fsm-dynamo/ai';
|
|
4
|
+
import { DyFM_Log, DyFM_Object } from '@futdevpro/fsm-dynamo';
|
|
5
|
+
|
|
6
|
+
class TestLLMService extends DyNTS_AI_LLM_ServiceBase<DyFM_AI_CallSettings> {
|
|
7
|
+
readonly aiProvider: any = {} as any;
|
|
8
|
+
readonly capabilities: any = {} as any;
|
|
9
|
+
setup = (config: any): void => {};
|
|
10
|
+
testConnection = async (issuer: string): Promise<boolean> => true;
|
|
11
|
+
readonly defaultSettings: DyFM_AI_CallSettings = {
|
|
12
|
+
systemPrompt: 'Test system prompt',
|
|
13
|
+
useModel: 'test-model',
|
|
14
|
+
debugLog: false,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
readonly predefinedRequests = {
|
|
18
|
+
yesNo: {
|
|
19
|
+
upperCaseYes: 'YES',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
requestSimpleMessage = async (set: any): Promise<string> => { return ''; };
|
|
24
|
+
requestYesNo = async (set: any): Promise<boolean> => { return false; };
|
|
25
|
+
requestPercentage = async (set: any): Promise<number> => { return 0; };
|
|
26
|
+
requestSelect = async <T>(set: any): Promise<T | { unparsableResult: string }> => { return null as any; };
|
|
27
|
+
requestMultiselect = async <T>(set: any): Promise<T[] | { unparsableResult: string }> => { return []; };
|
|
28
|
+
requestJSON = async <T>(set: any): Promise<T | { unparsableResult: string }> => { return null as any; };
|
|
29
|
+
requestJSONQuestionWithKeysDescription = async <T>(set: any): Promise<T | { unparsableResult: string }> => { return null as any; };
|
|
30
|
+
requestJSONWithExactKeys = async <T>(set: any): Promise<T | { unparsableResult: string }> => { return null as any; };
|
|
31
|
+
requestList = async <T>(set: any): Promise<T[] | { unparsableResult: string }> => { return []; };
|
|
32
|
+
|
|
33
|
+
static getInstance(): TestLLMService {
|
|
34
|
+
return TestLLMService.getSingletonInstance();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
describe('| DyNTS_AI_LLM_ServiceBase', () => {
|
|
39
|
+
let service: TestLLMService;
|
|
40
|
+
|
|
41
|
+
beforeEach(() => {
|
|
42
|
+
service = TestLLMService.getInstance();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('| should be a singleton instance', () => {
|
|
46
|
+
const instance1 = TestLLMService.getInstance();
|
|
47
|
+
const instance2 = TestLLMService.getInstance();
|
|
48
|
+
|
|
49
|
+
expect(instance1).toBe(instance2);
|
|
50
|
+
expect(instance1).toBeInstanceOf(TestLLMService);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('| defaultSystemPrompt', () => {
|
|
54
|
+
it('| should return system prompt from default settings', () => {
|
|
55
|
+
expect(service.defaultSystemPrompt).toBe('Test system prompt');
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe('| defaultModel', () => {
|
|
60
|
+
it('| should return model from default settings', () => {
|
|
61
|
+
expect(service.defaultModel).toBe('test-model');
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe('| debugLog', () => {
|
|
66
|
+
it('| should return debugLog from default settings', () => {
|
|
67
|
+
expect(service.debugLog).toBe(false);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('| should return _debugLog when defaultSettings debugLog is not set', () => {
|
|
71
|
+
const serviceWithoutDebugLog = new (class extends TestLLMService {
|
|
72
|
+
override readonly defaultSettings: DyFM_AI_CallSettings = {
|
|
73
|
+
systemPrompt: 'Test',
|
|
74
|
+
useModel: 'test',
|
|
75
|
+
};
|
|
76
|
+
override readonly aiProvider: any = {} as any;
|
|
77
|
+
override readonly capabilities: any = {} as any;
|
|
78
|
+
override setup = (config: any): void => {};
|
|
79
|
+
override testConnection = async (issuer: string): Promise<boolean> => true;
|
|
80
|
+
} as any)();
|
|
81
|
+
|
|
82
|
+
// Set _debugLog on the new instance
|
|
83
|
+
serviceWithoutDebugLog._debugLog = true;
|
|
84
|
+
expect(serviceWithoutDebugLog.debugLog).toBe(true);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe('| convertAnswerToBoolean', () => {
|
|
89
|
+
it('| should return true when answer contains YES', () => {
|
|
90
|
+
const result = (service as any).convertAnswerToBoolean('YES');
|
|
91
|
+
|
|
92
|
+
expect(result).toBe(true);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('| should return true when answer contains yes in uppercase', () => {
|
|
96
|
+
const result = (service as any).convertAnswerToBoolean('The answer is YES');
|
|
97
|
+
|
|
98
|
+
expect(result).toBe(true);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('| should return false when answer does not contain YES', () => {
|
|
102
|
+
const result = (service as any).convertAnswerToBoolean('NO');
|
|
103
|
+
|
|
104
|
+
expect(result).toBe(false);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('| should be case insensitive', () => {
|
|
108
|
+
const result = (service as any).convertAnswerToBoolean('yes');
|
|
109
|
+
|
|
110
|
+
expect(result).toBe(true);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
describe('| convertAnswerToNumber', () => {
|
|
115
|
+
it('| should return number when answer is valid', () => {
|
|
116
|
+
const result = (service as any).convertAnswerToNumber('42', 'What is the answer?');
|
|
117
|
+
|
|
118
|
+
expect(result).toBe(42);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('| should return null when answer is invalid (contains skip flag)', () => {
|
|
122
|
+
spyOn(service as any, 'isAnswerValid').and.returnValue(true);
|
|
123
|
+
|
|
124
|
+
const result = (service as any).convertAnswerToNumber('42', 'What is the answer?');
|
|
125
|
+
|
|
126
|
+
expect(result).toBeNull();
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('| should return null when answer is NaN', () => {
|
|
130
|
+
const logSpy = spyOn(DyFM_Log, 'T_error');
|
|
131
|
+
spyOn(service as any, 'isAnswerValid').and.returnValue(false);
|
|
132
|
+
|
|
133
|
+
const result = (service as any).convertAnswerToNumber('not-a-number', 'What is the answer?');
|
|
134
|
+
|
|
135
|
+
expect(result).toBeNull();
|
|
136
|
+
expect(logSpy).toHaveBeenCalled();
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('| should handle decimal numbers', () => {
|
|
140
|
+
const result = (service as any).convertAnswerToNumber('42.5', 'What is the answer?');
|
|
141
|
+
|
|
142
|
+
expect(result).toBe(42.5);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
describe('| convertAnswerToSelectOption', () => {
|
|
147
|
+
it('| should return selected option when found', () => {
|
|
148
|
+
const options = ['option1', 'option2', 'option3'];
|
|
149
|
+
spyOn(service as any, 'isAnswerValid').and.returnValue(false);
|
|
150
|
+
spyOn(service as any, 'stringifySelectOptions').and.returnValue(['option1', 'option2', 'option3']);
|
|
151
|
+
|
|
152
|
+
const result = (service as any).convertAnswerToSelectOption('option1', 'Select an option', options);
|
|
153
|
+
|
|
154
|
+
expect(result).toBe('option1');
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('| should return null when answer is invalid', () => {
|
|
158
|
+
spyOn(service as any, 'isAnswerValid').and.returnValue(true);
|
|
159
|
+
|
|
160
|
+
const result = (service as any).convertAnswerToSelectOption('option1', 'Select an option', ['option1']);
|
|
161
|
+
|
|
162
|
+
expect(result).toBeNull();
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('| should return null when option not found', () => {
|
|
166
|
+
spyOn(service as any, 'isAnswerValid').and.returnValue(false);
|
|
167
|
+
spyOn(service as any, 'stringifySelectOptions').and.returnValue(['option1', 'option2']);
|
|
168
|
+
|
|
169
|
+
const result = (service as any).convertAnswerToSelectOption('option3', 'Select an option', ['option1', 'option2']);
|
|
170
|
+
|
|
171
|
+
expect(result).toBeNull();
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
it('| should handle JSON options', () => {
|
|
175
|
+
const options = [{ id: 1, name: 'test' }];
|
|
176
|
+
spyOn(service as any, 'isAnswerValid').and.returnValue(false);
|
|
177
|
+
spyOn(service as any, 'stringifySelectOptions').and.returnValue([JSON.stringify({ id: 1, name: 'test' })]);
|
|
178
|
+
spyOn(DyFM_Object, 'safeParseJSON').and.returnValue({ id: 1, name: 'test' });
|
|
179
|
+
|
|
180
|
+
const result = (service as any).convertAnswerToSelectOption(
|
|
181
|
+
JSON.stringify({ id: 1, name: 'test' }),
|
|
182
|
+
'Select an option',
|
|
183
|
+
options
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
expect(result).toEqual({ id: 1, name: 'test' });
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
describe('| convertAnswerToSelectOptions', () => {
|
|
191
|
+
it('| should return multiple selected options', () => {
|
|
192
|
+
const options = ['option1', 'option2', 'option3'];
|
|
193
|
+
spyOn(service as any, 'isAnswerValid').and.returnValue(false);
|
|
194
|
+
spyOn(service as any, 'stringifySelectOption').and.callFake((opt: string) => opt);
|
|
195
|
+
|
|
196
|
+
const result = (service as any).convertAnswerToSelectOptions('option1 and option2', 'Select options', options);
|
|
197
|
+
|
|
198
|
+
expect(result).toEqual(['option1', 'option2']);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it('| should return null when answer is invalid', () => {
|
|
202
|
+
spyOn(service as any, 'isAnswerValid').and.returnValue(true);
|
|
203
|
+
|
|
204
|
+
const result = (service as any).convertAnswerToSelectOptions('option1', 'Select options', ['option1']);
|
|
205
|
+
|
|
206
|
+
expect(result).toBeNull();
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
it('| should return empty array when no options match', () => {
|
|
210
|
+
spyOn(service as any, 'isAnswerValid').and.returnValue(false);
|
|
211
|
+
spyOn(service as any, 'stringifySelectOption').and.callFake((opt: string) => opt);
|
|
212
|
+
|
|
213
|
+
const result = (service as any).convertAnswerToSelectOptions('option4', 'Select options', ['option1', 'option2']);
|
|
214
|
+
|
|
215
|
+
expect(result).toEqual([]);
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
describe('| convertAnswerToJSON', () => {
|
|
220
|
+
it('| should return parsed JSON when valid', () => {
|
|
221
|
+
const jsonString = '{"key": "value"}';
|
|
222
|
+
spyOn(service as any, 'isAnswerValid').and.returnValue(false);
|
|
223
|
+
spyOn(DyFM_Object, 'safeParseJSON').and.returnValue({ key: 'value' });
|
|
224
|
+
|
|
225
|
+
const result = (service as any).convertAnswerToJSON(jsonString, 'Enter JSON') as { key: string };
|
|
226
|
+
|
|
227
|
+
expect(result).toEqual({ key: 'value' });
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
it('| should return unparsableResult when answer is invalid', () => {
|
|
231
|
+
spyOn(service as any, 'isAnswerValid').and.returnValue(true);
|
|
232
|
+
|
|
233
|
+
const result = (service as any).convertAnswerToJSON('{"key": "value"}', 'Enter JSON');
|
|
234
|
+
|
|
235
|
+
expect(result).toEqual({ unparsableResult: '{"key": "value"}' });
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
it('| should return unparsableResult when JSON is invalid', () => {
|
|
239
|
+
const logSpy = spyOn(DyFM_Log, 'T_error');
|
|
240
|
+
spyOn(service as any, 'isAnswerValid').and.returnValue(false);
|
|
241
|
+
spyOn(DyFM_Object, 'safeParseJSON').and.returnValue({ unparsableResult: 'invalid json' });
|
|
242
|
+
|
|
243
|
+
const result = (service as any).convertAnswerToJSON('invalid json', 'Enter JSON');
|
|
244
|
+
|
|
245
|
+
expect(result).toEqual({ unparsableResult: 'invalid json' });
|
|
246
|
+
expect(logSpy).toHaveBeenCalled();
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyNTS_AI_Provider_ServiceBase } from './ai-provider.service-base';
|
|
3
|
+
import { DyFM_AI_Provider, DyFM_AI_ProviderCapabilities, DyFM_AI_Config } from '@futdevpro/fsm-dynamo/ai';
|
|
4
|
+
|
|
5
|
+
class TestProviderService extends DyNTS_AI_Provider_ServiceBase {
|
|
6
|
+
readonly aiProvider: DyFM_AI_Provider = DyFM_AI_Provider.OpenAI;
|
|
7
|
+
readonly capabilities: DyFM_AI_ProviderCapabilities = {
|
|
8
|
+
chat: true,
|
|
9
|
+
embeddings: true,
|
|
10
|
+
imageGeneration: false,
|
|
11
|
+
vision: false,
|
|
12
|
+
audioGeneration: false,
|
|
13
|
+
audioAnalysis: false,
|
|
14
|
+
functionCalling: false,
|
|
15
|
+
streaming: false,
|
|
16
|
+
batchOperations: false,
|
|
17
|
+
supportedModelTypes: [],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
setup = (config: DyFM_AI_Config): void => {
|
|
21
|
+
// Mock implementation
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
testConnection = async (issuer: string): Promise<boolean> => {
|
|
25
|
+
return true;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
static getInstance(): TestProviderService {
|
|
29
|
+
return TestProviderService.getSingletonInstance();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
describe('| DyNTS_AI_Provider_ServiceBase', () => {
|
|
34
|
+
let service: TestProviderService;
|
|
35
|
+
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
service = TestProviderService.getInstance();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('| should be a singleton instance', () => {
|
|
41
|
+
const instance1 = TestProviderService.getInstance();
|
|
42
|
+
const instance2 = TestProviderService.getInstance();
|
|
43
|
+
|
|
44
|
+
expect(instance1).toBe(instance2);
|
|
45
|
+
expect(instance1).toBeInstanceOf(TestProviderService);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('| should have aiProvider property', () => {
|
|
49
|
+
expect(service.aiProvider).toBe(DyFM_AI_Provider.OpenAI);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('| should have capabilities property', () => {
|
|
53
|
+
expect(service.capabilities).toBeDefined();
|
|
54
|
+
expect(service.capabilities.chat).toBe(true);
|
|
55
|
+
expect(service.capabilities.embeddings).toBe(true);
|
|
56
|
+
expect(service.capabilities.chat).toBe(true);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe('| setup', () => {
|
|
60
|
+
it('| should accept config parameter', () => {
|
|
61
|
+
const config: DyFM_AI_Config = {
|
|
62
|
+
apiKey: 'test-key',
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
expect(() => {
|
|
66
|
+
service.setup(config);
|
|
67
|
+
}).not.toThrow();
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe('| testConnection', () => {
|
|
72
|
+
it('| should return true when connection is successful', async () => {
|
|
73
|
+
const result = await service.testConnection('issuer-123');
|
|
74
|
+
|
|
75
|
+
expect(result).toBe(true);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|