@futdevpro/nts-dynamo 1.11.1 → 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.
Files changed (43) hide show
  1. package/build/_modules/discord-assistant/_collections/dias.util.d.ts +6 -0
  2. package/build/_modules/discord-assistant/_collections/dias.util.d.ts.map +1 -0
  3. package/build/_modules/discord-assistant/_collections/dias.util.js +36 -0
  4. package/build/_modules/discord-assistant/_collections/dias.util.js.map +1 -0
  5. package/build/_modules/discord-assistant/_services/dias-io.control-service.d.ts.map +1 -1
  6. package/build/_modules/discord-assistant/_services/dias-io.control-service.js +2 -1
  7. package/build/_modules/discord-assistant/_services/dias-io.control-service.js.map +1 -1
  8. package/build/_modules/discord-assistant/_services/dias.service-base.d.ts +0 -2
  9. package/build/_modules/discord-assistant/_services/dias.service-base.d.ts.map +1 -1
  10. package/build/_modules/discord-assistant/_services/dias.service-base.js +0 -28
  11. package/build/_modules/discord-assistant/_services/dias.service-base.js.map +1 -1
  12. package/build/_modules/open-ai/_models/interfaces/oai-document-page.interface.d.ts +1 -0
  13. package/build/_modules/open-ai/_models/interfaces/oai-document-page.interface.d.ts.map +1 -1
  14. package/build/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts +20 -0
  15. package/build/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts.map +1 -1
  16. package/build/_modules/open-ai/_services/oai-llm-chat.service-base.js +12 -0
  17. package/build/_modules/open-ai/_services/oai-llm-chat.service-base.js.map +1 -1
  18. package/build/_modules/open-ai/_services/oai-llm.service-base.d.ts +4 -1
  19. package/build/_modules/open-ai/_services/oai-llm.service-base.d.ts.map +1 -1
  20. package/build/_modules/open-ai/_services/oai-llm.service-base.js +3 -0
  21. package/build/_modules/open-ai/_services/oai-llm.service-base.js.map +1 -1
  22. package/build/_modules/open-ai/index.d.ts +1 -0
  23. package/build/_modules/open-ai/index.d.ts.map +1 -1
  24. package/build/_modules/open-ai/index.js +1 -0
  25. package/build/_modules/open-ai/index.js.map +1 -1
  26. package/build/_services/base/data.service.d.ts +6 -0
  27. package/build/_services/base/data.service.d.ts.map +1 -1
  28. package/build/_services/base/data.service.js +6 -0
  29. package/build/_services/base/data.service.js.map +1 -1
  30. package/build/_services/base/db.service.d.ts +10 -0
  31. package/build/_services/base/db.service.d.ts.map +1 -1
  32. package/build/_services/base/db.service.js +10 -0
  33. package/build/_services/base/db.service.js.map +1 -1
  34. package/package.json +3 -3
  35. package/src/_modules/discord-assistant/_collections/dias.util.ts +43 -0
  36. package/src/_modules/discord-assistant/_services/dias-io.control-service.ts +6 -1
  37. package/src/_modules/discord-assistant/_services/dias.service-base.ts +0 -32
  38. package/src/_modules/open-ai/_models/interfaces/oai-document-page.interface.ts +1 -0
  39. package/src/_modules/open-ai/_services/oai-llm-chat.service-base.ts +12 -0
  40. package/src/_modules/open-ai/_services/oai-llm.service-base.ts +4 -1
  41. package/src/_modules/open-ai/index.ts +1 -0
  42. package/src/_services/base/data.service.ts +6 -0
  43. package/src/_services/base/db.service.ts +10 -0
@@ -46,36 +46,4 @@ export abstract class DyNTS_DiAs_ServiceBase extends DyNTS_DiBo_Main_ControlServ
46
46
 
47
47
  return messages;
48
48
  }
49
-
50
- async convertDiscordMessagesToOAIConversation(
51
- messages: Message[]
52
- ): Promise<DyNTS_OAI_GPT_Message[]> {
53
- return messages.map(message => {
54
- if (
55
- (message?.author &&
56
- (message.author.bot ||
57
- message.author.id === this.botClientId ||
58
- message.author.displayName === this.botDisplayName))
59
- ) {
60
- if (DyNTS_DiAs_global_settings.userTranslationFlags.some(
61
- flag => message.content.includes(flag)
62
- )) {
63
- return {
64
- role: DyNTS_OAI_GPT_Message_Role.user,
65
- content: message.content,
66
- };
67
- } else {
68
- return {
69
- role: DyNTS_OAI_GPT_Message_Role.assistant,
70
- content: message.content,
71
- };
72
- }
73
- } else {
74
- return {
75
- role: DyNTS_OAI_GPT_Message_Role.user,
76
- content: message.content,
77
- };
78
- }
79
- })
80
- }
81
49
  }
@@ -9,6 +9,7 @@ export interface DyNTS_OAI_DocumentPage extends DyFM_Metadata {
9
9
  docId: string;
10
10
  parentPageId: string;
11
11
 
12
+ /** Path to the page in the document, starting with the document name */
12
13
  path: string[];
13
14
  documentParent: string;
14
15
 
@@ -55,6 +55,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
55
55
 
56
56
  return answer.toUpperCase().includes(this.predefinedRequests.yesNo.upperCaseYes);
57
57
  }
58
+ askYesNoQuestionInConversation = this.yesNoQuestionInConversation;
58
59
 
59
60
  /**
60
61
  * Asks the AI to answer a simple question
@@ -81,6 +82,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
81
82
  replaceThisInLog
82
83
  );
83
84
  }
85
+ askSimpleQuestionInConversation = this.simpleQuestionInConversation;
84
86
 
85
87
  /**
86
88
  * Asks the AI to answer a percentage question
@@ -120,6 +122,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
120
122
 
121
123
  return +answer;
122
124
  }
125
+ askPercentageQuestionInConversation = this.percentageQuestionInConversation;
123
126
 
124
127
 
125
128
  /**
@@ -163,6 +166,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
163
166
 
164
167
  return null;
165
168
  }
169
+ askSelectQuestionInConversation = this.selectQuestionInConversation;
166
170
 
167
171
  /**
168
172
  * Asks the AI to select one of the options from the list
@@ -200,6 +204,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
200
204
 
201
205
  return DyFM_safeParseJSON<T>(answer);
202
206
  }
207
+ askRequestSelectInConversation = this.requestSelectInConversation;
203
208
 
204
209
  /**
205
210
  * Asks the AI to select one or more of the options from the list
@@ -243,6 +248,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
243
248
 
244
249
  return result;
245
250
  }
251
+ askMultipleSelectQuestionWithOptionsInConversation = this.multipleSelectQuestionWithOptionsInConversation;
246
252
 
247
253
  /**
248
254
  * Asks the AI to select one or more of the options from the list
@@ -280,6 +286,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
280
286
 
281
287
  return DyFM_safeParseList<T[]>(answer);
282
288
  }
289
+ askRequestMultipleSelectInConversation = this.requestMultipleSelectInConversation;
283
290
 
284
291
  /**
285
292
  * Asks the AI to answer a question that must result a JSON object
@@ -314,6 +321,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
314
321
 
315
322
  return DyFM_safeParseJSON<T>(answer);
316
323
  }
324
+ askJsonQuestionInConversation = this.jsonQuestionInConversation;
317
325
 
318
326
  /**
319
327
  * Asks the AI to answer a question that must result a JSON object with specific key descriptions
@@ -353,6 +361,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
353
361
 
354
362
  return DyFM_safeParseJSON<T>(answer);
355
363
  }
364
+ askJsonQuestionWithKeysDescriptionInConversation = this.jsonQuestionWithKeysDescriptionInConversation;
356
365
 
357
366
  /**
358
367
  * Asks the AI to answer a question that must result a JSON object with specific keys
@@ -392,6 +401,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
392
401
 
393
402
  return DyFM_safeParseJSON<T>(answer);
394
403
  }
404
+ askJsonQuestionWithExactKeysInConversation = this.jsonQuestionWithExactKeysInConversation;
395
405
 
396
406
  /**
397
407
  * Asks the AI to answer a question that must result a list of strings
@@ -426,6 +436,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
426
436
 
427
437
  return DyFM_safeParseList(answer);
428
438
  }
439
+ askListQuestionInConversation = this.listQuestionInConversation;
429
440
 
430
441
  /**
431
442
  * Asks the AI to answer a question
@@ -491,6 +502,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
491
502
  }
492
503
  getQuestionAnswerInConversation = this.getAnswerInConversation;
493
504
  getQuestionInConversation = this.getAnswerInConversation;
505
+ askQuestionInConversation = this.getAnswerInConversation;
494
506
 
495
507
  /**
496
508
  * Resolves a conversation
@@ -47,7 +47,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
47
47
  return this.defaultSettings.useModel;
48
48
  }
49
49
 
50
- readonly predefinedRequests: DyNTS_OAI_LLM_Predefined_Requests =
50
+ predefinedRequests: DyNTS_OAI_LLM_Predefined_Requests =
51
51
  DyNTS_OAI_LLMDefaultPredefined_Requests;
52
52
 
53
53
  constructor(
@@ -565,6 +565,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
565
565
  * parses the JSON list, if it fails, it returns the answer as a single item in an array
566
566
  *
567
567
  * (uses {@link DyFM_safeParseJSON})
568
+ * @deprecated use {@link DyFM_Shared.safeParseList} instead
568
569
  */
569
570
  export function DyFM_safeParseList<T extends Array<any>>(
570
571
  textedJSON: string,
@@ -604,6 +605,7 @@ export function DyFM_safeParseList<T extends Array<any>>(
604
605
  * parses the JSON, if it fails, it returns { unparsableResult: textedJSON }
605
606
  *
606
607
  * (uses {@link DyFM_failableSafeParseJSON})
608
+ * @deprecated use {@link DyFM_Shared.safeParseJSON} instead
607
609
  */
608
610
  export function DyFM_safeParseJSON<T = any>(
609
611
  textedJSON: string,
@@ -629,6 +631,7 @@ export function DyFM_safeParseJSON<T = any>(
629
631
  /**
630
632
  * parses the JSON, if it fails, it throws an error
631
633
  * (also will extract the JSON from "```json ... ```" wrapper)
634
+ * @deprecated use {@link DyFM_Shared.failableSafeParseJSON} instead
632
635
  */
633
636
  export function DyFM_failableSafeParseJSON<T = any>(textedJSON: string): T {
634
637
  if (!textedJSON) {
@@ -23,6 +23,7 @@ export * from './_collections/oai-chunking.util';
23
23
  export * from './_collections/oai-document.util';
24
24
  export * from './_collections/oai-global-settings.const';
25
25
  export * from './_collections/oai-llm-predefined-requests.conts';
26
+ export * from './_collections/oai-llm-predefined-requests-hu.conts';
26
27
 
27
28
  // ENUMS
28
29
  export * from './_enums/oai-compare-result-type.enum';
@@ -549,6 +549,8 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
549
549
  * @example
550
550
  * // or by id that is in list:
551
551
  * { userIds: { $in: this.userId } }
552
+ * // or by userIds:
553
+ * { userId: { $in: userIds } }
552
554
  * //
553
555
  * @example
554
556
  * // or by number or Date that is Greater Than AND Less Than:
@@ -605,6 +607,8 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
605
607
  * @example
606
608
  * // or by id that is in list:
607
609
  * { userIds: { $in: this.userId } }
610
+ * // or by userIds:
611
+ * { userId: { $in: userIds } }
608
612
  * //
609
613
  * @example
610
614
  * // or by number or Date that is Greater Than AND Less Than:
@@ -661,6 +665,8 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
661
665
  * @example
662
666
  * // or by id that is in list:
663
667
  * { userIds: { $in: this.userId } }
668
+ * // or by userIds:
669
+ * { userId: { $in: userIds } }
664
670
  * //
665
671
  * @example
666
672
  * // or by number or Date that is Greater Than AND Less Than:
@@ -735,6 +735,8 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
735
735
  * @example
736
736
  * // or by id that is in list:
737
737
  * { userIds: { $in: this.userId } }
738
+ * // or by userIds:
739
+ * { userId: { $in: userIds } }
738
740
  * //
739
741
  * @example
740
742
  * // or by number or Date that is Greater Than AND Less Than:
@@ -778,6 +780,8 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
778
780
  * @example
779
781
  * // or by id that is in list:
780
782
  * { userIds: { $in: this.userId } }
783
+ * // or by userIds:
784
+ * { userId: { $in: userIds } }
781
785
  * //
782
786
  * @example
783
787
  * // or by number or Date that is Greater Than AND Less Than:
@@ -825,6 +829,8 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
825
829
  * @example
826
830
  * // or by id that is in list:
827
831
  * { userIds: { $in: this.userId } }
832
+ * // or by userIds:
833
+ * { userId: { $in: userIds } }
828
834
  * //
829
835
  * @example
830
836
  * // or by number or Date that is Greater Than AND Less Than:
@@ -929,6 +935,8 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
929
935
  * @example
930
936
  * // or by id that is in list:
931
937
  * { userIds: { $in: this.userId } }
938
+ * // or by userIds:
939
+ * { userId: { $in: userIds } }
932
940
  * //
933
941
  * @example
934
942
  * // or by number or Date that is Greater Than AND Less Than:
@@ -1008,6 +1016,8 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
1008
1016
  * @example
1009
1017
  * // or by id that is in list:
1010
1018
  * { userIds: { $in: this.userId } }
1019
+ * // or by userIds:
1020
+ * { userId: { $in: userIds } }
1011
1021
  * //
1012
1022
  * @example
1013
1023
  * // or by number or Date that is Greater Than AND Less Than: