@purpleschool/gptbot 0.9.6 → 0.9.7

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 (29) hide show
  1. package/build/commands/chat/create-chat.command.js +1 -0
  2. package/build/commands/chat/get-last-active-chat-command.js +1 -0
  3. package/build/commands/message/create-text-message.command.js +0 -1
  4. package/build/constants/ai-model/enums/ai-model-content-type.enum.js +4 -4
  5. package/build/constants/index.js +0 -1
  6. package/build/constants/model/enums/unified-model-content-type.enum.js +1 -0
  7. package/build/constants/subscription/enums/subscription-feature-type.enum.js +1 -2
  8. package/build/models/ai-model.schema.js +1 -1
  9. package/build/models/chat.schema.js +1 -1
  10. package/build/models/prompt.schema.js +2 -0
  11. package/build/models/subscription-feature.schema.js +2 -11
  12. package/commands/chat/create-chat.command.ts +1 -0
  13. package/commands/chat/get-last-active-chat-command.ts +1 -0
  14. package/commands/message/create-text-message.command.ts +0 -1
  15. package/constants/ai-model/enums/ai-model-content-type.enum.ts +7 -3
  16. package/constants/index.ts +0 -1
  17. package/constants/model/enums/unified-model-content-type.enum.ts +1 -0
  18. package/constants/subscription/enums/subscription-feature-type.enum.ts +1 -2
  19. package/models/ai-model.schema.ts +7 -2
  20. package/models/chat.schema.ts +1 -1
  21. package/models/prompt.schema.ts +2 -0
  22. package/models/subscription-feature.schema.ts +1 -12
  23. package/package.json +1 -1
  24. package/build/constants/errors/errors.js +0 -4561
  25. package/build/constants/errors/index.js +0 -18
  26. package/build/constants/errors/verbose.js +0 -9
  27. package/constants/errors/errors.ts +0 -4605
  28. package/constants/errors/index.ts +0 -2
  29. package/constants/errors/verbose.ts +0 -7
@@ -6,6 +6,7 @@ const zod_1 = require("zod");
6
6
  var CreateChatCommand;
7
7
  (function (CreateChatCommand) {
8
8
  CreateChatCommand.RequestSchema = models_1.ChatSchema.pick({
9
+ aIModelId: true,
9
10
  categoryId: true,
10
11
  }).extend({
11
12
  folderId: zod_1.z.string().uuid().optional(),
@@ -7,6 +7,7 @@ var GetLastActiveChatCommand;
7
7
  (function (GetLastActiveChatCommand) {
8
8
  GetLastActiveChatCommand.RequestQuerySchema = models_1.ChatSchema.pick({
9
9
  categoryId: true,
10
+ aIModelId: true,
10
11
  });
11
12
  GetLastActiveChatCommand.Response = zod_1.z.object({
12
13
  data: models_1.ChatWithMessagesSchema,
@@ -10,7 +10,6 @@ var CreateTextMessageCommand;
10
10
  text: zod_1.z.string(),
11
11
  files: zod_1.z.array(zod_1.z.string().uuid()).optional().default([]),
12
12
  features: zod_1.z.array(zod_1.z.nativeEnum(constants_1.AI_MODEL_FEATURE)).optional().default([]),
13
- aiModelId: zod_1.z.string().uuid(),
14
13
  });
15
14
  CreateTextMessageCommand.RequestParamSchema = models_1.ChatSchema.pick({
16
15
  uuid: true,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AI_MODEL_CONTENT_TYPE = void 0;
4
- var AI_MODEL_CONTENT_TYPE;
5
- (function (AI_MODEL_CONTENT_TYPE) {
6
- AI_MODEL_CONTENT_TYPE["TEXT"] = "TEXT";
7
- })(AI_MODEL_CONTENT_TYPE || (exports.AI_MODEL_CONTENT_TYPE = AI_MODEL_CONTENT_TYPE = {}));
4
+ exports.AI_MODEL_CONTENT_TYPE = {
5
+ TEXT: 'TEXT',
6
+ IMAGE: 'IMAGE',
7
+ };
@@ -22,7 +22,6 @@ __exportStar(require("./cloud-payments"), exports);
22
22
  __exportStar(require("./course"), exports);
23
23
  __exportStar(require("./domains"), exports);
24
24
  __exportStar(require("./email"), exports);
25
- __exportStar(require("./errors"), exports);
26
25
  __exportStar(require("./file"), exports);
27
26
  __exportStar(require("./form-submission"), exports);
28
27
  __exportStar(require("./form-submission"), exports);
@@ -5,6 +5,7 @@ var UNIFIED_MODEL_CONTENT_TYPE;
5
5
  (function (UNIFIED_MODEL_CONTENT_TYPE) {
6
6
  // AI Model types
7
7
  UNIFIED_MODEL_CONTENT_TYPE["TEXT"] = "TEXT";
8
+ UNIFIED_MODEL_CONTENT_TYPE["IMAGE"] = "IMAGE";
8
9
  // Tool types
9
10
  UNIFIED_MODEL_CONTENT_TYPE["IMAGE_EDITOR"] = "IMAGE_EDITOR";
10
11
  UNIFIED_MODEL_CONTENT_TYPE["TEXT_TO_SPEECH"] = "TEXT_TO_SPEECH";
@@ -11,7 +11,6 @@ var SUBSCRIPTION_FEATURE_TYPE;
11
11
  SUBSCRIPTION_FEATURE_TYPE["ADVANCED_TOOLS_ACCESS"] = "advanced_tools_access";
12
12
  SUBSCRIPTION_FEATURE_TYPE["STT_MODEL_ACCESS"] = "stt_model_access";
13
13
  SUBSCRIPTION_FEATURE_TYPE["TTS_MODEL_ACCESS"] = "tts_model_access";
14
- SUBSCRIPTION_FEATURE_TYPE["IMAGE_GENERATION_ACCESS"] = "image_generation_access";
15
14
  SUBSCRIPTION_FEATURE_TYPE["IMAGE_GENERATION_QUOTA"] = "image_generation_quota";
16
15
  SUBSCRIPTION_FEATURE_TYPE["TTS_QUOTA"] = "tts_quota";
17
16
  SUBSCRIPTION_FEATURE_TYPE["STT_QUOTA"] = "stt_quota";
@@ -34,7 +33,7 @@ var SUBSCRIPTION_FEATURE_KIND;
34
33
  (function (SUBSCRIPTION_FEATURE_KIND) {
35
34
  SUBSCRIPTION_FEATURE_KIND["TEXT"] = "text";
36
35
  SUBSCRIPTION_FEATURE_KIND["AI_MODEL"] = "ai_model";
37
- SUBSCRIPTION_FEATURE_KIND["IMAGE_GENERATION"] = "image_generation";
36
+ SUBSCRIPTION_FEATURE_KIND["IMAGE"] = "image";
38
37
  SUBSCRIPTION_FEATURE_KIND["TTS"] = "tts";
39
38
  SUBSCRIPTION_FEATURE_KIND["STT"] = "stt";
40
39
  SUBSCRIPTION_FEATURE_KIND["PRESENTATIONS"] = "presentations";
@@ -15,7 +15,7 @@ exports.AiModelSchema = zod_1.z.object({
15
15
  order: zod_1.z.number(),
16
16
  canUse: zod_1.z.optional(zod_1.z.boolean()),
17
17
  status: zod_1.z.nativeEnum(constants_1.AI_MODEL_STATUS),
18
- contentType: zod_1.z.nativeEnum(constants_1.AI_MODEL_CONTENT_TYPE),
18
+ contentType: zod_1.z.enum(Object.values(constants_1.AI_MODEL_CONTENT_TYPE)),
19
19
  features: zod_1.z.array(zod_1.z.nativeEnum(constants_1.AI_MODEL_FEATURE)),
20
20
  iconVariants: zod_1.z.object({
21
21
  light: zod_1.z.object({
@@ -8,7 +8,7 @@ exports.ChatSchema = zod_1.z.object({
8
8
  userId: zod_1.z.nullable(zod_1.z.string().uuid()),
9
9
  unregisteredUserId: zod_1.z.nullable(zod_1.z.string().uuid()),
10
10
  categoryId: zod_1.z.string().uuid(),
11
- aIModelId: zod_1.z.string().uuid().nullable(),
11
+ aIModelId: zod_1.z.string().uuid(),
12
12
  title: zod_1.z.string(),
13
13
  chatStatus: zod_1.z.enum(Object.values(constants_1.CHAT_STATUS_ENUM)),
14
14
  folderId: zod_1.z.string().nullable(),
@@ -2,9 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PromptSchema = void 0;
4
4
  const zod_1 = require("zod");
5
+ const constants_1 = require("../constants");
5
6
  exports.PromptSchema = zod_1.z.object({
6
7
  uuid: zod_1.z.string().uuid(),
7
8
  content: zod_1.z.string(),
9
+ type: zod_1.z.nativeEnum(constants_1.AI_MODEL_CONTENT_TYPE),
8
10
  topicId: zod_1.z.string().uuid().nullable(),
9
11
  title: zod_1.z.string().nullable(),
10
12
  createdAt: zod_1.z.date(),
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubscriptionFeatureSchema = exports.InteriorDesignModelAccessFeatureSchema = exports.InteriorDesignQuotaFeatureSchema = exports.ImageEditorModelAccessFeatureSchema = exports.ImageEditorQuotaFeatureSchema = exports.WriterModelAccessFeatureSchema = exports.WriterQuotaFeatureSchema = exports.MusicModelAccessFeatureSchema = exports.MusicQuotaFeatureSchema = exports.PresentationQuotaFeatureSchema = exports.VideoModelAccessFeatureSchema = exports.VideoQuotaFeatureSchema = exports.STTQuotaFeatureSchema = exports.STTModelAccessFeatureSchema = exports.TTSQuotaFeatureSchema = exports.ImageGenerationQuotaFeatureSchema = exports.TtsModelAccessFeatureSchema = exports.AdvancedToolsAccessFeatureSchema = exports.WebSearchFeatureSchema = exports.ExtendedContextFeatureSchema = exports.MaxInputLengthFeatureSchema = exports.RequestsQuotaFeatureSchema = exports.ImageGenerationAccessFeatureSchema = exports.AiModelAccessFeatureSchema = exports.CarryoverBalanceFeatureSchema = exports.TokensFeatureSchema = exports.SubscriptionFeatureBaseSchema = void 0;
3
+ exports.SubscriptionFeatureSchema = exports.InteriorDesignModelAccessFeatureSchema = exports.InteriorDesignQuotaFeatureSchema = exports.ImageEditorModelAccessFeatureSchema = exports.ImageEditorQuotaFeatureSchema = exports.WriterModelAccessFeatureSchema = exports.WriterQuotaFeatureSchema = exports.MusicModelAccessFeatureSchema = exports.MusicQuotaFeatureSchema = exports.PresentationQuotaFeatureSchema = exports.VideoModelAccessFeatureSchema = exports.VideoQuotaFeatureSchema = exports.STTQuotaFeatureSchema = exports.STTModelAccessFeatureSchema = exports.TTSQuotaFeatureSchema = exports.ImageGenerationQuotaFeatureSchema = exports.TtsModelAccessFeatureSchema = exports.AdvancedToolsAccessFeatureSchema = exports.WebSearchFeatureSchema = exports.ExtendedContextFeatureSchema = exports.MaxInputLengthFeatureSchema = exports.RequestsQuotaFeatureSchema = exports.AiModelAccessFeatureSchema = exports.CarryoverBalanceFeatureSchema = exports.TokensFeatureSchema = exports.SubscriptionFeatureBaseSchema = void 0;
4
4
  const constants_1 = require("../constants");
5
5
  const zod_1 = require("zod");
6
6
  exports.SubscriptionFeatureBaseSchema = zod_1.z.object({
@@ -40,14 +40,6 @@ exports.AiModelAccessFeatureSchema = exports.SubscriptionFeatureBaseSchema.exten
40
40
  isAvailable: zod_1.z.boolean(),
41
41
  maxInputLength: zod_1.z.number(),
42
42
  });
43
- exports.ImageGenerationAccessFeatureSchema = exports.SubscriptionFeatureBaseSchema.extend({
44
- type: zod_1.z.literal(constants_1.SUBSCRIPTION_FEATURE_TYPE.IMAGE_GENERATION_ACCESS),
45
- kind: zod_1.z.literal(constants_1.SUBSCRIPTION_FEATURE_KIND.IMAGE_GENERATION),
46
- order: zod_1.z.number(),
47
- modelId: zod_1.z.string(),
48
- isAvailable: zod_1.z.boolean(),
49
- maxInputLength: zod_1.z.number(),
50
- });
51
43
  exports.RequestsQuotaFeatureSchema = exports.SubscriptionFeatureBaseSchema.extend({
52
44
  type: zod_1.z.literal(constants_1.SUBSCRIPTION_FEATURE_TYPE.TEXT_GENERATION_QUOTA),
53
45
  kind: zod_1.z.literal(constants_1.SUBSCRIPTION_FEATURE_KIND.TEXT),
@@ -82,7 +74,7 @@ exports.TtsModelAccessFeatureSchema = exports.SubscriptionFeatureBaseSchema.exte
82
74
  modelId: zod_1.z.string(),
83
75
  });
84
76
  exports.ImageGenerationQuotaFeatureSchema = exports.SubscriptionFeatureBaseSchema.extend({
85
- kind: zod_1.z.literal(constants_1.SUBSCRIPTION_FEATURE_KIND.IMAGE_GENERATION),
77
+ kind: zod_1.z.literal(constants_1.SUBSCRIPTION_FEATURE_KIND.IMAGE),
86
78
  type: zod_1.z.literal(constants_1.SUBSCRIPTION_FEATURE_TYPE.IMAGE_GENERATION_QUOTA),
87
79
  value: zod_1.z.number(),
88
80
  });
@@ -187,5 +179,4 @@ exports.SubscriptionFeatureSchema = zod_1.z.union([
187
179
  exports.ImageEditorModelAccessFeatureSchema,
188
180
  exports.InteriorDesignQuotaFeatureSchema,
189
181
  exports.InteriorDesignModelAccessFeatureSchema,
190
- exports.ImageGenerationAccessFeatureSchema,
191
182
  ]);
@@ -3,6 +3,7 @@ import { z } from 'zod';
3
3
 
4
4
  export namespace CreateChatCommand {
5
5
  export const RequestSchema = ChatSchema.pick({
6
+ aIModelId: true,
6
7
  categoryId: true,
7
8
  }).extend({
8
9
  folderId: z.string().uuid().optional(),
@@ -4,6 +4,7 @@ import { z } from 'zod';
4
4
  export namespace GetLastActiveChatCommand {
5
5
  export const RequestQuerySchema = ChatSchema.pick({
6
6
  categoryId: true,
7
+ aIModelId: true,
7
8
  });
8
9
 
9
10
  export const Response = z.object({
@@ -7,7 +7,6 @@ export namespace CreateTextMessageCommand {
7
7
  text: z.string(),
8
8
  files: z.array(z.string().uuid()).optional().default([]),
9
9
  features: z.array(z.nativeEnum(AI_MODEL_FEATURE)).optional().default([]),
10
- aiModelId: z.string().uuid(),
11
10
  });
12
11
 
13
12
  export const RequestParamSchema = ChatSchema.pick({
@@ -1,3 +1,7 @@
1
- export enum AI_MODEL_CONTENT_TYPE {
2
- TEXT = 'TEXT',
3
- }
1
+ export const AI_MODEL_CONTENT_TYPE = {
2
+ TEXT: 'TEXT',
3
+ IMAGE: 'IMAGE',
4
+ } as const;
5
+
6
+ export type TAIModelContentTypeEnum =
7
+ (typeof AI_MODEL_CONTENT_TYPE)[keyof typeof AI_MODEL_CONTENT_TYPE];
@@ -6,7 +6,6 @@ export * from './cloud-payments';
6
6
  export * from './course';
7
7
  export * from './domains';
8
8
  export * from './email';
9
- export * from './errors';
10
9
  export * from './file';
11
10
  export * from './form-submission';
12
11
  export * from './form-submission';
@@ -1,6 +1,7 @@
1
1
  export enum UNIFIED_MODEL_CONTENT_TYPE {
2
2
  // AI Model types
3
3
  TEXT = 'TEXT',
4
+ IMAGE = 'IMAGE',
4
5
  // Tool types
5
6
  IMAGE_EDITOR = 'IMAGE_EDITOR',
6
7
  TEXT_TO_SPEECH = 'TEXT_TO_SPEECH',
@@ -7,7 +7,6 @@ export enum SUBSCRIPTION_FEATURE_TYPE {
7
7
  ADVANCED_TOOLS_ACCESS = 'advanced_tools_access',
8
8
  STT_MODEL_ACCESS = 'stt_model_access',
9
9
  TTS_MODEL_ACCESS = 'tts_model_access',
10
- IMAGE_GENERATION_ACCESS = 'image_generation_access',
11
10
  IMAGE_GENERATION_QUOTA = 'image_generation_quota',
12
11
  TTS_QUOTA = 'tts_quota',
13
12
  STT_QUOTA = 'stt_quota',
@@ -30,7 +29,7 @@ export enum SUBSCRIPTION_FEATURE_TYPE {
30
29
  export enum SUBSCRIPTION_FEATURE_KIND {
31
30
  TEXT = 'text',
32
31
  AI_MODEL = 'ai_model',
33
- IMAGE_GENERATION = 'image_generation',
32
+ IMAGE = 'image',
34
33
  TTS = 'tts',
35
34
  STT = 'stt',
36
35
  PRESENTATIONS = 'presentations',
@@ -1,5 +1,10 @@
1
1
  import { z } from 'zod';
2
- import { AI_MODEL_CONTENT_TYPE, AI_MODEL_FEATURE, AI_MODEL_STATUS } from '../constants';
2
+ import {
3
+ AI_MODEL_CONTENT_TYPE,
4
+ AI_MODEL_FEATURE,
5
+ AI_MODEL_STATUS,
6
+ TAIModelContentTypeEnum,
7
+ } from '../constants';
3
8
  import { AiModelConfigSchema } from './ai-model-config.schema';
4
9
 
5
10
  export const AiModelSchema = z.object({
@@ -13,7 +18,7 @@ export const AiModelSchema = z.object({
13
18
  order: z.number(),
14
19
  canUse: z.optional(z.boolean()),
15
20
  status: z.nativeEnum(AI_MODEL_STATUS),
16
- contentType: z.nativeEnum(AI_MODEL_CONTENT_TYPE),
21
+ contentType: z.enum(Object.values(AI_MODEL_CONTENT_TYPE) as [TAIModelContentTypeEnum]),
17
22
  features: z.array(z.nativeEnum(AI_MODEL_FEATURE)),
18
23
  iconVariants: z.object({
19
24
  light: z.object({
@@ -6,7 +6,7 @@ export const ChatSchema = z.object({
6
6
  userId: z.nullable(z.string().uuid()),
7
7
  unregisteredUserId: z.nullable(z.string().uuid()),
8
8
  categoryId: z.string().uuid(),
9
- aIModelId: z.string().uuid().nullable(),
9
+ aIModelId: z.string().uuid(),
10
10
  title: z.string(),
11
11
  chatStatus: z.enum(Object.values(CHAT_STATUS_ENUM) as [TChatStatusEnum]),
12
12
  folderId: z.string().nullable(),
@@ -1,8 +1,10 @@
1
1
  import { z } from 'zod';
2
+ import { AI_MODEL_CONTENT_TYPE } from '../constants';
2
3
 
3
4
  export const PromptSchema = z.object({
4
5
  uuid: z.string().uuid(),
5
6
  content: z.string(),
7
+ type: z.nativeEnum(AI_MODEL_CONTENT_TYPE),
6
8
  topicId: z.string().uuid().nullable(),
7
9
  title: z.string().nullable(),
8
10
 
@@ -51,16 +51,6 @@ export const AiModelAccessFeatureSchema = SubscriptionFeatureBaseSchema.extend({
51
51
  });
52
52
  export type AiModelAccessFeature = z.infer<typeof AiModelAccessFeatureSchema>;
53
53
 
54
- export const ImageGenerationAccessFeatureSchema = SubscriptionFeatureBaseSchema.extend({
55
- type: z.literal(SUBSCRIPTION_FEATURE_TYPE.IMAGE_GENERATION_ACCESS),
56
- kind: z.literal(SUBSCRIPTION_FEATURE_KIND.IMAGE_GENERATION),
57
- order: z.number(),
58
- modelId: z.string(),
59
- isAvailable: z.boolean(),
60
- maxInputLength: z.number(),
61
- });
62
- export type ImageGenerationAccessFeature = z.infer<typeof ImageGenerationAccessFeatureSchema>;
63
-
64
54
  export const RequestsQuotaFeatureSchema = SubscriptionFeatureBaseSchema.extend({
65
55
  type: z.literal(SUBSCRIPTION_FEATURE_TYPE.TEXT_GENERATION_QUOTA),
66
56
  kind: z.literal(SUBSCRIPTION_FEATURE_KIND.TEXT),
@@ -107,7 +97,7 @@ export const TtsModelAccessFeatureSchema = SubscriptionFeatureBaseSchema.extend(
107
97
  export type TtsModelAccessFeature = z.infer<typeof TtsModelAccessFeatureSchema>;
108
98
 
109
99
  export const ImageGenerationQuotaFeatureSchema = SubscriptionFeatureBaseSchema.extend({
110
- kind: z.literal(SUBSCRIPTION_FEATURE_KIND.IMAGE_GENERATION),
100
+ kind: z.literal(SUBSCRIPTION_FEATURE_KIND.IMAGE),
111
101
  type: z.literal(SUBSCRIPTION_FEATURE_TYPE.IMAGE_GENERATION_QUOTA),
112
102
  value: z.number(),
113
103
  });
@@ -244,7 +234,6 @@ export const SubscriptionFeatureSchema = z.union([
244
234
  ImageEditorModelAccessFeatureSchema,
245
235
  InteriorDesignQuotaFeatureSchema,
246
236
  InteriorDesignModelAccessFeatureSchema,
247
- ImageGenerationAccessFeatureSchema,
248
237
  ]);
249
238
 
250
239
  export type SubscriptionFeature = z.infer<typeof SubscriptionFeatureSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.9.6",
3
+ "version": "0.9.7",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",