@purpleschool/gptbot-tools 0.0.78 → 0.0.79-ai-proxy
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-proxy/index.ts +1 -0
- package/ai-proxy/routes/ai-proxy.routes.ts +8 -0
- package/ai-proxy/routes/index.ts +1 -0
- 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-proxy/index.js +17 -0
- package/build/ai-proxy/routes/ai-proxy.routes.js +10 -0
- package/build/ai-proxy/routes/index.js +17 -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 +158 -0
- package/build/common/models/attached-file.schema.js +13 -0
- package/build/common/models/index.js +1 -0
- package/build/image-editor/commands/image-editor.command.js +3 -1
- package/build/image-editor/commands/retry-image-editor-job.command.js +4 -0
- package/build/image-editor/commands/set-reaction-to-image-editor-job.command.js +12 -2
- package/build/image-editor/enums/image-editor-model-type.enum.js +2 -0
- package/build/image-editor/enums/image-editor-strategy.enum.js +4 -0
- package/build/image-editor/models/image-editor-config.schema.js +1 -0
- package/build/image-editor/models/image-editor-job.schema.js +2 -0
- package/build/image-editor/models/image-editor-model.schema.js +9 -1
- package/build/image-editor/routes/image-editor.http.routes.js +1 -0
- package/build/image-generation/commands/execute-image-generation.command.js +20 -0
- package/build/image-generation/commands/forward-image-generation-job.command.js +32 -0
- package/build/image-generation/commands/index.js +23 -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 +27 -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 +23 -0
- package/build/image-generation/enums/image-generation-models.enum.js +8 -0
- package/build/image-generation/enums/image-generation-resolution.enum.js +9 -0
- package/build/image-generation/enums/index.js +19 -0
- package/build/image-generation/index.js +21 -0
- package/build/image-generation/models/image-generation-config.schema.js +12 -0
- package/build/image-generation/models/image-generation-job.schema.js +35 -0
- package/build/image-generation/models/image-generation-model.schema.js +51 -0
- package/build/image-generation/models/image-generation-preset.schema.js +13 -0
- package/build/image-generation/models/index.js +20 -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 +11 -0
- package/build/image-generation/queries/index.js +19 -0
- package/build/image-generation/routes/image-generation.amqp.routes.js +14 -0
- package/build/image-generation/routes/image-generation.http.routes.js +9 -0
- package/build/image-generation/routes/index.js +18 -0
- package/build/index.js +7 -0
- package/build/music/commands/retry-music-job.command.js +2 -0
- package/build/music/commands/set-reaction-to-music-job.command.js +12 -2
- package/build/music/models/music-job.schema.js +1 -0
- package/build/music/models/music-track.schema.js +1 -0
- package/build/music/routes/music.http.routes.js +1 -4
- package/build/paraphrase/commands/delete-all-paraphrase-jobs.command.js +13 -0
- package/build/paraphrase/commands/delete-paraphrase-job-by-uuid.command.js +14 -0
- package/build/paraphrase/commands/index.js +5 -0
- package/build/paraphrase/commands/retry-paraphrase-job.command.js +16 -0
- package/build/paraphrase/commands/set-reaction-to-paraphrase-job.command.js +27 -0
- package/build/paraphrase/commands/update-paraphrase-job-title.command.js +16 -0
- package/build/paraphrase/models/paraphrase-job.schema.js +7 -0
- package/build/paraphrase/queries/find-paraphrase-jobs.query.js +28 -0
- package/build/paraphrase/queries/index.js +1 -0
- package/build/paraphrase/routes/paraphrase.amqp.routes.js +6 -0
- package/build/presentation/commands/index.js +1 -0
- package/build/presentation/commands/set-reaction-to-presentation.command.js +26 -0
- package/build/presentation/models/pptx-export-payload.js +19 -1
- package/build/presentation/models/presentation.schema.js +3 -0
- package/build/presentation/models/slide-content.schema.js +7 -3
- package/build/presentation/routes/presentation.routes.js +1 -0
- package/build/stt/commands/set-reaction-to-stt-job.command.js +12 -2
- package/build/stt/models/stt-job.schema.js +2 -0
- package/build/tools/enums/tool-content-type.enum.js +1 -0
- package/build/tools/enums/tool-type.enum.js +1 -0
- package/build/tools/models/global-tools-config.schema.js +2 -0
- package/build/tools/models/tools-with-configs.schema.js +5 -0
- package/build/tts/commands/set-reaction-to-tts-job.command.js +12 -2
- package/build/tts/models/tts-job.schema.js +2 -0
- package/build/video/commands/retry-video-job.command.js +4 -0
- package/build/video/commands/set-reaction-to-video-job.command.js +12 -2
- package/build/video/models/video-job.schema.js +3 -0
- package/build/video/models/video-model.schema.js +1 -0
- package/build/video-editor/commands/edit-video.command.js +2 -1
- package/build/video-editor/commands/retry-video-editor-job.command.js +5 -0
- package/build/video-editor/commands/set-reaction-to-video-editor-job.command.js +12 -2
- package/build/video-editor/models/video-editor-job.schema.js +3 -0
- package/build/writer/commands/set-reaction-writer-document.command.js +11 -1
- package/build/writer/models/writer-document.schema.js +1 -0
- package/common/errors/errors.ts +158 -0
- package/common/models/attached-file.schema.ts +11 -0
- package/common/models/index.ts +1 -0
- package/image-editor/commands/image-editor.command.ts +3 -1
- package/image-editor/commands/retry-image-editor-job.command.ts +5 -1
- package/image-editor/commands/set-reaction-to-image-editor-job.command.ts +19 -6
- package/image-editor/enums/image-editor-model-type.enum.ts +2 -0
- package/image-editor/enums/image-editor-strategy.enum.ts +4 -0
- package/image-editor/models/image-editor-config.schema.ts +1 -0
- package/image-editor/models/image-editor-job.schema.ts +3 -1
- package/image-editor/models/image-editor-model.schema.ts +16 -0
- package/image-editor/routes/image-editor.http.routes.ts +1 -0
- package/image-generation/commands/execute-image-generation.command.ts +20 -0
- package/image-generation/commands/forward-image-generation-job.command.ts +32 -0
- package/image-generation/commands/index.ts +7 -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 +30 -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 +24 -0
- package/image-generation/enums/image-generation-models.enum.ts +4 -0
- package/image-generation/enums/image-generation-resolution.enum.ts +5 -0
- package/image-generation/enums/index.ts +3 -0
- package/image-generation/index.ts +5 -0
- package/image-generation/models/image-generation-config.schema.ts +11 -0
- package/image-generation/models/image-generation-job.schema.ts +37 -0
- package/image-generation/models/image-generation-model.schema.ts +64 -0
- package/image-generation/models/image-generation-preset.schema.ts +13 -0
- package/image-generation/models/index.ts +4 -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 +11 -0
- package/image-generation/queries/index.ts +3 -0
- package/image-generation/routes/image-generation.amqp.routes.ts +11 -0
- package/image-generation/routes/image-generation.http.routes.ts +7 -0
- package/image-generation/routes/index.ts +2 -0
- package/index.ts +7 -0
- package/music/commands/retry-music-job.command.ts +3 -1
- package/music/commands/set-reaction-to-music-job.command.ts +19 -6
- package/music/models/music-job.schema.ts +1 -0
- package/music/models/music-track.schema.ts +1 -0
- package/music/routes/music.http.routes.ts +0 -4
- package/package.json +1 -1
- package/paraphrase/commands/delete-all-paraphrase-jobs.command.ts +13 -0
- package/paraphrase/commands/delete-paraphrase-job-by-uuid.command.ts +14 -0
- package/paraphrase/commands/index.ts +5 -0
- package/paraphrase/commands/retry-paraphrase-job.command.ts +16 -0
- package/paraphrase/commands/set-reaction-to-paraphrase-job.command.ts +30 -0
- package/paraphrase/commands/update-paraphrase-job-title.command.ts +16 -0
- package/paraphrase/models/paraphrase-job.schema.ts +7 -0
- package/paraphrase/queries/find-paraphrase-jobs.query.ts +33 -0
- package/paraphrase/queries/index.ts +1 -0
- package/paraphrase/routes/paraphrase.amqp.routes.ts +6 -0
- package/presentation/commands/index.ts +1 -0
- package/presentation/commands/set-reaction-to-presentation.command.ts +29 -0
- package/presentation/models/pptx-export-payload.ts +20 -0
- package/presentation/models/presentation.schema.ts +3 -0
- package/presentation/models/slide-content.schema.ts +9 -3
- package/presentation/routes/presentation.routes.ts +1 -0
- package/stt/commands/set-reaction-to-stt-job.command.ts +19 -6
- package/stt/models/stt-job.schema.ts +2 -0
- package/tools/enums/tool-content-type.enum.ts +1 -0
- package/tools/enums/tool-type.enum.ts +1 -0
- package/tools/models/global-tools-config.schema.ts +2 -0
- package/tools/models/tools-with-configs.schema.ts +7 -0
- package/tts/commands/set-reaction-to-tts-job.command.ts +19 -6
- package/tts/models/tts-job.schema.ts +2 -0
- package/video/commands/retry-video-job.command.ts +4 -0
- package/video/commands/set-reaction-to-video-job.command.ts +19 -6
- package/video/models/video-job.schema.ts +3 -0
- package/video/models/video-model.schema.ts +1 -0
- package/video-editor/commands/edit-video.command.ts +2 -1
- package/video-editor/commands/retry-video-editor-job.command.ts +5 -0
- package/video-editor/commands/set-reaction-to-video-editor-job.command.ts +19 -6
- package/video-editor/models/video-editor-job.schema.ts +3 -0
- package/writer/commands/set-reaction-writer-document.command.ts +19 -6
- package/writer/models/writer-document.schema.ts +1 -0
package/common/errors/errors.ts
CHANGED
|
@@ -101,6 +101,21 @@ export const ERRORS = {
|
|
|
101
101
|
message: 'Задание на перефразирование не найдено',
|
|
102
102
|
httpCode: 404,
|
|
103
103
|
},
|
|
104
|
+
DELETE_ERROR: {
|
|
105
|
+
code: 'PARAPHRASE_JOB.DELETE_ERROR',
|
|
106
|
+
message: 'Произошла ошибка при удалении задания на перефразирование',
|
|
107
|
+
httpCode: 500,
|
|
108
|
+
},
|
|
109
|
+
NOT_AN_OWNER: {
|
|
110
|
+
code: 'PARAPHRASE_JOB.NOT_AN_OWNER',
|
|
111
|
+
message: 'Пользователь не является владельцем задания на перефразирование',
|
|
112
|
+
httpCode: 403,
|
|
113
|
+
},
|
|
114
|
+
NOT_IN_FAILED_STATE_TO_RETRY: {
|
|
115
|
+
code: 'PARAPHRASE_JOB.NOT_IN_FAILED_STATE_TO_RETRY',
|
|
116
|
+
message: 'Задание на перефразирование не в состоянии "failed". Невозможно повторить',
|
|
117
|
+
httpCode: 400,
|
|
118
|
+
},
|
|
104
119
|
},
|
|
105
120
|
S3: {
|
|
106
121
|
GET_FILE_STREAM_ERROR: {
|
|
@@ -659,6 +674,11 @@ export const ERRORS = {
|
|
|
659
674
|
message: 'Произошла ошибка при удалении задания на генерацию видео',
|
|
660
675
|
httpCode: 500,
|
|
661
676
|
},
|
|
677
|
+
UPDATE_ERROR: {
|
|
678
|
+
code: 'VIDEO_JOB.UPDATE_ERROR',
|
|
679
|
+
message: 'Произошла ошибка при обновлении задания на генерацию видео',
|
|
680
|
+
httpCode: 500,
|
|
681
|
+
},
|
|
662
682
|
},
|
|
663
683
|
WRITER_DOCUMENT: {
|
|
664
684
|
SET_REACTION_TO_WRITER_DOCUMENT_ERROR: {
|
|
@@ -935,6 +955,11 @@ export const ERRORS = {
|
|
|
935
955
|
message: 'Произошла ошибка при удалении задания на редактирование картинки',
|
|
936
956
|
httpCode: 500,
|
|
937
957
|
},
|
|
958
|
+
UPDATE_ERROR: {
|
|
959
|
+
code: 'IMAGE_EDITOR_JOB.UPDATE_ERROR',
|
|
960
|
+
message: 'Произошла ошибка при обновлении задания на редактирование картинки',
|
|
961
|
+
httpCode: 500,
|
|
962
|
+
},
|
|
938
963
|
},
|
|
939
964
|
VIDEO_EDITOR: {
|
|
940
965
|
AI_ERROR: {
|
|
@@ -1034,6 +1059,11 @@ export const ERRORS = {
|
|
|
1034
1059
|
message: 'Произошла ошибка при удалении задания на редактирование видео',
|
|
1035
1060
|
httpCode: 500,
|
|
1036
1061
|
},
|
|
1062
|
+
UPDATE_ERROR: {
|
|
1063
|
+
code: 'VIDEO_EDITOR_JOB.UPDATE_ERROR',
|
|
1064
|
+
message: 'Произошла ошибка при обновлении задания на редактирование видео',
|
|
1065
|
+
httpCode: 500,
|
|
1066
|
+
},
|
|
1037
1067
|
},
|
|
1038
1068
|
MUSIC_EDITOR: {
|
|
1039
1069
|
AI_ERROR: {
|
|
@@ -1202,6 +1232,126 @@ export const ERRORS = {
|
|
|
1202
1232
|
httpCode: 500,
|
|
1203
1233
|
},
|
|
1204
1234
|
},
|
|
1235
|
+
IMAGE_GENERATION: {
|
|
1236
|
+
AI_ERROR: {
|
|
1237
|
+
code: 'IMAGE_GENERATION.AI_ERROR',
|
|
1238
|
+
message: 'Произошла ошибка во время запроса к ИИ',
|
|
1239
|
+
httpCode: 500,
|
|
1240
|
+
},
|
|
1241
|
+
INSUFFICIENT_BALANCE: {
|
|
1242
|
+
code: 'IMAGE_GENERATION.INSUFFICIENT_BALANCE',
|
|
1243
|
+
message: 'У пользователя недостаточно средств',
|
|
1244
|
+
httpCode: 400,
|
|
1245
|
+
},
|
|
1246
|
+
INVALID_PARAMS: {
|
|
1247
|
+
code: 'IMAGE_GENERATION.INVALID_PARAMS',
|
|
1248
|
+
message: 'Некорректные параметры изображения',
|
|
1249
|
+
httpCode: 400,
|
|
1250
|
+
},
|
|
1251
|
+
DELETE_ERROR: {
|
|
1252
|
+
code: 'IMAGE_GENERATION.DELETE_ERROR',
|
|
1253
|
+
message: 'Произошла ошибка при удалении генерации изображения',
|
|
1254
|
+
httpCode: 500,
|
|
1255
|
+
},
|
|
1256
|
+
MAX_PROMPT_LENGTH_EXCEEDED: {
|
|
1257
|
+
code: 'IMAGE_GENERATION.MAX_PROMPT_LENGTH_EXCEEDED',
|
|
1258
|
+
message: 'Превышена максимальная длина запроса',
|
|
1259
|
+
httpCode: 400,
|
|
1260
|
+
},
|
|
1261
|
+
POLL_TIMEOUT: {
|
|
1262
|
+
code: 'IMAGE_GENERATION.POLL_TIMEOUT',
|
|
1263
|
+
message: 'Превышено время ожидания генерации изображения',
|
|
1264
|
+
httpCode: 500,
|
|
1265
|
+
},
|
|
1266
|
+
IMAGE_ATTACHMENT_NOT_SUPPORTED: {
|
|
1267
|
+
code: 'IMAGE_GENERATION.IMAGE_ATTACHMENT_NOT_SUPPORTED',
|
|
1268
|
+
message: 'Выбранная модель не поддерживает вложение изображений',
|
|
1269
|
+
httpCode: 400,
|
|
1270
|
+
},
|
|
1271
|
+
TOO_MANY_ATTACHED_IMAGES: {
|
|
1272
|
+
code: 'IMAGE_GENERATION.TOO_MANY_ATTACHED_IMAGES',
|
|
1273
|
+
message: 'Слишком много вложенных изображений',
|
|
1274
|
+
httpCode: 400,
|
|
1275
|
+
},
|
|
1276
|
+
},
|
|
1277
|
+
IMAGE_GENERATION_MODEL: {
|
|
1278
|
+
SAVE_ERROR: {
|
|
1279
|
+
code: 'IMAGE_GENERATION_MODEL.SAVE_ERROR',
|
|
1280
|
+
message: 'Произошла ошибка при сохранении модели для генерации изображений',
|
|
1281
|
+
httpCode: 500,
|
|
1282
|
+
},
|
|
1283
|
+
FIND_ERROR: {
|
|
1284
|
+
code: 'IMAGE_GENERATION_MODEL.FIND_ERROR',
|
|
1285
|
+
message: 'Произошла ошибка при поиске модели для генерации изображений',
|
|
1286
|
+
httpCode: 500,
|
|
1287
|
+
},
|
|
1288
|
+
NOT_FOUND: {
|
|
1289
|
+
code: 'IMAGE_GENERATION_MODEL.NOT_FOUND',
|
|
1290
|
+
message: 'Модель для генерации изображений не найдена',
|
|
1291
|
+
httpCode: 404,
|
|
1292
|
+
},
|
|
1293
|
+
MODEL_INACTIVE: {
|
|
1294
|
+
code: 'IMAGE_GENERATION_MODEL.MODEL_INACTIVE',
|
|
1295
|
+
message: 'Модель для генерации изображений неактивна',
|
|
1296
|
+
httpCode: 400,
|
|
1297
|
+
},
|
|
1298
|
+
},
|
|
1299
|
+
IMAGE_GENERATION_JOB: {
|
|
1300
|
+
SAVE_ERROR: {
|
|
1301
|
+
code: 'IMAGE_GENERATION_JOB.SAVE_ERROR',
|
|
1302
|
+
message: 'Произошла ошибка при сохранении задания на генерацию изображения',
|
|
1303
|
+
httpCode: 500,
|
|
1304
|
+
},
|
|
1305
|
+
FIND_ERROR: {
|
|
1306
|
+
code: 'IMAGE_GENERATION_JOB.FIND_ERROR',
|
|
1307
|
+
message: 'Произошла ошибка при поиске задания на генерацию изображения',
|
|
1308
|
+
httpCode: 500,
|
|
1309
|
+
},
|
|
1310
|
+
NOT_FOUND: {
|
|
1311
|
+
code: 'IMAGE_GENERATION_JOB.NOT_FOUND',
|
|
1312
|
+
message: 'Задание на генерацию изображения не найдено',
|
|
1313
|
+
httpCode: 404,
|
|
1314
|
+
},
|
|
1315
|
+
NOT_AN_OWNER: {
|
|
1316
|
+
code: 'IMAGE_GENERATION_JOB.NOT_AN_OWNER',
|
|
1317
|
+
message: 'Пользователь не является владельцем задания на генерацию изображения',
|
|
1318
|
+
httpCode: 403,
|
|
1319
|
+
},
|
|
1320
|
+
DELETE_ERROR: {
|
|
1321
|
+
code: 'IMAGE_GENERATION_JOB.DELETE_ERROR',
|
|
1322
|
+
message: 'Произошла ошибка при удалении задания на генерацию изображения',
|
|
1323
|
+
httpCode: 500,
|
|
1324
|
+
},
|
|
1325
|
+
UPDATE_ERROR: {
|
|
1326
|
+
code: 'IMAGE_GENERATION_JOB.UPDATE_ERROR',
|
|
1327
|
+
message: 'Произошла ошибка при обновлении задания на генерацию изображения',
|
|
1328
|
+
httpCode: 500,
|
|
1329
|
+
},
|
|
1330
|
+
},
|
|
1331
|
+
IMAGE_GENERATION_PRESET: {
|
|
1332
|
+
FIND_ERROR: {
|
|
1333
|
+
code: 'IMAGE_GENERATION_PRESET.FIND_ERROR',
|
|
1334
|
+
message: 'Произошла ошибка при поиске пресета генерации изображения',
|
|
1335
|
+
httpCode: 500,
|
|
1336
|
+
},
|
|
1337
|
+
NOT_FOUND: {
|
|
1338
|
+
code: 'IMAGE_GENERATION_PRESET.NOT_FOUND',
|
|
1339
|
+
message: 'Пресет генерации изображения не найден',
|
|
1340
|
+
httpCode: 404,
|
|
1341
|
+
},
|
|
1342
|
+
},
|
|
1343
|
+
AI_VENDOR: {
|
|
1344
|
+
FIND_ERROR: {
|
|
1345
|
+
code: 'AI_VENDOR.FIND_ERROR',
|
|
1346
|
+
message: 'Произошла ошибка при поиске поставщика ИИ',
|
|
1347
|
+
httpCode: 500,
|
|
1348
|
+
},
|
|
1349
|
+
NOT_FOUND: {
|
|
1350
|
+
code: 'AI_VENDOR.NOT_FOUND',
|
|
1351
|
+
message: 'Поставщик ИИ не найден',
|
|
1352
|
+
httpCode: 404,
|
|
1353
|
+
},
|
|
1354
|
+
},
|
|
1205
1355
|
CONTENT_POLICY: {
|
|
1206
1356
|
PHOTOREALISTIC_PEOPLE: {
|
|
1207
1357
|
code: 'CONTENT_POLICY.PHOTOREALISTIC_PEOPLE',
|
|
@@ -1264,4 +1414,12 @@ export const ERRORS = {
|
|
|
1264
1414
|
httpCode: 400,
|
|
1265
1415
|
},
|
|
1266
1416
|
},
|
|
1417
|
+
// KIE
|
|
1418
|
+
KIE: {
|
|
1419
|
+
AI_ERROR: {
|
|
1420
|
+
code: 'KIE.GET_TASK_BY_ID_RESPONSE_ERROR',
|
|
1421
|
+
message: 'Произошла ошибка при получении ответа от KIE',
|
|
1422
|
+
httpCode: 500,
|
|
1423
|
+
},
|
|
1424
|
+
},
|
|
1267
1425
|
} as const;
|
package/common/models/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
3
|
import { ImageEditorJobSchema } from '../models';
|
|
4
|
+
import { AttachedFileSchema } from '../../common';
|
|
4
5
|
|
|
5
6
|
export namespace ImageEditorCommand {
|
|
6
7
|
export const RequestSchema = z.object({
|
|
@@ -10,9 +11,10 @@ export namespace ImageEditorCommand {
|
|
|
10
11
|
userBalance: z.number(),
|
|
11
12
|
modelId: z.string(),
|
|
12
13
|
params: z.object({
|
|
13
|
-
|
|
14
|
+
attachedFiles: z.array(AttachedFileSchema),
|
|
14
15
|
systemPromptId: z.string().optional(),
|
|
15
16
|
}),
|
|
17
|
+
userHasActiveSubscriptionOrProduct: z.boolean(),
|
|
16
18
|
});
|
|
17
19
|
export type Request = z.infer<typeof RequestSchema>;
|
|
18
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
-
import { ImageEditorJobSchema } from '../models';
|
|
3
|
+
import { ImageEditorJobParamsSchema, ImageEditorJobSchema } from '../models';
|
|
4
4
|
|
|
5
5
|
export namespace RetryImageEditorJobCommand {
|
|
6
6
|
export const RequestSchema = z.object({
|
|
@@ -8,6 +8,10 @@ export namespace RetryImageEditorJobCommand {
|
|
|
8
8
|
userBalance: z.number(),
|
|
9
9
|
userId: z.string().uuid().nullable().optional(),
|
|
10
10
|
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
11
|
+
userHasActiveSubscriptionOrProduct: z.boolean(),
|
|
12
|
+
modelId: z.string().optional(),
|
|
13
|
+
prompt: z.string().optional(),
|
|
14
|
+
params: ImageEditorJobParamsSchema.optional(),
|
|
11
15
|
});
|
|
12
16
|
export type Request = z.infer<typeof RequestSchema>;
|
|
13
17
|
|
|
@@ -4,12 +4,25 @@ import { ImageEditorJobSchema } from '../models';
|
|
|
4
4
|
import { USER_REACTION } from '../../common';
|
|
5
5
|
|
|
6
6
|
export namespace SetReactionToImageEditorJobCommand {
|
|
7
|
-
export const RequestSchema = z
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
export const RequestSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
userId: z.string().uuid().nullable().optional(),
|
|
10
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
11
|
+
uuid: z.string().uuid(),
|
|
12
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
13
|
+
dislikeReason: z.string().nullable().default(null),
|
|
14
|
+
})
|
|
15
|
+
.refine(
|
|
16
|
+
(data) => {
|
|
17
|
+
if (data.reaction !== USER_REACTION.DISLIKED && data.dislikeReason) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
message: 'Dislike reason is not allowed when reaction is not disliked',
|
|
24
|
+
},
|
|
25
|
+
);
|
|
13
26
|
export type Request = z.infer<typeof RequestSchema>;
|
|
14
27
|
|
|
15
28
|
export const ResponseSchema = ICommandResponseSchema(ImageEditorJobSchema);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export enum IMAGE_EDITING_STRATEGY {
|
|
2
2
|
NANO_BANANA_POLLING = 'NANO_BANANA_POLLING',
|
|
3
3
|
NANO_BANANA_CALLBACK = 'NANO_BANANA_CALLBACK',
|
|
4
|
+
RECRAFT_REMOVE_BACKGROUND_CALLBACK = 'RECRAFT_REMOVE_BACKGROUND_CALLBACK',
|
|
5
|
+
RECRAFT_REMOVE_BACKGROUND_POLLING = 'RECRAFT_REMOVE_BACKGROUND_POLLING',
|
|
6
|
+
NANO_BANANA_PRO_CALLBACK = 'NANO_BANANA_PRO_CALLBACK',
|
|
7
|
+
NANO_BANANA_PRO_POLLING = 'NANO_BANANA_PRO_POLLING',
|
|
4
8
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { JOB_STATUS } from '../../tools';
|
|
3
|
-
import { USER_REACTION } from '../../common';
|
|
3
|
+
import { AttachedFileSchema, USER_REACTION } from '../../common';
|
|
4
4
|
|
|
5
5
|
export const ImageEditorJobParamsSchema = z.object({
|
|
6
|
+
attachedFiles: z.array(AttachedFileSchema).optional(),
|
|
6
7
|
imageUrls: z.array(z.string()).optional(),
|
|
7
8
|
systemPromptId: z.string().optional(),
|
|
8
9
|
});
|
|
@@ -13,6 +14,7 @@ export const ImageEditorJobSchema = z.object({
|
|
|
13
14
|
uuid: z.string(),
|
|
14
15
|
prompt: z.string(),
|
|
15
16
|
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
17
|
+
dislikeReason: z.string().nullable(),
|
|
16
18
|
externalId: z.string().nullable(),
|
|
17
19
|
title: z.string(),
|
|
18
20
|
status: z.nativeEnum(JOB_STATUS),
|
|
@@ -12,6 +12,21 @@ export const ImageEditorModelParamsSchema = z.object({
|
|
|
12
12
|
|
|
13
13
|
export type ImageEditorModelParams = z.infer<typeof ImageEditorModelParamsSchema>;
|
|
14
14
|
|
|
15
|
+
export const ImageEditorModelPricingRuleConditionSchema = z.object({
|
|
16
|
+
withoutSub: z.boolean().optional(),
|
|
17
|
+
});
|
|
18
|
+
export type ImageEditorModelPricingRuleCondition = z.infer<
|
|
19
|
+
typeof ImageEditorModelPricingRuleConditionSchema
|
|
20
|
+
>;
|
|
21
|
+
|
|
22
|
+
export const ImageEditorModelPricingRulesSchema = z.array(
|
|
23
|
+
z.object({
|
|
24
|
+
condition: ImageEditorModelPricingRuleConditionSchema,
|
|
25
|
+
value: z.number(),
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
export type ImageEditorModelPricingRules = z.infer<typeof ImageEditorModelPricingRulesSchema>;
|
|
29
|
+
|
|
15
30
|
export const ImageEditorModelSchema = z.object({
|
|
16
31
|
uuid: z.string(),
|
|
17
32
|
title: z.string(),
|
|
@@ -24,6 +39,7 @@ export const ImageEditorModelSchema = z.object({
|
|
|
24
39
|
strategy: z.nativeEnum(IMAGE_EDITING_STRATEGY),
|
|
25
40
|
maxInputLength: z.number(),
|
|
26
41
|
params: ImageEditorModelParamsSchema,
|
|
42
|
+
pricingRules: ImageEditorModelPricingRulesSchema,
|
|
27
43
|
createdAt: z.date(),
|
|
28
44
|
updatedAt: z.date(),
|
|
29
45
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
userHasActiveSubscriptionOrProduct: z.boolean(),
|
|
15
|
+
});
|
|
16
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
17
|
+
|
|
18
|
+
export const ResponseSchema = ICommandResponseSchema(ImageGenerationJobSchema);
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { ImageGenerationJobSchema, ImageGenerationJobParamsSchema } from '../models';
|
|
4
|
+
import { JOB_STATUS } from '../../tools/enums/job-status.enum';
|
|
5
|
+
import { USER_REACTION } from '../../common/enums/user-reaction.enum';
|
|
6
|
+
|
|
7
|
+
export namespace ForwardImageGenerationJobCommand {
|
|
8
|
+
export const RequestSchema = z.object({
|
|
9
|
+
uuid: z.string().uuid(),
|
|
10
|
+
prompt: z.string(),
|
|
11
|
+
title: z.string(),
|
|
12
|
+
status: z.nativeEnum(JOB_STATUS),
|
|
13
|
+
error: z.string().nullable(),
|
|
14
|
+
price: z.number(),
|
|
15
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
16
|
+
externalId: z.string().nullable(),
|
|
17
|
+
output: z.array(z.string()),
|
|
18
|
+
params: ImageGenerationJobParamsSchema,
|
|
19
|
+
modelId: z.string().uuid(),
|
|
20
|
+
presetId: z.string().uuid().nullable().optional(),
|
|
21
|
+
userId: z.string().uuid().nullable().optional(),
|
|
22
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
23
|
+
isDeleted: z.boolean(),
|
|
24
|
+
internalError: z.string().nullable(),
|
|
25
|
+
createdAt: z.coerce.date(),
|
|
26
|
+
updatedAt: z.coerce.date(),
|
|
27
|
+
});
|
|
28
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
29
|
+
|
|
30
|
+
export const ResponseSchema = ICommandResponseSchema(ImageGenerationJobSchema);
|
|
31
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './execute-image-generation.command';
|
|
2
|
+
export * from './forward-image-generation-job.command';
|
|
3
|
+
export * from './save-image-generation-job.command';
|
|
4
|
+
export * from './soft-delete-image-generation-job-by-uuid.command';
|
|
5
|
+
export * from './soft-delete-image-generation-jobs-by-criteria.command';
|
|
6
|
+
export * from './set-reaction-to-image-generation-job.command';
|
|
7
|
+
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,30 @@
|
|
|
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
|
|
8
|
+
.object({
|
|
9
|
+
userId: z.string().uuid().nullable().optional(),
|
|
10
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
11
|
+
uuid: z.string().uuid(),
|
|
12
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
13
|
+
dislikeReason: z.string().nullable().default(null),
|
|
14
|
+
})
|
|
15
|
+
.refine(
|
|
16
|
+
(data) => {
|
|
17
|
+
if (data.reaction !== USER_REACTION.DISLIKED && data.dislikeReason) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
message: 'Dislike reason is not allowed when reaction is not disliked',
|
|
24
|
+
},
|
|
25
|
+
);
|
|
26
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
27
|
+
|
|
28
|
+
export const ResponseSchema = ICommandResponseSchema(ImageGenerationJobSchema);
|
|
29
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
30
|
+
}
|
|
@@ -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,24 @@
|
|
|
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
|
+
NANO_BANANA_IMAGE_GENERATION = 'NANO_BANANA_IMAGE_GENERATION',
|
|
21
|
+
|
|
22
|
+
// Flux
|
|
23
|
+
KIE_FLUX_IMAGE_GENERATION = 'KIE_FLUX_IMAGE_GENERATION',
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ImageGenerationModelSchema } from './image-generation-model.schema';
|
|
3
|
+
import { ImageGenerationPresetSchema } from './image-generation-preset.schema';
|
|
4
|
+
import { AiVendorSchema } from '../../ai-vendor';
|
|
5
|
+
|
|
6
|
+
export const ImageGenerationConfigSchema = z.object({
|
|
7
|
+
vendors: z.array(AiVendorSchema),
|
|
8
|
+
models: z.array(ImageGenerationModelSchema),
|
|
9
|
+
presets: z.array(ImageGenerationPresetSchema),
|
|
10
|
+
});
|
|
11
|
+
export type ImageGenerationConfig = z.infer<typeof ImageGenerationConfigSchema>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { JOB_STATUS } from '../../tools';
|
|
3
|
+
import { AttachedFileSchema, USER_REACTION } from '../../common';
|
|
4
|
+
import { IMAGE_GENERATION_RESOLUTION } from '../enums';
|
|
5
|
+
|
|
6
|
+
export const ImageGenerationJobParamsSchema = z.object({
|
|
7
|
+
aspectRatio: z.string(),
|
|
8
|
+
attachedFiles: z.array(AttachedFileSchema),
|
|
9
|
+
enhancePrompt: z.boolean(),
|
|
10
|
+
resolution: z.nativeEnum(IMAGE_GENERATION_RESOLUTION).optional(),
|
|
11
|
+
});
|
|
12
|
+
export type ImageGenerationJobParams = z.infer<typeof ImageGenerationJobParamsSchema>;
|
|
13
|
+
|
|
14
|
+
export const ImageGenerationJobSchema = z.object({
|
|
15
|
+
uuid: z.string(),
|
|
16
|
+
prompt: z.string(),
|
|
17
|
+
title: z.string(),
|
|
18
|
+
status: z.nativeEnum(JOB_STATUS),
|
|
19
|
+
error: z.string().nullable(),
|
|
20
|
+
price: z.number(),
|
|
21
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
22
|
+
dislikeReason: z.string().nullable(),
|
|
23
|
+
externalId: z.string().nullable(),
|
|
24
|
+
params: ImageGenerationJobParamsSchema,
|
|
25
|
+
output: z.array(z.string()),
|
|
26
|
+
presetId: z.string().nullable().optional(),
|
|
27
|
+
modelId: z.string(),
|
|
28
|
+
attempts: z.array(z.any()),
|
|
29
|
+
userId: z.string().nullable().optional(),
|
|
30
|
+
unregisteredUserId: z.string().nullable().optional(),
|
|
31
|
+
isDeleted: z.boolean(),
|
|
32
|
+
internalError: z.string().nullable(),
|
|
33
|
+
createdAt: z.date(),
|
|
34
|
+
updatedAt: z.date(),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export type ImageGenerationJob = z.infer<typeof ImageGenerationJobSchema>;
|