@purpleschool/gptbot 0.4.1 → 0.5.0
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/api/controllers/chat-private.ts +1 -0
- package/api/controllers/chat-public.ts +1 -0
- package/api/controllers/index.ts +1 -0
- package/api/controllers/message.ts +2 -0
- package/api/controllers/subscription.ts +1 -0
- package/api/routes.ts +2 -0
- package/build/api/controllers/chat-private.js +1 -0
- package/build/api/controllers/chat-public.js +1 -0
- package/build/api/controllers/index.js +1 -0
- package/build/api/controllers/message.js +5 -0
- package/build/api/controllers/subscription.js +1 -0
- package/build/api/routes.js +1 -0
- package/build/commands/chat/archive-all.command.js +12 -0
- package/build/commands/chat/check-limit.command.v2.js +12 -0
- package/build/commands/chat/create-chat.command.v2.js +17 -0
- package/build/commands/chat/delete-chat.command.v2.js +14 -0
- package/build/commands/chat/find-chat-by-uuid.command.js +14 -0
- package/build/commands/chat/find-chats.command.js +26 -0
- package/build/commands/chat/get-my-last-active-chat-command.v2.js +17 -0
- package/build/commands/chat/index.js +6 -0
- package/build/commands/message/create-image-message.command.js +18 -0
- package/build/commands/message/create-text-message.command.js +17 -0
- package/build/commands/message/index.js +3 -0
- package/build/commands/message/rate-message.command.js +17 -0
- package/build/commands/payment/pay.command.js +2 -2
- package/build/commands/subscription/index.js +1 -0
- package/build/commands/subscription/recover-subscription.command.js +13 -0
- package/build/constants/ai-model/enums/ai-model-content-type.enum.js +7 -0
- package/build/constants/ai-model/enums/index.js +17 -0
- package/build/constants/ai-model/index.js +17 -0
- package/build/constants/chat/enums/dalle-image-size.enum.js +9 -0
- package/build/constants/chat/enums/index.js +1 -0
- package/build/constants/cloud-payments/index.js +2 -1
- package/build/constants/errors/errors.js +59 -4
- package/build/constants/index.js +2 -0
- package/build/constants/message/enums/index.js +17 -0
- package/build/constants/message/enums/user-reaction.enum.js +7 -0
- package/build/constants/message/index.js +17 -0
- package/build/models/ai-model.schema.js +2 -0
- package/build/models/message.schema.js +2 -0
- package/commands/chat/archive-all.command.ts +11 -0
- package/commands/chat/check-limit.command.v2.ts +10 -0
- package/commands/chat/create-chat.command.v2.ts +19 -0
- package/commands/chat/delete-chat.command.v2.ts +15 -0
- package/commands/chat/find-chat-by-uuid.command.ts +16 -0
- package/commands/chat/find-chats.command.ts +38 -0
- package/commands/chat/get-my-last-active-chat-command.v2.ts +20 -0
- package/commands/chat/index.ts +6 -0
- package/commands/message/create-image-message.command.ts +24 -0
- package/commands/message/create-text-message.command.ts +20 -0
- package/commands/message/index.ts +3 -0
- package/commands/message/rate-message.command.ts +20 -0
- package/commands/payment/pay.command.ts +2 -2
- package/commands/subscription/index.ts +1 -0
- package/commands/subscription/recover-subscription.command.ts +15 -0
- package/constants/ai-model/enums/ai-model-content-type.enum.ts +7 -0
- package/constants/ai-model/enums/index.ts +1 -0
- package/constants/ai-model/index.ts +1 -0
- package/constants/chat/enums/dalle-image-size.enum.ts +5 -0
- package/constants/chat/enums/index.ts +1 -0
- package/constants/cloud-payments/index.ts +2 -0
- package/constants/errors/errors.ts +59 -4
- package/constants/index.ts +2 -0
- package/constants/message/enums/index.ts +1 -0
- package/constants/message/enums/user-reaction.enum.ts +6 -0
- package/constants/message/index.ts +1 -0
- package/models/ai-model.schema.ts +2 -1
- package/models/message.schema.ts +2 -0
- package/package.json +1 -1
package/api/controllers/index.ts
CHANGED
package/api/routes.ts
CHANGED
|
@@ -110,6 +110,8 @@ export const REST_API = {
|
|
|
110
110
|
GET_MY: `${ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${CONTROLLERS.SUBSCRIPTION_ROUTES.GET_MY}`,
|
|
111
111
|
CANCEL: (uuid: string) =>
|
|
112
112
|
`${ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${uuid}/${CONTROLLERS.SUBSCRIPTION_ROUTES.CANCEL}`,
|
|
113
|
+
RECOVER: (uuid: string) =>
|
|
114
|
+
`${ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${uuid}/${CONTROLLERS.SUBSCRIPTION_ROUTES.RECOVER}`,
|
|
113
115
|
PATCH: (uuid: string) => `${ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${uuid}`,
|
|
114
116
|
DELETE: (uuid: string) => `${ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${uuid}`,
|
|
115
117
|
CREATE: `${ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}`,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MESSAGE_CONTROLLER_PUBLIC = exports.MESSAGE_CONTROLLER_PRIVATE = void 0;
|
|
4
|
+
exports.MESSAGE_CONTROLLER_PRIVATE = 'private/message';
|
|
5
|
+
exports.MESSAGE_CONTROLLER_PUBLIC = 'public/message';
|
package/build/api/routes.js
CHANGED
|
@@ -115,6 +115,7 @@ exports.REST_API = {
|
|
|
115
115
|
BUY: (uuid) => `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${CONTROLLERS.SUBSCRIPTION_ROUTES.BUY}/${uuid}`,
|
|
116
116
|
GET_MY: `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${CONTROLLERS.SUBSCRIPTION_ROUTES.GET_MY}`,
|
|
117
117
|
CANCEL: (uuid) => `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${uuid}/${CONTROLLERS.SUBSCRIPTION_ROUTES.CANCEL}`,
|
|
118
|
+
RECOVER: (uuid) => `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${uuid}/${CONTROLLERS.SUBSCRIPTION_ROUTES.RECOVER}`,
|
|
118
119
|
PATCH: (uuid) => `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${uuid}`,
|
|
119
120
|
DELETE: (uuid) => `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${uuid}`,
|
|
120
121
|
CREATE: `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}`,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArchiveAllCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
var ArchiveAllCommand;
|
|
6
|
+
(function (ArchiveAllCommand) {
|
|
7
|
+
ArchiveAllCommand.ResponseSchema = zod_1.z.object({
|
|
8
|
+
data: zod_1.z.object({
|
|
9
|
+
isArchived: zod_1.z.boolean(),
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
12
|
+
})(ArchiveAllCommand || (exports.ArchiveAllCommand = ArchiveAllCommand = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CheckLimitV2Command = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
var CheckLimitV2Command;
|
|
6
|
+
(function (CheckLimitV2Command) {
|
|
7
|
+
CheckLimitV2Command.ResponseSchema = zod_1.z.object({
|
|
8
|
+
data: zod_1.z.object({
|
|
9
|
+
totalTokenBalance: zod_1.z.number(),
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
12
|
+
})(CheckLimitV2Command || (exports.CheckLimitV2Command = CheckLimitV2Command = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateChatV2Command = void 0;
|
|
4
|
+
const models_1 = require("../../models");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
var CreateChatV2Command;
|
|
7
|
+
(function (CreateChatV2Command) {
|
|
8
|
+
CreateChatV2Command.RequestSchema = models_1.ChatSchema.pick({
|
|
9
|
+
aIModelId: true,
|
|
10
|
+
categoryId: true,
|
|
11
|
+
});
|
|
12
|
+
CreateChatV2Command.ResponseSchema = zod_1.z.object({
|
|
13
|
+
data: models_1.ChatSchema.extend({
|
|
14
|
+
messages: zod_1.z.array(models_1.MessageSchema),
|
|
15
|
+
}),
|
|
16
|
+
});
|
|
17
|
+
})(CreateChatV2Command || (exports.CreateChatV2Command = CreateChatV2Command = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteChatV2Command = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var DeleteChatV2Command;
|
|
7
|
+
(function (DeleteChatV2Command) {
|
|
8
|
+
DeleteChatV2Command.RequestSchema = models_1.ChatSchema.pick({
|
|
9
|
+
uuid: true,
|
|
10
|
+
});
|
|
11
|
+
DeleteChatV2Command.ResponseSchema = zod_1.z.object({
|
|
12
|
+
isDeleted: zod_1.z.boolean(),
|
|
13
|
+
});
|
|
14
|
+
})(DeleteChatV2Command || (exports.DeleteChatV2Command = DeleteChatV2Command = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindChatByUUIDCommand = void 0;
|
|
4
|
+
const models_1 = require("../../models");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
var FindChatByUUIDCommand;
|
|
7
|
+
(function (FindChatByUUIDCommand) {
|
|
8
|
+
FindChatByUUIDCommand.RequestByParamSchema = models_1.ChatSchema.pick({
|
|
9
|
+
uuid: true,
|
|
10
|
+
});
|
|
11
|
+
FindChatByUUIDCommand.ResponseSchema = zod_1.z.object({
|
|
12
|
+
data: models_1.ChatSchema,
|
|
13
|
+
});
|
|
14
|
+
})(FindChatByUUIDCommand || (exports.FindChatByUUIDCommand = FindChatByUUIDCommand = {}));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindChatsCommand = void 0;
|
|
4
|
+
const models_1 = require("../../models");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
var FindChatsCommand;
|
|
7
|
+
(function (FindChatsCommand) {
|
|
8
|
+
const PaginationQuerySchema = zod_1.z.object({
|
|
9
|
+
limit: zod_1.z.string().regex(/^\d+$/, { message: 'Limit должен быть числом' }).transform(Number),
|
|
10
|
+
offset: zod_1.z
|
|
11
|
+
.string()
|
|
12
|
+
.regex(/^\d+$/, { message: 'Offset должен быть числом' })
|
|
13
|
+
.transform(Number),
|
|
14
|
+
});
|
|
15
|
+
const QuerySchema = zod_1.z.intersection(models_1.ChatSchema.pick({ categoryId: true, aIModelId: true }).partial(), models_1.AiModelSchema.pick({ contentType: true }).partial());
|
|
16
|
+
FindChatsCommand.RequestByQuerySchema = zod_1.z.intersection(QuerySchema, PaginationQuerySchema);
|
|
17
|
+
FindChatsCommand.ResponseSchema = zod_1.z.object({
|
|
18
|
+
data: zod_1.z.array(models_1.ChatSchema.extend({
|
|
19
|
+
messages: zod_1.z.array(models_1.MessageSchema),
|
|
20
|
+
})),
|
|
21
|
+
count: zod_1.z.number(),
|
|
22
|
+
});
|
|
23
|
+
FindChatsCommand.ResponseByUUIDSchema = zod_1.z.object({
|
|
24
|
+
data: models_1.ChatSchema,
|
|
25
|
+
});
|
|
26
|
+
})(FindChatsCommand || (exports.FindChatsCommand = FindChatsCommand = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetLastActiveChatV2Command = void 0;
|
|
4
|
+
const models_1 = require("../../models");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
var GetLastActiveChatV2Command;
|
|
7
|
+
(function (GetLastActiveChatV2Command) {
|
|
8
|
+
GetLastActiveChatV2Command.RequestQuerySchema = zod_1.z.intersection(models_1.ChatSchema.pick({
|
|
9
|
+
categoryId: true,
|
|
10
|
+
aIModelId: true,
|
|
11
|
+
}).partial(), models_1.AiModelSchema.pick({ contentType: true }).partial());
|
|
12
|
+
GetLastActiveChatV2Command.Response = zod_1.z.object({
|
|
13
|
+
data: models_1.ChatSchema.extend({
|
|
14
|
+
messages: zod_1.z.array(models_1.MessageSchema),
|
|
15
|
+
}),
|
|
16
|
+
});
|
|
17
|
+
})(GetLastActiveChatV2Command || (exports.GetLastActiveChatV2Command = GetLastActiveChatV2Command = {}));
|
|
@@ -20,3 +20,9 @@ __exportStar(require("./create-chat.command"), exports);
|
|
|
20
20
|
__exportStar(require("./find-chat.command"), exports);
|
|
21
21
|
__exportStar(require("./get-my-last-active-chat.command"), exports);
|
|
22
22
|
__exportStar(require("./check-limit.command"), exports);
|
|
23
|
+
__exportStar(require("./check-limit.command.v2"), exports);
|
|
24
|
+
__exportStar(require("./get-my-last-active-chat-command.v2"), exports);
|
|
25
|
+
__exportStar(require("./create-chat.command.v2"), exports);
|
|
26
|
+
__exportStar(require("./find-chat-by-uuid.command"), exports);
|
|
27
|
+
__exportStar(require("./archive-all.command"), exports);
|
|
28
|
+
__exportStar(require("./delete-chat.command.v2"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateImageMessageCommand = void 0;
|
|
4
|
+
const models_1 = require("../../models");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
7
|
+
var CreateImageMessageCommand;
|
|
8
|
+
(function (CreateImageMessageCommand) {
|
|
9
|
+
CreateImageMessageCommand.RequestSchema = zod_1.z.intersection(models_1.MessageSchema.pick({ text: true }), zod_1.z.object({
|
|
10
|
+
size: zod_1.z.nativeEnum(constants_1.DALLE_IMAGE_SIZE),
|
|
11
|
+
}));
|
|
12
|
+
CreateImageMessageCommand.RequestParamSchema = models_1.ChatSchema.pick({
|
|
13
|
+
uuid: true,
|
|
14
|
+
});
|
|
15
|
+
CreateImageMessageCommand.ResponseSchema = zod_1.z.object({
|
|
16
|
+
data: models_1.MessageSchema,
|
|
17
|
+
});
|
|
18
|
+
})(CreateImageMessageCommand || (exports.CreateImageMessageCommand = CreateImageMessageCommand = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateTextMessageCommand = void 0;
|
|
4
|
+
const models_1 = require("../../models");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
var CreateTextMessageCommand;
|
|
7
|
+
(function (CreateTextMessageCommand) {
|
|
8
|
+
CreateTextMessageCommand.RequestSchema = models_1.MessageSchema.pick({
|
|
9
|
+
text: true,
|
|
10
|
+
});
|
|
11
|
+
CreateTextMessageCommand.RequestParamSchema = models_1.ChatSchema.pick({
|
|
12
|
+
uuid: true,
|
|
13
|
+
});
|
|
14
|
+
CreateTextMessageCommand.ResponseSchema = zod_1.z.object({
|
|
15
|
+
data: models_1.MessageSchema,
|
|
16
|
+
});
|
|
17
|
+
})(CreateTextMessageCommand || (exports.CreateTextMessageCommand = CreateTextMessageCommand = {}));
|
|
@@ -15,3 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./create-message.command"), exports);
|
|
18
|
+
__exportStar(require("./create-text-message.command"), exports);
|
|
19
|
+
__exportStar(require("./create-image-message.command"), exports);
|
|
20
|
+
__exportStar(require("./rate-message.command"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RateMessageCommand = void 0;
|
|
4
|
+
const models_1 = require("../../models");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
var RateMessageCommand;
|
|
7
|
+
(function (RateMessageCommand) {
|
|
8
|
+
RateMessageCommand.RequestSchema = models_1.MessageSchema.pick({
|
|
9
|
+
userReaction: true,
|
|
10
|
+
});
|
|
11
|
+
RateMessageCommand.RequestParamSchema = models_1.MessageSchema.pick({
|
|
12
|
+
uuid: true,
|
|
13
|
+
});
|
|
14
|
+
RateMessageCommand.ResponseSchema = zod_1.z.object({
|
|
15
|
+
data: models_1.MessageSchema,
|
|
16
|
+
});
|
|
17
|
+
})(RateMessageCommand || (exports.RateMessageCommand = RateMessageCommand = {}));
|
|
@@ -14,13 +14,13 @@ var PayCommand;
|
|
|
14
14
|
DateTime: zod_1.z.string(),
|
|
15
15
|
CardFirstSix: zod_1.z.string(),
|
|
16
16
|
CardLastFour: zod_1.z.string(),
|
|
17
|
-
SubscriptionId: zod_1.z.string(),
|
|
17
|
+
SubscriptionId: zod_1.z.string().optional(),
|
|
18
18
|
CardType: zod_1.z.string(),
|
|
19
19
|
CardExpDate: zod_1.z.string(),
|
|
20
20
|
TestMode: zod_1.z.string().transform((testMode) => parseInt(testMode, 10)),
|
|
21
21
|
Status: zod_1.z.string(),
|
|
22
22
|
OperationType: zod_1.z.string(),
|
|
23
|
-
InvoiceId: zod_1.z.string(),
|
|
23
|
+
InvoiceId: zod_1.z.string().optional(),
|
|
24
24
|
AccountId: zod_1.z.string(),
|
|
25
25
|
})
|
|
26
26
|
.transform((data) => ({
|
|
@@ -19,3 +19,4 @@ __exportStar(require("./delete-subscription.command"), exports);
|
|
|
19
19
|
__exportStar(require("./create-subscription.command"), exports);
|
|
20
20
|
__exportStar(require("./find-subscription.command"), exports);
|
|
21
21
|
__exportStar(require("./cancel-subscription.command"), exports);
|
|
22
|
+
__exportStar(require("./recover-subscription.command"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RecoverSubscriptionCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
var RecoverSubscriptionCommand;
|
|
6
|
+
(function (RecoverSubscriptionCommand) {
|
|
7
|
+
RecoverSubscriptionCommand.RequestParamSchema = zod_1.z.object({
|
|
8
|
+
uuidSiteUserToSubscription: zod_1.z.string(),
|
|
9
|
+
});
|
|
10
|
+
RecoverSubscriptionCommand.ResponseSchema = zod_1.z.object({
|
|
11
|
+
isSuccess: zod_1.z.boolean(),
|
|
12
|
+
});
|
|
13
|
+
})(RecoverSubscriptionCommand || (exports.RecoverSubscriptionCommand = RecoverSubscriptionCommand = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ai-model-content-type.enum"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./enums"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DALLE_IMAGE_SIZE = void 0;
|
|
4
|
+
var DALLE_IMAGE_SIZE;
|
|
5
|
+
(function (DALLE_IMAGE_SIZE) {
|
|
6
|
+
DALLE_IMAGE_SIZE["_1024x1024"] = "1024x1024";
|
|
7
|
+
DALLE_IMAGE_SIZE["_1024x1792"] = "1024x1792";
|
|
8
|
+
DALLE_IMAGE_SIZE["_1792x1024"] = "1792x1024";
|
|
9
|
+
})(DALLE_IMAGE_SIZE || (exports.DALLE_IMAGE_SIZE = DALLE_IMAGE_SIZE = {}));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CLOUD_PAYMENTS_CANCEL = exports.FORMATS = void 0;
|
|
3
|
+
exports.CLOUD_PAYMENTS_UPDATE = exports.CLOUD_PAYMENTS_CANCEL = exports.FORMATS = void 0;
|
|
4
4
|
exports.FORMATS = {
|
|
5
5
|
UTF8: 'utf-8',
|
|
6
6
|
BASE64: 'base64',
|
|
7
7
|
SHA256: 'sha256',
|
|
8
8
|
};
|
|
9
9
|
exports.CLOUD_PAYMENTS_CANCEL = 'https://api.cloudpayments.ru/subscriptions/cancel';
|
|
10
|
+
exports.CLOUD_PAYMENTS_UPDATE = 'https://api.cloudpayments.ru/subscriptions/update';
|
|
@@ -244,6 +244,11 @@ exports.ERRORS = {
|
|
|
244
244
|
message: 'Заказ с таким uuid не найден',
|
|
245
245
|
httpCode: 404,
|
|
246
246
|
},
|
|
247
|
+
ORDER_NOT_FOUND: {
|
|
248
|
+
code: 'A152',
|
|
249
|
+
message: 'Заказ не найден',
|
|
250
|
+
httpCode: 404,
|
|
251
|
+
},
|
|
247
252
|
ORDER_DELETE_ERROR: { code: 'A057', message: 'Заказ не был удален', httpCode: 500 },
|
|
248
253
|
ORDER_CREATE_ERROR: { code: 'A058', message: 'Заказ не был создан', httpCode: 500 },
|
|
249
254
|
ORDER_FIND_ERROR: { code: 'A059', message: 'Заказ не найден', httpCode: 404 },
|
|
@@ -415,14 +420,64 @@ exports.ERRORS = {
|
|
|
415
420
|
message: 'Не удалось получить количество сообщений',
|
|
416
421
|
httpCode: 500,
|
|
417
422
|
},
|
|
423
|
+
VALIDATE_EMAIL_ERROR: {
|
|
424
|
+
code: 'A098',
|
|
425
|
+
message: 'Не удалось валидировать почту',
|
|
426
|
+
httpCode: 500,
|
|
427
|
+
},
|
|
428
|
+
RECOVER_SUBSCRIPTION: {
|
|
429
|
+
code: 'A099',
|
|
430
|
+
message: 'Не удалось востановить подписку',
|
|
431
|
+
httpCode: 500,
|
|
432
|
+
},
|
|
433
|
+
CANCEL_SUBSCRIPTION: {
|
|
434
|
+
code: 'A100',
|
|
435
|
+
message: 'Не удалось закрыть подписку',
|
|
436
|
+
httpCode: 500,
|
|
437
|
+
},
|
|
438
|
+
SEND_EMAIL: {
|
|
439
|
+
code: 'A101',
|
|
440
|
+
message: 'Не удалось отправить email',
|
|
441
|
+
httpCode: 500,
|
|
442
|
+
},
|
|
418
443
|
VERIFY_EMAIL: {
|
|
419
|
-
code: '
|
|
444
|
+
code: 'A102',
|
|
420
445
|
message: 'Не удалось подтвердить почту',
|
|
421
446
|
httpCode: 500,
|
|
422
447
|
},
|
|
423
|
-
|
|
424
|
-
code: '
|
|
425
|
-
message: 'Не удалось
|
|
448
|
+
CHAT_CHECK_LIMIT: {
|
|
449
|
+
code: 'A103',
|
|
450
|
+
message: 'Не удалось проверить баланс для доступа к чату',
|
|
426
451
|
httpCode: 500,
|
|
427
452
|
},
|
|
453
|
+
CHAT_OWNERSHIP_ERROR: {
|
|
454
|
+
code: 'A104',
|
|
455
|
+
message: 'Вы не являетесь владельцем чата',
|
|
456
|
+
httpCode: 403,
|
|
457
|
+
},
|
|
458
|
+
CHAT_INCORRECT_CONTENT_TYPE: {
|
|
459
|
+
code: 'A105',
|
|
460
|
+
message: 'Чат не поддерживает данный тип контента',
|
|
461
|
+
httpCode: 400,
|
|
462
|
+
},
|
|
463
|
+
MESSAGE_REACTION_ERROR: {
|
|
464
|
+
code: 'A106',
|
|
465
|
+
message: 'Произошла ошибка при оценке сообщения',
|
|
466
|
+
httpCode: 500,
|
|
467
|
+
},
|
|
468
|
+
MESSAGE_NOT_FOUND: {
|
|
469
|
+
code: 'A107',
|
|
470
|
+
message: 'Сообщение не найдено',
|
|
471
|
+
httpCode: 404,
|
|
472
|
+
},
|
|
473
|
+
MESSAGE_INVALID_TYPE: {
|
|
474
|
+
code: 'A108',
|
|
475
|
+
message: 'Неверный тип сообщения',
|
|
476
|
+
httpCode: 400,
|
|
477
|
+
},
|
|
478
|
+
INSUFFICIENT_BALANCE: {
|
|
479
|
+
code: 'A109',
|
|
480
|
+
message: 'Недосточный баланс',
|
|
481
|
+
httpCode: 403,
|
|
482
|
+
},
|
|
428
483
|
};
|
package/build/constants/index.js
CHANGED
|
@@ -22,3 +22,5 @@ __exportStar(require("./chat"), exports);
|
|
|
22
22
|
__exportStar(require("./subscription"), exports);
|
|
23
23
|
__exportStar(require("./product"), exports);
|
|
24
24
|
__exportStar(require("./category"), exports);
|
|
25
|
+
__exportStar(require("./ai-model"), exports);
|
|
26
|
+
__exportStar(require("./message"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./user-reaction.enum"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./enums"), exports);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AiModelSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
5
6
|
exports.AiModelSchema = zod_1.z.object({
|
|
6
7
|
uuid: zod_1.z.string().uuid(),
|
|
7
8
|
title: zod_1.z.string(),
|
|
@@ -11,6 +12,7 @@ exports.AiModelSchema = zod_1.z.object({
|
|
|
11
12
|
tokenMultiplicator: zod_1.z.number(),
|
|
12
13
|
order: zod_1.z.number(),
|
|
13
14
|
canUse: zod_1.z.optional(zod_1.z.boolean()),
|
|
15
|
+
contentType: zod_1.z.enum(Object.values(constants_1.AI_MODEL_CONTENT_TYPE)),
|
|
14
16
|
createdAt: zod_1.z.date(),
|
|
15
17
|
updatedAt: zod_1.z.date(),
|
|
16
18
|
});
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MessageSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
5
6
|
exports.MessageSchema = zod_1.z.object({
|
|
6
7
|
uuid: zod_1.z.string().uuid(),
|
|
7
8
|
text: zod_1.z.string(),
|
|
8
9
|
chatId: zod_1.z.nullable(zod_1.z.string().uuid()),
|
|
9
10
|
role: zod_1.z.string(),
|
|
10
11
|
tokenUsage: zod_1.z.number(),
|
|
12
|
+
userReaction: zod_1.z.nullable(zod_1.z.enum(Object.values(constants_1.USER_REACTION))),
|
|
11
13
|
createdAt: zod_1.z.date(),
|
|
12
14
|
updatedAt: zod_1.z.date(),
|
|
13
15
|
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ChatSchema, MessageSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace CreateChatV2Command {
|
|
5
|
+
export const RequestSchema = ChatSchema.pick({
|
|
6
|
+
aIModelId: true,
|
|
7
|
+
categoryId: true,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type RequestSchema = z.infer<typeof RequestSchema>;
|
|
11
|
+
|
|
12
|
+
export const ResponseSchema = z.object({
|
|
13
|
+
data: ChatSchema.extend({
|
|
14
|
+
messages: z.array(MessageSchema),
|
|
15
|
+
}),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ChatSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace DeleteChatV2Command {
|
|
5
|
+
export const RequestSchema = ChatSchema.pick({
|
|
6
|
+
uuid: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
isDeleted: z.boolean(),
|
|
13
|
+
});
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ChatSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace FindChatByUUIDCommand {
|
|
5
|
+
export const RequestByParamSchema = ChatSchema.pick({
|
|
6
|
+
uuid: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestByParamSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: ChatSchema,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AiModelSchema, ChatSchema, MessageSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace FindChatsCommand {
|
|
5
|
+
const PaginationQuerySchema = z.object({
|
|
6
|
+
limit: z.string().regex(/^\d+$/, { message: 'Limit должен быть числом' }).transform(Number),
|
|
7
|
+
offset: z
|
|
8
|
+
.string()
|
|
9
|
+
.regex(/^\d+$/, { message: 'Offset должен быть числом' })
|
|
10
|
+
.transform(Number),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const QuerySchema = z.intersection(
|
|
14
|
+
ChatSchema.pick({ categoryId: true, aIModelId: true }).partial(),
|
|
15
|
+
AiModelSchema.pick({ contentType: true }).partial(),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export const RequestByQuerySchema = z.intersection(QuerySchema, PaginationQuerySchema);
|
|
19
|
+
|
|
20
|
+
export type RequestByQuery = z.infer<typeof RequestByQuerySchema>;
|
|
21
|
+
|
|
22
|
+
export const ResponseSchema = z.object({
|
|
23
|
+
data: z.array(
|
|
24
|
+
ChatSchema.extend({
|
|
25
|
+
messages: z.array(MessageSchema),
|
|
26
|
+
}),
|
|
27
|
+
),
|
|
28
|
+
count: z.number(),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
32
|
+
|
|
33
|
+
export const ResponseByUUIDSchema = z.object({
|
|
34
|
+
data: ChatSchema,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export type ResponseByUUID = z.infer<typeof ResponseByUUIDSchema>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AiModelSchema, ChatSchema, MessageSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace GetLastActiveChatV2Command {
|
|
5
|
+
export const RequestQuerySchema = z.intersection(
|
|
6
|
+
ChatSchema.pick({
|
|
7
|
+
categoryId: true,
|
|
8
|
+
aIModelId: true,
|
|
9
|
+
}).partial(),
|
|
10
|
+
AiModelSchema.pick({ contentType: true }).partial(),
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const Response = z.object({
|
|
14
|
+
data: ChatSchema.extend({
|
|
15
|
+
messages: z.array(MessageSchema),
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type Response = z.infer<typeof Response>;
|
|
20
|
+
}
|
package/commands/chat/index.ts
CHANGED
|
@@ -4,3 +4,9 @@ export * from './create-chat.command';
|
|
|
4
4
|
export * from './find-chat.command';
|
|
5
5
|
export * from './get-my-last-active-chat.command';
|
|
6
6
|
export * from './check-limit.command';
|
|
7
|
+
export * from './check-limit.command.v2';
|
|
8
|
+
export * from './get-my-last-active-chat-command.v2';
|
|
9
|
+
export * from './create-chat.command.v2';
|
|
10
|
+
export * from './find-chat-by-uuid.command';
|
|
11
|
+
export * from './archive-all.command';
|
|
12
|
+
export * from './delete-chat.command.v2';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ChatSchema, MessageSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { DALLE_IMAGE_SIZE } from '../../constants';
|
|
4
|
+
|
|
5
|
+
export namespace CreateImageMessageCommand {
|
|
6
|
+
export const RequestSchema = z.intersection(
|
|
7
|
+
MessageSchema.pick({ text: true }),
|
|
8
|
+
z.object({
|
|
9
|
+
size: z.nativeEnum(DALLE_IMAGE_SIZE),
|
|
10
|
+
}),
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const RequestParamSchema = ChatSchema.pick({
|
|
14
|
+
uuid: true,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
18
|
+
|
|
19
|
+
export const ResponseSchema = z.object({
|
|
20
|
+
data: MessageSchema,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ChatSchema, MessageSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace CreateTextMessageCommand {
|
|
5
|
+
export const RequestSchema = MessageSchema.pick({
|
|
6
|
+
text: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const RequestParamSchema = ChatSchema.pick({
|
|
10
|
+
uuid: true,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
14
|
+
|
|
15
|
+
export const ResponseSchema = z.object({
|
|
16
|
+
data: MessageSchema,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { MessageSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace RateMessageCommand {
|
|
5
|
+
export const RequestSchema = MessageSchema.pick({
|
|
6
|
+
userReaction: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const RequestParamSchema = MessageSchema.pick({
|
|
10
|
+
uuid: true,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
14
|
+
|
|
15
|
+
export const ResponseSchema = z.object({
|
|
16
|
+
data: MessageSchema,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -11,13 +11,13 @@ export namespace PayCommand {
|
|
|
11
11
|
DateTime: z.string(),
|
|
12
12
|
CardFirstSix: z.string(),
|
|
13
13
|
CardLastFour: z.string(),
|
|
14
|
-
SubscriptionId: z.string(),
|
|
14
|
+
SubscriptionId: z.string().optional(),
|
|
15
15
|
CardType: z.string(),
|
|
16
16
|
CardExpDate: z.string(),
|
|
17
17
|
TestMode: z.string().transform((testMode) => parseInt(testMode, 10)),
|
|
18
18
|
Status: z.string(),
|
|
19
19
|
OperationType: z.string(),
|
|
20
|
-
InvoiceId: z.string(),
|
|
20
|
+
InvoiceId: z.string().optional(),
|
|
21
21
|
AccountId: z.string(),
|
|
22
22
|
})
|
|
23
23
|
.transform((data) => ({
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace RecoverSubscriptionCommand {
|
|
4
|
+
export const RequestParamSchema = z.object({
|
|
5
|
+
uuidSiteUserToSubscription: z.string(),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
isSuccess: z.boolean(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ai-model-content-type.enum';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
|
@@ -243,6 +243,11 @@ export const ERRORS = {
|
|
|
243
243
|
message: 'Заказ с таким uuid не найден',
|
|
244
244
|
httpCode: 404,
|
|
245
245
|
},
|
|
246
|
+
ORDER_NOT_FOUND: {
|
|
247
|
+
code: 'A152',
|
|
248
|
+
message: 'Заказ не найден',
|
|
249
|
+
httpCode: 404,
|
|
250
|
+
},
|
|
246
251
|
ORDER_DELETE_ERROR: { code: 'A057', message: 'Заказ не был удален', httpCode: 500 },
|
|
247
252
|
ORDER_CREATE_ERROR: { code: 'A058', message: 'Заказ не был создан', httpCode: 500 },
|
|
248
253
|
ORDER_FIND_ERROR: { code: 'A059', message: 'Заказ не найден', httpCode: 404 },
|
|
@@ -414,14 +419,64 @@ export const ERRORS = {
|
|
|
414
419
|
message: 'Не удалось получить количество сообщений',
|
|
415
420
|
httpCode: 500,
|
|
416
421
|
},
|
|
422
|
+
VALIDATE_EMAIL_ERROR: {
|
|
423
|
+
code: 'A098',
|
|
424
|
+
message: 'Не удалось валидировать почту',
|
|
425
|
+
httpCode: 500,
|
|
426
|
+
},
|
|
427
|
+
RECOVER_SUBSCRIPTION: {
|
|
428
|
+
code: 'A099',
|
|
429
|
+
message: 'Не удалось востановить подписку',
|
|
430
|
+
httpCode: 500,
|
|
431
|
+
},
|
|
432
|
+
CANCEL_SUBSCRIPTION: {
|
|
433
|
+
code: 'A100',
|
|
434
|
+
message: 'Не удалось закрыть подписку',
|
|
435
|
+
httpCode: 500,
|
|
436
|
+
},
|
|
437
|
+
SEND_EMAIL: {
|
|
438
|
+
code: 'A101',
|
|
439
|
+
message: 'Не удалось отправить email',
|
|
440
|
+
httpCode: 500,
|
|
441
|
+
},
|
|
417
442
|
VERIFY_EMAIL: {
|
|
418
|
-
code: '
|
|
443
|
+
code: 'A102',
|
|
419
444
|
message: 'Не удалось подтвердить почту',
|
|
420
445
|
httpCode: 500,
|
|
421
446
|
},
|
|
422
|
-
|
|
423
|
-
code: '
|
|
424
|
-
message: 'Не удалось
|
|
447
|
+
CHAT_CHECK_LIMIT: {
|
|
448
|
+
code: 'A103',
|
|
449
|
+
message: 'Не удалось проверить баланс для доступа к чату',
|
|
425
450
|
httpCode: 500,
|
|
426
451
|
},
|
|
452
|
+
CHAT_OWNERSHIP_ERROR: {
|
|
453
|
+
code: 'A104',
|
|
454
|
+
message: 'Вы не являетесь владельцем чата',
|
|
455
|
+
httpCode: 403,
|
|
456
|
+
},
|
|
457
|
+
CHAT_INCORRECT_CONTENT_TYPE: {
|
|
458
|
+
code: 'A105',
|
|
459
|
+
message: 'Чат не поддерживает данный тип контента',
|
|
460
|
+
httpCode: 400,
|
|
461
|
+
},
|
|
462
|
+
MESSAGE_REACTION_ERROR: {
|
|
463
|
+
code: 'A106',
|
|
464
|
+
message: 'Произошла ошибка при оценке сообщения',
|
|
465
|
+
httpCode: 500,
|
|
466
|
+
},
|
|
467
|
+
MESSAGE_NOT_FOUND: {
|
|
468
|
+
code: 'A107',
|
|
469
|
+
message: 'Сообщение не найдено',
|
|
470
|
+
httpCode: 404,
|
|
471
|
+
},
|
|
472
|
+
MESSAGE_INVALID_TYPE: {
|
|
473
|
+
code: 'A108',
|
|
474
|
+
message: 'Неверный тип сообщения',
|
|
475
|
+
httpCode: 400,
|
|
476
|
+
},
|
|
477
|
+
INSUFFICIENT_BALANCE: {
|
|
478
|
+
code: 'A109',
|
|
479
|
+
message: 'Недосточный баланс',
|
|
480
|
+
httpCode: 403,
|
|
481
|
+
},
|
|
427
482
|
};
|
package/constants/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './user-reaction.enum';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { AI_MODEL_CONTENT_TYPE, TAIModelContentTypeEnum } from '../constants';
|
|
2
3
|
|
|
3
4
|
export const AiModelSchema = z.object({
|
|
4
5
|
uuid: z.string().uuid(),
|
|
@@ -9,7 +10,7 @@ export const AiModelSchema = z.object({
|
|
|
9
10
|
tokenMultiplicator: z.number(),
|
|
10
11
|
order: z.number(),
|
|
11
12
|
canUse: z.optional(z.boolean()),
|
|
12
|
-
|
|
13
|
+
contentType: z.enum(Object.values(AI_MODEL_CONTENT_TYPE) as [TAIModelContentTypeEnum]),
|
|
13
14
|
createdAt: z.date(),
|
|
14
15
|
updatedAt: z.date(),
|
|
15
16
|
});
|
package/models/message.schema.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { TUserReactionEnum, USER_REACTION } from '../constants';
|
|
2
3
|
|
|
3
4
|
export const MessageSchema = z.object({
|
|
4
5
|
uuid: z.string().uuid(),
|
|
@@ -6,6 +7,7 @@ export const MessageSchema = z.object({
|
|
|
6
7
|
chatId: z.nullable(z.string().uuid()),
|
|
7
8
|
role: z.string(),
|
|
8
9
|
tokenUsage: z.number(),
|
|
10
|
+
userReaction: z.nullable(z.enum(Object.values(USER_REACTION) as [TUserReactionEnum])),
|
|
9
11
|
|
|
10
12
|
createdAt: z.date(),
|
|
11
13
|
updatedAt: z.date(),
|