@purpleschool/gptbot-tools 0.0.87 → 0.0.89
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/ai-vendor/index.ts +1 -0
- package/ai-vendor/models/ai-vendor.schema.ts +13 -0
- package/ai-vendor/models/index.ts +1 -0
- package/build/ai-vendor/index.js +17 -0
- package/build/ai-vendor/models/ai-vendor.schema.js +13 -0
- package/build/ai-vendor/models/index.js +17 -0
- package/build/common/errors/errors.js +105 -0
- package/build/image-editor/enums/image-editor-model-type.enum.js +1 -0
- package/build/image-editor/enums/image-editor-strategy.enum.js +1 -0
- package/build/image-generation/commands/execute-image-generation.command.js +19 -0
- package/build/image-generation/commands/index.js +22 -0
- package/build/image-generation/commands/save-image-generation-job.command.js +17 -0
- package/build/image-generation/commands/set-reaction-to-image-generation-job.command.js +17 -0
- package/build/image-generation/commands/soft-delete-image-generation-job-by-uuid.command.js +14 -0
- package/build/image-generation/commands/soft-delete-image-generation-jobs-by-criteria.command.js +13 -0
- package/build/image-generation/commands/update-image-generation-job-title.command.js +16 -0
- package/build/image-generation/enums/image-generation-model-strategy.enum.js +20 -0
- package/build/image-generation/enums/index.js +17 -0
- package/build/image-generation/index.js +21 -0
- package/build/image-generation/models/image-generation-job.schema.js +26 -0
- package/build/image-generation/models/image-generation-model.schema.js +26 -0
- package/build/image-generation/models/image-generation-preset.schema.js +13 -0
- package/build/image-generation/models/index.js +19 -0
- package/build/image-generation/queries/find-image-generation-job-by-id.query.js +19 -0
- package/build/image-generation/queries/find-image-generation-jobs.query.js +28 -0
- package/build/image-generation/queries/get-image-generation-config.query.js +19 -0
- package/build/image-generation/queries/index.js +19 -0
- package/build/image-generation/routes/image-generation.amqp.routes.js +13 -0
- package/build/image-generation/routes/image-generation.http.routes.js +7 -0
- package/build/image-generation/routes/index.js +18 -0
- package/build/index.js +6 -0
- package/build/tools/enums/tool-type.enum.js +1 -0
- package/common/errors/errors.ts +105 -0
- package/image-editor/enums/image-editor-model-type.enum.ts +1 -0
- package/image-editor/enums/image-editor-strategy.enum.ts +1 -0
- package/image-generation/commands/execute-image-generation.command.ts +19 -0
- package/image-generation/commands/index.ts +6 -0
- package/image-generation/commands/save-image-generation-job.command.ts +17 -0
- package/image-generation/commands/set-reaction-to-image-generation-job.command.ts +17 -0
- package/image-generation/commands/soft-delete-image-generation-job-by-uuid.command.ts +14 -0
- package/image-generation/commands/soft-delete-image-generation-jobs-by-criteria.command.ts +13 -0
- package/image-generation/commands/update-image-generation-job-title.command.ts +16 -0
- package/image-generation/enums/image-generation-model-strategy.enum.ts +20 -0
- package/image-generation/enums/index.ts +1 -0
- package/image-generation/index.ts +5 -0
- package/image-generation/models/image-generation-job.schema.ts +26 -0
- package/image-generation/models/image-generation-model.schema.ts +28 -0
- package/image-generation/models/image-generation-preset.schema.ts +13 -0
- package/image-generation/models/index.ts +3 -0
- package/image-generation/queries/find-image-generation-job-by-id.query.ts +19 -0
- package/image-generation/queries/find-image-generation-jobs.query.ts +33 -0
- package/image-generation/queries/get-image-generation-config.query.ts +21 -0
- package/image-generation/queries/index.ts +3 -0
- package/image-generation/routes/image-generation.amqp.routes.ts +10 -0
- package/image-generation/routes/image-generation.http.routes.ts +5 -0
- package/image-generation/routes/index.ts +2 -0
- package/index.ts +6 -0
- package/package.json +1 -1
- package/tools/enums/tool-type.enum.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './models';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { IconVariantsSchema } from '../../common';
|
|
3
|
+
|
|
4
|
+
export const AiVendorSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
title: z.string(),
|
|
7
|
+
iconVariants: IconVariantsSchema,
|
|
8
|
+
order: z.number(),
|
|
9
|
+
createdAt: z.date(),
|
|
10
|
+
updatedAt: z.date(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type AiVendor = z.infer<typeof AiVendorSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ai-vendor.schema';
|
|
@@ -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("./models"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AiVendorSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_1 = require("../../common");
|
|
6
|
+
exports.AiVendorSchema = zod_1.z.object({
|
|
7
|
+
uuid: zod_1.z.string().uuid(),
|
|
8
|
+
title: zod_1.z.string(),
|
|
9
|
+
iconVariants: common_1.IconVariantsSchema,
|
|
10
|
+
order: zod_1.z.number(),
|
|
11
|
+
createdAt: zod_1.z.date(),
|
|
12
|
+
updatedAt: zod_1.z.date(),
|
|
13
|
+
});
|
|
@@ -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-vendor.schema"), exports);
|
|
@@ -1207,6 +1207,111 @@ exports.ERRORS = {
|
|
|
1207
1207
|
httpCode: 500,
|
|
1208
1208
|
},
|
|
1209
1209
|
},
|
|
1210
|
+
IMAGE_GENERATION: {
|
|
1211
|
+
AI_ERROR: {
|
|
1212
|
+
code: 'IMAGE_GENERATION.AI_ERROR',
|
|
1213
|
+
message: 'Произошла ошибка во время запроса к ИИ',
|
|
1214
|
+
httpCode: 500,
|
|
1215
|
+
},
|
|
1216
|
+
INSUFFICIENT_BALANCE: {
|
|
1217
|
+
code: 'IMAGE_GENERATION.INSUFFICIENT_BALANCE',
|
|
1218
|
+
message: 'У пользователя недостаточно средств',
|
|
1219
|
+
httpCode: 400,
|
|
1220
|
+
},
|
|
1221
|
+
INVALID_PARAMS: {
|
|
1222
|
+
code: 'IMAGE_GENERATION.INVALID_PARAMS',
|
|
1223
|
+
message: 'Некорректные параметры изображения',
|
|
1224
|
+
httpCode: 400,
|
|
1225
|
+
},
|
|
1226
|
+
DELETE_ERROR: {
|
|
1227
|
+
code: 'IMAGE_GENERATION.DELETE_ERROR',
|
|
1228
|
+
message: 'Произошла ошибка при удалении генерации изображения',
|
|
1229
|
+
httpCode: 500,
|
|
1230
|
+
},
|
|
1231
|
+
MAX_PROMPT_LENGTH_EXCEEDED: {
|
|
1232
|
+
code: 'IMAGE_GENERATION.MAX_PROMPT_LENGTH_EXCEEDED',
|
|
1233
|
+
message: 'Превышена максимальная длина запроса',
|
|
1234
|
+
httpCode: 400,
|
|
1235
|
+
},
|
|
1236
|
+
POLL_TIMEOUT: {
|
|
1237
|
+
code: 'IMAGE_GENERATION.POLL_TIMEOUT',
|
|
1238
|
+
message: 'Превышено время ожидания генерации изображения',
|
|
1239
|
+
httpCode: 500,
|
|
1240
|
+
},
|
|
1241
|
+
},
|
|
1242
|
+
IMAGE_GENERATION_MODEL: {
|
|
1243
|
+
SAVE_ERROR: {
|
|
1244
|
+
code: 'IMAGE_GENERATION_MODEL.SAVE_ERROR',
|
|
1245
|
+
message: 'Произошла ошибка при сохранении модели для генерации изображений',
|
|
1246
|
+
httpCode: 500,
|
|
1247
|
+
},
|
|
1248
|
+
FIND_ERROR: {
|
|
1249
|
+
code: 'IMAGE_GENERATION_MODEL.FIND_ERROR',
|
|
1250
|
+
message: 'Произошла ошибка при поиске модели для генерации изображений',
|
|
1251
|
+
httpCode: 500,
|
|
1252
|
+
},
|
|
1253
|
+
NOT_FOUND: {
|
|
1254
|
+
code: 'IMAGE_GENERATION_MODEL.NOT_FOUND',
|
|
1255
|
+
message: 'Модель для генерации изображений не найдена',
|
|
1256
|
+
httpCode: 404,
|
|
1257
|
+
},
|
|
1258
|
+
MODEL_INACTIVE: {
|
|
1259
|
+
code: 'IMAGE_GENERATION_MODEL.MODEL_INACTIVE',
|
|
1260
|
+
message: 'Модель для генерации изображений неактивна',
|
|
1261
|
+
httpCode: 400,
|
|
1262
|
+
},
|
|
1263
|
+
},
|
|
1264
|
+
IMAGE_GENERATION_JOB: {
|
|
1265
|
+
SAVE_ERROR: {
|
|
1266
|
+
code: 'IMAGE_GENERATION_JOB.SAVE_ERROR',
|
|
1267
|
+
message: 'Произошла ошибка при сохранении задания на генерацию изображения',
|
|
1268
|
+
httpCode: 500,
|
|
1269
|
+
},
|
|
1270
|
+
FIND_ERROR: {
|
|
1271
|
+
code: 'IMAGE_GENERATION_JOB.FIND_ERROR',
|
|
1272
|
+
message: 'Произошла ошибка при поиске задания на генерацию изображения',
|
|
1273
|
+
httpCode: 500,
|
|
1274
|
+
},
|
|
1275
|
+
NOT_FOUND: {
|
|
1276
|
+
code: 'IMAGE_GENERATION_JOB.NOT_FOUND',
|
|
1277
|
+
message: 'Задание на генерацию изображения не найдено',
|
|
1278
|
+
httpCode: 404,
|
|
1279
|
+
},
|
|
1280
|
+
NOT_AN_OWNER: {
|
|
1281
|
+
code: 'IMAGE_GENERATION_JOB.NOT_AN_OWNER',
|
|
1282
|
+
message: 'Пользователь не является владельцем задания на генерацию изображения',
|
|
1283
|
+
httpCode: 403,
|
|
1284
|
+
},
|
|
1285
|
+
DELETE_ERROR: {
|
|
1286
|
+
code: 'IMAGE_GENERATION_JOB.DELETE_ERROR',
|
|
1287
|
+
message: 'Произошла ошибка при удалении задания на генерацию изображения',
|
|
1288
|
+
httpCode: 500,
|
|
1289
|
+
},
|
|
1290
|
+
},
|
|
1291
|
+
IMAGE_GENERATION_PRESET: {
|
|
1292
|
+
FIND_ERROR: {
|
|
1293
|
+
code: 'IMAGE_GENERATION_PRESET.FIND_ERROR',
|
|
1294
|
+
message: 'Произошла ошибка при поиске пресета генерации изображения',
|
|
1295
|
+
httpCode: 500,
|
|
1296
|
+
},
|
|
1297
|
+
NOT_FOUND: {
|
|
1298
|
+
code: 'IMAGE_GENERATION_PRESET.NOT_FOUND',
|
|
1299
|
+
message: 'Пресет генерации изображения не найден',
|
|
1300
|
+
httpCode: 404,
|
|
1301
|
+
},
|
|
1302
|
+
},
|
|
1303
|
+
AI_VENDOR: {
|
|
1304
|
+
FIND_ERROR: {
|
|
1305
|
+
code: 'AI_VENDOR.FIND_ERROR',
|
|
1306
|
+
message: 'Произошла ошибка при поиске поставщика ИИ',
|
|
1307
|
+
httpCode: 500,
|
|
1308
|
+
},
|
|
1309
|
+
NOT_FOUND: {
|
|
1310
|
+
code: 'AI_VENDOR.NOT_FOUND',
|
|
1311
|
+
message: 'Поставщик ИИ не найден',
|
|
1312
|
+
httpCode: 404,
|
|
1313
|
+
},
|
|
1314
|
+
},
|
|
1210
1315
|
CONTENT_POLICY: {
|
|
1211
1316
|
PHOTOREALISTIC_PEOPLE: {
|
|
1212
1317
|
code: 'CONTENT_POLICY.PHOTOREALISTIC_PEOPLE',
|
|
@@ -5,4 +5,5 @@ var IMAGE_EDITOR_MODEL_TYPE;
|
|
|
5
5
|
(function (IMAGE_EDITOR_MODEL_TYPE) {
|
|
6
6
|
IMAGE_EDITOR_MODEL_TYPE["NANO_BANANA_EDIT"] = "NANO_BANANA_EDIT";
|
|
7
7
|
IMAGE_EDITOR_MODEL_TYPE["RECRAFT_REMOVE_BACKGROUND"] = "RECRAFT_REMOVE_BACKGROUND";
|
|
8
|
+
IMAGE_EDITOR_MODEL_TYPE["NANO_BANANA_PRO_EDIT"] = "NANO_BANANA_PRO_EDIT";
|
|
8
9
|
})(IMAGE_EDITOR_MODEL_TYPE || (exports.IMAGE_EDITOR_MODEL_TYPE = IMAGE_EDITOR_MODEL_TYPE = {}));
|
|
@@ -6,4 +6,5 @@ var IMAGE_EDITING_STRATEGY;
|
|
|
6
6
|
IMAGE_EDITING_STRATEGY["NANO_BANANA_POLLING"] = "NANO_BANANA_POLLING";
|
|
7
7
|
IMAGE_EDITING_STRATEGY["NANO_BANANA_CALLBACK"] = "NANO_BANANA_CALLBACK";
|
|
8
8
|
IMAGE_EDITING_STRATEGY["RECRAFT_REMOVE_BACKGROUND_CALLBACK"] = "RECRAFT_REMOVE_BACKGROUND_CALLBACK";
|
|
9
|
+
IMAGE_EDITING_STRATEGY["NANO_BANANA_PRO_CALLBACK"] = "NANO_BANANA_PRO_CALLBACK";
|
|
9
10
|
})(IMAGE_EDITING_STRATEGY || (exports.IMAGE_EDITING_STRATEGY = IMAGE_EDITING_STRATEGY = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExecuteImageGenerationCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
|
+
const models_1 = require("../models");
|
|
7
|
+
var ExecuteImageGenerationCommand;
|
|
8
|
+
(function (ExecuteImageGenerationCommand) {
|
|
9
|
+
ExecuteImageGenerationCommand.RequestSchema = zod_1.z.object({
|
|
10
|
+
userId: zod_1.z.string().uuid().nullable().optional(),
|
|
11
|
+
unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
|
|
12
|
+
prompt: zod_1.z.string(),
|
|
13
|
+
userBalance: zod_1.z.number(),
|
|
14
|
+
modelId: zod_1.z.string().uuid(),
|
|
15
|
+
params: models_1.ImageGenerationRequestParamsSchema,
|
|
16
|
+
presetId: zod_1.z.string().uuid().nullable().optional(),
|
|
17
|
+
});
|
|
18
|
+
ExecuteImageGenerationCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.ImageGenerationJobSchema);
|
|
19
|
+
})(ExecuteImageGenerationCommand || (exports.ExecuteImageGenerationCommand = ExecuteImageGenerationCommand = {}));
|
|
@@ -0,0 +1,22 @@
|
|
|
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("./execute-image-generation.command"), exports);
|
|
18
|
+
__exportStar(require("./save-image-generation-job.command"), exports);
|
|
19
|
+
__exportStar(require("./soft-delete-image-generation-job-by-uuid.command"), exports);
|
|
20
|
+
__exportStar(require("./soft-delete-image-generation-jobs-by-criteria.command"), exports);
|
|
21
|
+
__exportStar(require("./set-reaction-to-image-generation-job.command"), exports);
|
|
22
|
+
__exportStar(require("./update-image-generation-job-title.command"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SaveImageGenerationJobCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
|
+
const models_1 = require("../models");
|
|
7
|
+
var SaveImageGenerationJobCommand;
|
|
8
|
+
(function (SaveImageGenerationJobCommand) {
|
|
9
|
+
SaveImageGenerationJobCommand.RequestSchema = zod_1.z.object({
|
|
10
|
+
userId: zod_1.z.string().uuid().nullable().optional(),
|
|
11
|
+
unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
|
|
12
|
+
prompt: zod_1.z.string(),
|
|
13
|
+
modelId: zod_1.z.string().uuid(),
|
|
14
|
+
userBalance: zod_1.z.number(),
|
|
15
|
+
});
|
|
16
|
+
SaveImageGenerationJobCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.ImageGenerationJobSchema);
|
|
17
|
+
})(SaveImageGenerationJobCommand || (exports.SaveImageGenerationJobCommand = SaveImageGenerationJobCommand = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SetReactionToImageGenerationJobCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_1 = require("../../common");
|
|
6
|
+
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
7
|
+
const models_1 = require("../models");
|
|
8
|
+
var SetReactionToImageGenerationJobCommand;
|
|
9
|
+
(function (SetReactionToImageGenerationJobCommand) {
|
|
10
|
+
SetReactionToImageGenerationJobCommand.RequestSchema = zod_1.z.object({
|
|
11
|
+
userId: zod_1.z.string().uuid().nullable().optional(),
|
|
12
|
+
unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
|
|
13
|
+
uuid: zod_1.z.string(),
|
|
14
|
+
reaction: zod_1.z.nativeEnum(common_1.USER_REACTION).nullable(),
|
|
15
|
+
});
|
|
16
|
+
SetReactionToImageGenerationJobCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.ImageGenerationJobSchema);
|
|
17
|
+
})(SetReactionToImageGenerationJobCommand || (exports.SetReactionToImageGenerationJobCommand = SetReactionToImageGenerationJobCommand = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SoftDeleteImageGenerationJobByUuidCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
|
+
var SoftDeleteImageGenerationJobByUuidCommand;
|
|
7
|
+
(function (SoftDeleteImageGenerationJobByUuidCommand) {
|
|
8
|
+
SoftDeleteImageGenerationJobByUuidCommand.RequestSchema = zod_1.z.object({
|
|
9
|
+
userId: zod_1.z.string().uuid().nullable().optional(),
|
|
10
|
+
unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
|
|
11
|
+
uuid: zod_1.z.string(),
|
|
12
|
+
});
|
|
13
|
+
SoftDeleteImageGenerationJobByUuidCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(zod_1.z.boolean());
|
|
14
|
+
})(SoftDeleteImageGenerationJobByUuidCommand || (exports.SoftDeleteImageGenerationJobByUuidCommand = SoftDeleteImageGenerationJobByUuidCommand = {}));
|
package/build/image-generation/commands/soft-delete-image-generation-jobs-by-criteria.command.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SoftDeleteImageGenerationJobsByCriteriaCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
|
+
var SoftDeleteImageGenerationJobsByCriteriaCommand;
|
|
7
|
+
(function (SoftDeleteImageGenerationJobsByCriteriaCommand) {
|
|
8
|
+
SoftDeleteImageGenerationJobsByCriteriaCommand.RequestSchema = zod_1.z.object({
|
|
9
|
+
userId: zod_1.z.string().uuid().nullable().optional(),
|
|
10
|
+
unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
|
|
11
|
+
});
|
|
12
|
+
SoftDeleteImageGenerationJobsByCriteriaCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(zod_1.z.boolean());
|
|
13
|
+
})(SoftDeleteImageGenerationJobsByCriteriaCommand || (exports.SoftDeleteImageGenerationJobsByCriteriaCommand = SoftDeleteImageGenerationJobsByCriteriaCommand = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateImageGenerationJobTitleCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
|
+
const models_1 = require("../models");
|
|
7
|
+
var UpdateImageGenerationJobTitleCommand;
|
|
8
|
+
(function (UpdateImageGenerationJobTitleCommand) {
|
|
9
|
+
UpdateImageGenerationJobTitleCommand.RequestSchema = zod_1.z.object({
|
|
10
|
+
userId: zod_1.z.string().uuid().nullable().optional(),
|
|
11
|
+
unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
|
|
12
|
+
uuid: zod_1.z.string(),
|
|
13
|
+
title: zod_1.z.string(),
|
|
14
|
+
});
|
|
15
|
+
UpdateImageGenerationJobTitleCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.ImageGenerationJobSchema);
|
|
16
|
+
})(UpdateImageGenerationJobTitleCommand || (exports.UpdateImageGenerationJobTitleCommand = UpdateImageGenerationJobTitleCommand = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IMAGE_GENERATION_MODEL_STRATEGY = void 0;
|
|
4
|
+
var IMAGE_GENERATION_MODEL_STRATEGY;
|
|
5
|
+
(function (IMAGE_GENERATION_MODEL_STRATEGY) {
|
|
6
|
+
// Together AI Models
|
|
7
|
+
IMAGE_GENERATION_MODEL_STRATEGY["FLUX_IMAGE_GENERATION"] = "FLUX_IMAGE_GENERATION";
|
|
8
|
+
IMAGE_GENERATION_MODEL_STRATEGY["FLUX_DEV_IMAGE_GENERATION"] = "FLUX_DEV_IMAGE_GENERATION";
|
|
9
|
+
IMAGE_GENERATION_MODEL_STRATEGY["STABLE_DIFFUSION_IMAGE_GENERATION"] = "STABLE_DIFFUSION_IMAGE_GENERATION";
|
|
10
|
+
// Grok AI
|
|
11
|
+
IMAGE_GENERATION_MODEL_STRATEGY["GROK_IMAGE_GENERATION"] = "GROK_IMAGE_GENERATION";
|
|
12
|
+
// OpenAI
|
|
13
|
+
IMAGE_GENERATION_MODEL_STRATEGY["DALLE_IMAGE_GENERATION"] = "DALLE_IMAGE_GENERATION";
|
|
14
|
+
IMAGE_GENERATION_MODEL_STRATEGY["OPENAI_IMAGE_1_GENERATION"] = "OPENAI_IMAGE_1_GENERATION";
|
|
15
|
+
// Google AI
|
|
16
|
+
IMAGE_GENERATION_MODEL_STRATEGY["GEMINI_IMAGE_GENERATION"] = "GEMINI_IMAGE_GENERATION";
|
|
17
|
+
IMAGE_GENERATION_MODEL_STRATEGY["IMAGEN_IMAGE_GENERATION"] = "IMAGEN_IMAGE_GENERATION";
|
|
18
|
+
// Midjourney
|
|
19
|
+
IMAGE_GENERATION_MODEL_STRATEGY["MIDJOURNEY_IMAGE_GENERATION"] = "MIDJOURNEY_IMAGE_GENERATION";
|
|
20
|
+
})(IMAGE_GENERATION_MODEL_STRATEGY || (exports.IMAGE_GENERATION_MODEL_STRATEGY = IMAGE_GENERATION_MODEL_STRATEGY = {}));
|
|
@@ -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("./image-generation-model-strategy.enum"), exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
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);
|
|
18
|
+
__exportStar(require("./models"), exports);
|
|
19
|
+
__exportStar(require("./commands"), exports);
|
|
20
|
+
__exportStar(require("./queries"), exports);
|
|
21
|
+
__exportStar(require("./routes"), exports);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImageGenerationJobSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const tools_1 = require("../../tools");
|
|
6
|
+
const common_1 = require("../../common");
|
|
7
|
+
exports.ImageGenerationJobSchema = zod_1.z.object({
|
|
8
|
+
uuid: zod_1.z.string(),
|
|
9
|
+
prompt: zod_1.z.string(),
|
|
10
|
+
title: zod_1.z.string(),
|
|
11
|
+
status: zod_1.z.nativeEnum(tools_1.JOB_STATUS),
|
|
12
|
+
error: zod_1.z.string().nullable(),
|
|
13
|
+
price: zod_1.z.number(),
|
|
14
|
+
reaction: zod_1.z.nativeEnum(common_1.USER_REACTION).nullable(),
|
|
15
|
+
externalId: zod_1.z.string().nullable(),
|
|
16
|
+
params: zod_1.z.any(),
|
|
17
|
+
output: zod_1.z.array(zod_1.z.string()),
|
|
18
|
+
modelId: zod_1.z.string(),
|
|
19
|
+
attempts: zod_1.z.array(zod_1.z.any()),
|
|
20
|
+
userId: zod_1.z.string().nullable().optional(),
|
|
21
|
+
unregisteredUserId: zod_1.z.string().nullable().optional(),
|
|
22
|
+
isDeleted: zod_1.z.boolean(),
|
|
23
|
+
internalError: zod_1.z.string().nullable(),
|
|
24
|
+
createdAt: zod_1.z.date(),
|
|
25
|
+
updatedAt: zod_1.z.date(),
|
|
26
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImageGenerationModelSchema = exports.ImageGenerationRequestParamsSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_1 = require("../../common");
|
|
6
|
+
const enums_1 = require("../enums");
|
|
7
|
+
exports.ImageGenerationRequestParamsSchema = zod_1.z.object({
|
|
8
|
+
aspectRatio: zod_1.z.string(),
|
|
9
|
+
attachedImages: zod_1.z.array(zod_1.z.string()),
|
|
10
|
+
enhancePrompt: zod_1.z.boolean(),
|
|
11
|
+
});
|
|
12
|
+
exports.ImageGenerationModelSchema = zod_1.z.object({
|
|
13
|
+
uuid: zod_1.z.string(),
|
|
14
|
+
title: zod_1.z.string(),
|
|
15
|
+
description: zod_1.z.string(),
|
|
16
|
+
aiModel: zod_1.z.string(),
|
|
17
|
+
price: zod_1.z.number(),
|
|
18
|
+
order: zod_1.z.number(),
|
|
19
|
+
params: zod_1.z.any(),
|
|
20
|
+
strategy: zod_1.z.nativeEnum(enums_1.IMAGE_GENERATION_MODEL_STRATEGY),
|
|
21
|
+
status: zod_1.z.nativeEnum(common_1.TOOL_MODEL_STATUS),
|
|
22
|
+
maxPromptLength: zod_1.z.number(),
|
|
23
|
+
iconVariants: common_1.IconVariantsSchema,
|
|
24
|
+
createdAt: zod_1.z.date(),
|
|
25
|
+
updatedAt: zod_1.z.date(),
|
|
26
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImageGenerationPresetSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.ImageGenerationPresetSchema = zod_1.z.object({
|
|
6
|
+
uuid: zod_1.z.string().uuid(),
|
|
7
|
+
title: zod_1.z.string(),
|
|
8
|
+
prompt: zod_1.z.string(),
|
|
9
|
+
sample: zod_1.z.string(),
|
|
10
|
+
order: zod_1.z.number(),
|
|
11
|
+
createdAt: zod_1.z.date(),
|
|
12
|
+
updatedAt: zod_1.z.date(),
|
|
13
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./image-generation-job.schema"), exports);
|
|
18
|
+
__exportStar(require("./image-generation-model.schema"), exports);
|
|
19
|
+
__exportStar(require("./image-generation-preset.schema"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindImageGenerationJobByIdQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
|
+
const models_1 = require("../models");
|
|
7
|
+
var FindImageGenerationJobByIdQuery;
|
|
8
|
+
(function (FindImageGenerationJobByIdQuery) {
|
|
9
|
+
FindImageGenerationJobByIdQuery.RequestSchema = zod_1.z
|
|
10
|
+
.object({
|
|
11
|
+
uuid: zod_1.z.string(),
|
|
12
|
+
userId: zod_1.z.string().uuid().nullable().optional(),
|
|
13
|
+
unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
|
|
14
|
+
})
|
|
15
|
+
.refine((data) => data.userId || data.unregisteredUserId, {
|
|
16
|
+
message: 'Either userId or unregisteredUserId must be provided',
|
|
17
|
+
});
|
|
18
|
+
FindImageGenerationJobByIdQuery.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.ImageGenerationJobSchema);
|
|
19
|
+
})(FindImageGenerationJobByIdQuery || (exports.FindImageGenerationJobByIdQuery = FindImageGenerationJobByIdQuery = {}));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindImageGenerationJobsQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
|
+
const models_1 = require("../models");
|
|
7
|
+
var FindImageGenerationJobsQuery;
|
|
8
|
+
(function (FindImageGenerationJobsQuery) {
|
|
9
|
+
FindImageGenerationJobsQuery.RequestSchema = zod_1.z
|
|
10
|
+
.object({
|
|
11
|
+
userId: zod_1.z.string().uuid().optional(),
|
|
12
|
+
unregisteredUserId: zod_1.z.string().uuid().optional(),
|
|
13
|
+
title: zod_1.z.string().optional(),
|
|
14
|
+
limit: zod_1.z.coerce.number().min(1).optional(),
|
|
15
|
+
offset: zod_1.z.coerce.number().min(0).default(0).optional(),
|
|
16
|
+
})
|
|
17
|
+
.refine((data) => {
|
|
18
|
+
return Boolean(data.userId) !== Boolean(data.unregisteredUserId);
|
|
19
|
+
}, {
|
|
20
|
+
message: 'At least userId or unregisteredUserId must be present',
|
|
21
|
+
path: ['userId', 'unregisteredUserId'],
|
|
22
|
+
});
|
|
23
|
+
FindImageGenerationJobsQuery.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(zod_1.z.object({
|
|
24
|
+
data: zod_1.z.array(models_1.ImageGenerationJobSchema),
|
|
25
|
+
page: zod_1.z.number(),
|
|
26
|
+
totalPages: zod_1.z.number(),
|
|
27
|
+
}));
|
|
28
|
+
})(FindImageGenerationJobsQuery || (exports.FindImageGenerationJobsQuery = FindImageGenerationJobsQuery = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetImageGenerationConfigQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
|
+
const models_1 = require("../models");
|
|
7
|
+
const ai_vendor_1 = require("../../ai-vendor");
|
|
8
|
+
const VendorWithModelsSchema = ai_vendor_1.AiVendorSchema.extend({
|
|
9
|
+
models: zod_1.z.array(models_1.ImageGenerationModelSchema),
|
|
10
|
+
});
|
|
11
|
+
const ImageGenerationConfigSchema = zod_1.z.object({
|
|
12
|
+
vendors: zod_1.z.array(VendorWithModelsSchema),
|
|
13
|
+
presets: zod_1.z.array(models_1.ImageGenerationPresetSchema),
|
|
14
|
+
});
|
|
15
|
+
var GetImageGenerationConfigQuery;
|
|
16
|
+
(function (GetImageGenerationConfigQuery) {
|
|
17
|
+
GetImageGenerationConfigQuery.RequestSchema = zod_1.z.object({});
|
|
18
|
+
GetImageGenerationConfigQuery.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(ImageGenerationConfigSchema);
|
|
19
|
+
})(GetImageGenerationConfigQuery || (exports.GetImageGenerationConfigQuery = GetImageGenerationConfigQuery = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./get-image-generation-config.query"), exports);
|
|
18
|
+
__exportStar(require("./find-image-generation-job-by-id.query"), exports);
|
|
19
|
+
__exportStar(require("./find-image-generation-jobs.query"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IMAGE_GENERATION_AMQP_ROUTES = void 0;
|
|
4
|
+
exports.IMAGE_GENERATION_AMQP_ROUTES = {
|
|
5
|
+
EXECUTE: 'tools.image-generation.execute.rpc',
|
|
6
|
+
CONFIG: 'tools.image-generation.config.rpc',
|
|
7
|
+
GET_JOB: 'tools.image-generation.jobs.get.rpc',
|
|
8
|
+
LIST_JOBS: 'tools.image-generation.jobs.list.rpc',
|
|
9
|
+
SET_REACTION: 'tools.image-generation.jobs.set-reaction.rpc',
|
|
10
|
+
UPDATE_TITLE: 'tools.image-generation.jobs.update-title.rpc',
|
|
11
|
+
SOFT_DELETE: 'tools.image-generation.jobs.soft-delete.rpc',
|
|
12
|
+
SOFT_DELETE_ALL: 'tools.image-generation.jobs.soft-delete-all.rpc',
|
|
13
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IMAGE_GENERATION_ROUTES = exports.IMAGE_GENERATION_CONTROLLER = void 0;
|
|
4
|
+
exports.IMAGE_GENERATION_CONTROLLER = 'image-generation';
|
|
5
|
+
exports.IMAGE_GENERATION_ROUTES = {
|
|
6
|
+
KIE_MIDJOURNEY_CALLBACK: 'kie/midjourney/callback/:jobId',
|
|
7
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./image-generation.amqp.routes"), exports);
|
|
18
|
+
__exportStar(require("./image-generation.http.routes"), exports);
|
package/build/index.js
CHANGED
|
@@ -46,8 +46,10 @@ __exportStar(require("./language"), exports);
|
|
|
46
46
|
__exportStar(require("./video"), exports);
|
|
47
47
|
__exportStar(require("./writer"), exports);
|
|
48
48
|
__exportStar(require("./image-editor"), exports);
|
|
49
|
+
__exportStar(require("./image-generation"), exports);
|
|
49
50
|
__exportStar(require("./video-editor"), exports);
|
|
50
51
|
__exportStar(require("./music"), exports);
|
|
52
|
+
__exportStar(require("./ai-vendor"), exports);
|
|
51
53
|
const common = __importStar(require("./common"));
|
|
52
54
|
const paraphrase = __importStar(require("./paraphrase"));
|
|
53
55
|
const tools = __importStar(require("./tools"));
|
|
@@ -58,8 +60,10 @@ const language = __importStar(require("./language"));
|
|
|
58
60
|
const video = __importStar(require("./video"));
|
|
59
61
|
const writer = __importStar(require("./writer"));
|
|
60
62
|
const imageEditor = __importStar(require("./image-editor"));
|
|
63
|
+
const imageGeneration = __importStar(require("./image-generation"));
|
|
61
64
|
const videoEditor = __importStar(require("./video-editor"));
|
|
62
65
|
const music = __importStar(require("./music"));
|
|
66
|
+
const aiVendor = __importStar(require("./ai-vendor"));
|
|
63
67
|
var ToolService;
|
|
64
68
|
(function (ToolService) {
|
|
65
69
|
ToolService.Common = common;
|
|
@@ -72,6 +76,8 @@ var ToolService;
|
|
|
72
76
|
ToolService.Video = video;
|
|
73
77
|
ToolService.Writer = writer;
|
|
74
78
|
ToolService.ImageEditor = imageEditor;
|
|
79
|
+
ToolService.ImageGeneration = imageGeneration;
|
|
75
80
|
ToolService.VideoEditor = videoEditor;
|
|
76
81
|
ToolService.Music = music;
|
|
82
|
+
ToolService.AiVendor = aiVendor;
|
|
77
83
|
})(ToolService || (exports.ToolService = ToolService = {}));
|
package/common/errors/errors.ts
CHANGED
|
@@ -1217,6 +1217,111 @@ export const ERRORS = {
|
|
|
1217
1217
|
httpCode: 500,
|
|
1218
1218
|
},
|
|
1219
1219
|
},
|
|
1220
|
+
IMAGE_GENERATION: {
|
|
1221
|
+
AI_ERROR: {
|
|
1222
|
+
code: 'IMAGE_GENERATION.AI_ERROR',
|
|
1223
|
+
message: 'Произошла ошибка во время запроса к ИИ',
|
|
1224
|
+
httpCode: 500,
|
|
1225
|
+
},
|
|
1226
|
+
INSUFFICIENT_BALANCE: {
|
|
1227
|
+
code: 'IMAGE_GENERATION.INSUFFICIENT_BALANCE',
|
|
1228
|
+
message: 'У пользователя недостаточно средств',
|
|
1229
|
+
httpCode: 400,
|
|
1230
|
+
},
|
|
1231
|
+
INVALID_PARAMS: {
|
|
1232
|
+
code: 'IMAGE_GENERATION.INVALID_PARAMS',
|
|
1233
|
+
message: 'Некорректные параметры изображения',
|
|
1234
|
+
httpCode: 400,
|
|
1235
|
+
},
|
|
1236
|
+
DELETE_ERROR: {
|
|
1237
|
+
code: 'IMAGE_GENERATION.DELETE_ERROR',
|
|
1238
|
+
message: 'Произошла ошибка при удалении генерации изображения',
|
|
1239
|
+
httpCode: 500,
|
|
1240
|
+
},
|
|
1241
|
+
MAX_PROMPT_LENGTH_EXCEEDED: {
|
|
1242
|
+
code: 'IMAGE_GENERATION.MAX_PROMPT_LENGTH_EXCEEDED',
|
|
1243
|
+
message: 'Превышена максимальная длина запроса',
|
|
1244
|
+
httpCode: 400,
|
|
1245
|
+
},
|
|
1246
|
+
POLL_TIMEOUT: {
|
|
1247
|
+
code: 'IMAGE_GENERATION.POLL_TIMEOUT',
|
|
1248
|
+
message: 'Превышено время ожидания генерации изображения',
|
|
1249
|
+
httpCode: 500,
|
|
1250
|
+
},
|
|
1251
|
+
},
|
|
1252
|
+
IMAGE_GENERATION_MODEL: {
|
|
1253
|
+
SAVE_ERROR: {
|
|
1254
|
+
code: 'IMAGE_GENERATION_MODEL.SAVE_ERROR',
|
|
1255
|
+
message: 'Произошла ошибка при сохранении модели для генерации изображений',
|
|
1256
|
+
httpCode: 500,
|
|
1257
|
+
},
|
|
1258
|
+
FIND_ERROR: {
|
|
1259
|
+
code: 'IMAGE_GENERATION_MODEL.FIND_ERROR',
|
|
1260
|
+
message: 'Произошла ошибка при поиске модели для генерации изображений',
|
|
1261
|
+
httpCode: 500,
|
|
1262
|
+
},
|
|
1263
|
+
NOT_FOUND: {
|
|
1264
|
+
code: 'IMAGE_GENERATION_MODEL.NOT_FOUND',
|
|
1265
|
+
message: 'Модель для генерации изображений не найдена',
|
|
1266
|
+
httpCode: 404,
|
|
1267
|
+
},
|
|
1268
|
+
MODEL_INACTIVE: {
|
|
1269
|
+
code: 'IMAGE_GENERATION_MODEL.MODEL_INACTIVE',
|
|
1270
|
+
message: 'Модель для генерации изображений неактивна',
|
|
1271
|
+
httpCode: 400,
|
|
1272
|
+
},
|
|
1273
|
+
},
|
|
1274
|
+
IMAGE_GENERATION_JOB: {
|
|
1275
|
+
SAVE_ERROR: {
|
|
1276
|
+
code: 'IMAGE_GENERATION_JOB.SAVE_ERROR',
|
|
1277
|
+
message: 'Произошла ошибка при сохранении задания на генерацию изображения',
|
|
1278
|
+
httpCode: 500,
|
|
1279
|
+
},
|
|
1280
|
+
FIND_ERROR: {
|
|
1281
|
+
code: 'IMAGE_GENERATION_JOB.FIND_ERROR',
|
|
1282
|
+
message: 'Произошла ошибка при поиске задания на генерацию изображения',
|
|
1283
|
+
httpCode: 500,
|
|
1284
|
+
},
|
|
1285
|
+
NOT_FOUND: {
|
|
1286
|
+
code: 'IMAGE_GENERATION_JOB.NOT_FOUND',
|
|
1287
|
+
message: 'Задание на генерацию изображения не найдено',
|
|
1288
|
+
httpCode: 404,
|
|
1289
|
+
},
|
|
1290
|
+
NOT_AN_OWNER: {
|
|
1291
|
+
code: 'IMAGE_GENERATION_JOB.NOT_AN_OWNER',
|
|
1292
|
+
message: 'Пользователь не является владельцем задания на генерацию изображения',
|
|
1293
|
+
httpCode: 403,
|
|
1294
|
+
},
|
|
1295
|
+
DELETE_ERROR: {
|
|
1296
|
+
code: 'IMAGE_GENERATION_JOB.DELETE_ERROR',
|
|
1297
|
+
message: 'Произошла ошибка при удалении задания на генерацию изображения',
|
|
1298
|
+
httpCode: 500,
|
|
1299
|
+
},
|
|
1300
|
+
},
|
|
1301
|
+
IMAGE_GENERATION_PRESET: {
|
|
1302
|
+
FIND_ERROR: {
|
|
1303
|
+
code: 'IMAGE_GENERATION_PRESET.FIND_ERROR',
|
|
1304
|
+
message: 'Произошла ошибка при поиске пресета генерации изображения',
|
|
1305
|
+
httpCode: 500,
|
|
1306
|
+
},
|
|
1307
|
+
NOT_FOUND: {
|
|
1308
|
+
code: 'IMAGE_GENERATION_PRESET.NOT_FOUND',
|
|
1309
|
+
message: 'Пресет генерации изображения не найден',
|
|
1310
|
+
httpCode: 404,
|
|
1311
|
+
},
|
|
1312
|
+
},
|
|
1313
|
+
AI_VENDOR: {
|
|
1314
|
+
FIND_ERROR: {
|
|
1315
|
+
code: 'AI_VENDOR.FIND_ERROR',
|
|
1316
|
+
message: 'Произошла ошибка при поиске поставщика ИИ',
|
|
1317
|
+
httpCode: 500,
|
|
1318
|
+
},
|
|
1319
|
+
NOT_FOUND: {
|
|
1320
|
+
code: 'AI_VENDOR.NOT_FOUND',
|
|
1321
|
+
message: 'Поставщик ИИ не найден',
|
|
1322
|
+
httpCode: 404,
|
|
1323
|
+
},
|
|
1324
|
+
},
|
|
1220
1325
|
CONTENT_POLICY: {
|
|
1221
1326
|
PHOTOREALISTIC_PEOPLE: {
|
|
1222
1327
|
code: 'CONTENT_POLICY.PHOTOREALISTIC_PEOPLE',
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { ImageGenerationJobSchema, ImageGenerationRequestParamsSchema } from '../models';
|
|
4
|
+
|
|
5
|
+
export namespace ExecuteImageGenerationCommand {
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
userId: z.string().uuid().nullable().optional(),
|
|
8
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
9
|
+
prompt: z.string(),
|
|
10
|
+
userBalance: z.number(),
|
|
11
|
+
modelId: z.string().uuid(),
|
|
12
|
+
params: ImageGenerationRequestParamsSchema,
|
|
13
|
+
presetId: z.string().uuid().nullable().optional(),
|
|
14
|
+
});
|
|
15
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
16
|
+
|
|
17
|
+
export const ResponseSchema = ICommandResponseSchema(ImageGenerationJobSchema);
|
|
18
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './execute-image-generation.command';
|
|
2
|
+
export * from './save-image-generation-job.command';
|
|
3
|
+
export * from './soft-delete-image-generation-job-by-uuid.command';
|
|
4
|
+
export * from './soft-delete-image-generation-jobs-by-criteria.command';
|
|
5
|
+
export * from './set-reaction-to-image-generation-job.command';
|
|
6
|
+
export * from './update-image-generation-job-title.command';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { ImageGenerationJobSchema } from '../models';
|
|
4
|
+
|
|
5
|
+
export namespace SaveImageGenerationJobCommand {
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
userId: z.string().uuid().nullable().optional(),
|
|
8
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
9
|
+
prompt: z.string(),
|
|
10
|
+
modelId: z.string().uuid(),
|
|
11
|
+
userBalance: z.number(),
|
|
12
|
+
});
|
|
13
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
14
|
+
|
|
15
|
+
export const ResponseSchema = ICommandResponseSchema(ImageGenerationJobSchema);
|
|
16
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { USER_REACTION } from '../../common';
|
|
3
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
4
|
+
import { ImageGenerationJobSchema } from '../models';
|
|
5
|
+
|
|
6
|
+
export namespace SetReactionToImageGenerationJobCommand {
|
|
7
|
+
export const RequestSchema = z.object({
|
|
8
|
+
userId: z.string().uuid().nullable().optional(),
|
|
9
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
10
|
+
uuid: z.string(),
|
|
11
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
12
|
+
});
|
|
13
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
14
|
+
|
|
15
|
+
export const ResponseSchema = ICommandResponseSchema(ImageGenerationJobSchema);
|
|
16
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
|
|
4
|
+
export namespace SoftDeleteImageGenerationJobByUuidCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
userId: z.string().uuid().nullable().optional(),
|
|
7
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
8
|
+
uuid: z.string(),
|
|
9
|
+
});
|
|
10
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
11
|
+
|
|
12
|
+
export const ResponseSchema = ICommandResponseSchema(z.boolean());
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
|
|
4
|
+
export namespace SoftDeleteImageGenerationJobsByCriteriaCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
userId: z.string().uuid().nullable().optional(),
|
|
7
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
8
|
+
});
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = ICommandResponseSchema(z.boolean());
|
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { ImageGenerationJobSchema } from '../models';
|
|
4
|
+
|
|
5
|
+
export namespace UpdateImageGenerationJobTitleCommand {
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
userId: z.string().uuid().nullable().optional(),
|
|
8
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
9
|
+
uuid: z.string(),
|
|
10
|
+
title: z.string(),
|
|
11
|
+
});
|
|
12
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = ICommandResponseSchema(ImageGenerationJobSchema);
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export enum IMAGE_GENERATION_MODEL_STRATEGY {
|
|
2
|
+
// Together AI Models
|
|
3
|
+
FLUX_IMAGE_GENERATION = 'FLUX_IMAGE_GENERATION',
|
|
4
|
+
FLUX_DEV_IMAGE_GENERATION = 'FLUX_DEV_IMAGE_GENERATION',
|
|
5
|
+
STABLE_DIFFUSION_IMAGE_GENERATION = 'STABLE_DIFFUSION_IMAGE_GENERATION',
|
|
6
|
+
|
|
7
|
+
// Grok AI
|
|
8
|
+
GROK_IMAGE_GENERATION = 'GROK_IMAGE_GENERATION',
|
|
9
|
+
|
|
10
|
+
// OpenAI
|
|
11
|
+
DALLE_IMAGE_GENERATION = 'DALLE_IMAGE_GENERATION',
|
|
12
|
+
OPENAI_IMAGE_1_GENERATION = 'OPENAI_IMAGE_1_GENERATION',
|
|
13
|
+
|
|
14
|
+
// Google AI
|
|
15
|
+
GEMINI_IMAGE_GENERATION = 'GEMINI_IMAGE_GENERATION',
|
|
16
|
+
IMAGEN_IMAGE_GENERATION = 'IMAGEN_IMAGE_GENERATION',
|
|
17
|
+
|
|
18
|
+
// Midjourney
|
|
19
|
+
MIDJOURNEY_IMAGE_GENERATION = 'MIDJOURNEY_IMAGE_GENERATION',
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './image-generation-model-strategy.enum';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { JOB_STATUS } from '../../tools';
|
|
3
|
+
import { USER_REACTION } from '../../common';
|
|
4
|
+
|
|
5
|
+
export const ImageGenerationJobSchema = z.object({
|
|
6
|
+
uuid: z.string(),
|
|
7
|
+
prompt: z.string(),
|
|
8
|
+
title: z.string(),
|
|
9
|
+
status: z.nativeEnum(JOB_STATUS),
|
|
10
|
+
error: z.string().nullable(),
|
|
11
|
+
price: z.number(),
|
|
12
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
13
|
+
externalId: z.string().nullable(),
|
|
14
|
+
params: z.any(),
|
|
15
|
+
output: z.array(z.string()),
|
|
16
|
+
modelId: z.string(),
|
|
17
|
+
attempts: z.array(z.any()),
|
|
18
|
+
userId: z.string().nullable().optional(),
|
|
19
|
+
unregisteredUserId: z.string().nullable().optional(),
|
|
20
|
+
isDeleted: z.boolean(),
|
|
21
|
+
internalError: z.string().nullable(),
|
|
22
|
+
createdAt: z.date(),
|
|
23
|
+
updatedAt: z.date(),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export type ImageGenerationJob = z.infer<typeof ImageGenerationJobSchema>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { IconVariantsSchema, TOOL_MODEL_STATUS } from '../../common';
|
|
3
|
+
import { IMAGE_GENERATION_MODEL_STRATEGY } from '../enums';
|
|
4
|
+
|
|
5
|
+
export const ImageGenerationRequestParamsSchema = z.object({
|
|
6
|
+
aspectRatio: z.string(),
|
|
7
|
+
attachedImages: z.array(z.string()),
|
|
8
|
+
enhancePrompt: z.boolean(),
|
|
9
|
+
});
|
|
10
|
+
export type ImageGenerationRequestParams = z.infer<typeof ImageGenerationRequestParamsSchema>;
|
|
11
|
+
|
|
12
|
+
export const ImageGenerationModelSchema = z.object({
|
|
13
|
+
uuid: z.string(),
|
|
14
|
+
title: z.string(),
|
|
15
|
+
description: z.string(),
|
|
16
|
+
aiModel: z.string(),
|
|
17
|
+
price: z.number(),
|
|
18
|
+
order: z.number(),
|
|
19
|
+
params: z.any(),
|
|
20
|
+
strategy: z.nativeEnum(IMAGE_GENERATION_MODEL_STRATEGY),
|
|
21
|
+
status: z.nativeEnum(TOOL_MODEL_STATUS),
|
|
22
|
+
maxPromptLength: z.number(),
|
|
23
|
+
iconVariants: IconVariantsSchema,
|
|
24
|
+
createdAt: z.date(),
|
|
25
|
+
updatedAt: z.date(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export type ImageGenerationModel = z.infer<typeof ImageGenerationModelSchema>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const ImageGenerationPresetSchema = z.object({
|
|
4
|
+
uuid: z.string().uuid(),
|
|
5
|
+
title: z.string(),
|
|
6
|
+
prompt: z.string(),
|
|
7
|
+
sample: z.string(),
|
|
8
|
+
order: z.number(),
|
|
9
|
+
createdAt: z.date(),
|
|
10
|
+
updatedAt: z.date(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type ImageGenerationPreset = z.infer<typeof ImageGenerationPresetSchema>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { ImageGenerationJobSchema } from '../models';
|
|
4
|
+
|
|
5
|
+
export namespace FindImageGenerationJobByIdQuery {
|
|
6
|
+
export const RequestSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
uuid: z.string(),
|
|
9
|
+
userId: z.string().uuid().nullable().optional(),
|
|
10
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
11
|
+
})
|
|
12
|
+
.refine((data) => data.userId || data.unregisteredUserId, {
|
|
13
|
+
message: 'Either userId or unregisteredUserId must be provided',
|
|
14
|
+
});
|
|
15
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
16
|
+
|
|
17
|
+
export const ResponseSchema = ICommandResponseSchema(ImageGenerationJobSchema);
|
|
18
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { ImageGenerationJobSchema } from '../models';
|
|
4
|
+
|
|
5
|
+
export namespace FindImageGenerationJobsQuery {
|
|
6
|
+
export const RequestSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
userId: z.string().uuid().optional(),
|
|
9
|
+
unregisteredUserId: z.string().uuid().optional(),
|
|
10
|
+
title: z.string().optional(),
|
|
11
|
+
limit: z.coerce.number().min(1).optional(),
|
|
12
|
+
offset: z.coerce.number().min(0).default(0).optional(),
|
|
13
|
+
})
|
|
14
|
+
.refine(
|
|
15
|
+
(data) => {
|
|
16
|
+
return Boolean(data.userId) !== Boolean(data.unregisteredUserId);
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
message: 'At least userId or unregisteredUserId must be present',
|
|
20
|
+
path: ['userId', 'unregisteredUserId'],
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
24
|
+
|
|
25
|
+
export const ResponseSchema = ICommandResponseSchema(
|
|
26
|
+
z.object({
|
|
27
|
+
data: z.array(ImageGenerationJobSchema),
|
|
28
|
+
page: z.number(),
|
|
29
|
+
totalPages: z.number(),
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { ImageGenerationModelSchema, ImageGenerationPresetSchema } from '../models';
|
|
4
|
+
import { AiVendorSchema } from '../../ai-vendor';
|
|
5
|
+
|
|
6
|
+
const VendorWithModelsSchema = AiVendorSchema.extend({
|
|
7
|
+
models: z.array(ImageGenerationModelSchema),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const ImageGenerationConfigSchema = z.object({
|
|
11
|
+
vendors: z.array(VendorWithModelsSchema),
|
|
12
|
+
presets: z.array(ImageGenerationPresetSchema),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export namespace GetImageGenerationConfigQuery {
|
|
16
|
+
export const RequestSchema = z.object({});
|
|
17
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
18
|
+
|
|
19
|
+
export const ResponseSchema = ICommandResponseSchema(ImageGenerationConfigSchema);
|
|
20
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const IMAGE_GENERATION_AMQP_ROUTES = {
|
|
2
|
+
EXECUTE: 'tools.image-generation.execute.rpc',
|
|
3
|
+
CONFIG: 'tools.image-generation.config.rpc',
|
|
4
|
+
GET_JOB: 'tools.image-generation.jobs.get.rpc',
|
|
5
|
+
LIST_JOBS: 'tools.image-generation.jobs.list.rpc',
|
|
6
|
+
SET_REACTION: 'tools.image-generation.jobs.set-reaction.rpc',
|
|
7
|
+
UPDATE_TITLE: 'tools.image-generation.jobs.update-title.rpc',
|
|
8
|
+
SOFT_DELETE: 'tools.image-generation.jobs.soft-delete.rpc',
|
|
9
|
+
SOFT_DELETE_ALL: 'tools.image-generation.jobs.soft-delete-all.rpc',
|
|
10
|
+
} as const;
|
package/index.ts
CHANGED
|
@@ -7,8 +7,10 @@ export * from './language';
|
|
|
7
7
|
export * from './video';
|
|
8
8
|
export * from './writer';
|
|
9
9
|
export * from './image-editor';
|
|
10
|
+
export * from './image-generation';
|
|
10
11
|
export * from './video-editor';
|
|
11
12
|
export * from './music';
|
|
13
|
+
export * from './ai-vendor';
|
|
12
14
|
|
|
13
15
|
import * as common from './common';
|
|
14
16
|
import * as paraphrase from './paraphrase';
|
|
@@ -20,8 +22,10 @@ import * as language from './language';
|
|
|
20
22
|
import * as video from './video';
|
|
21
23
|
import * as writer from './writer';
|
|
22
24
|
import * as imageEditor from './image-editor';
|
|
25
|
+
import * as imageGeneration from './image-generation';
|
|
23
26
|
import * as videoEditor from './video-editor';
|
|
24
27
|
import * as music from './music';
|
|
28
|
+
import * as aiVendor from './ai-vendor';
|
|
25
29
|
|
|
26
30
|
export namespace ToolService {
|
|
27
31
|
export import Common = common;
|
|
@@ -34,6 +38,8 @@ export namespace ToolService {
|
|
|
34
38
|
export import Video = video;
|
|
35
39
|
export import Writer = writer;
|
|
36
40
|
export import ImageEditor = imageEditor;
|
|
41
|
+
export import ImageGeneration = imageGeneration;
|
|
37
42
|
export import VideoEditor = videoEditor;
|
|
38
43
|
export import Music = music;
|
|
44
|
+
export import AiVendor = aiVendor;
|
|
39
45
|
}
|
package/package.json
CHANGED