@purpleschool/gptbot-tools 0.0.77-ai-proxy → 0.0.78-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-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 +163 -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-model/get-image-editor-model-by-uuid.command.js +13 -0
- package/build/image-editor/commands/image-editor-model/index.js +17 -0
- package/build/image-editor/commands/image-editor.command.js +3 -1
- package/build/image-editor/commands/index.js +1 -0
- 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-model.amqp.routes.js +6 -0
- package/build/image-editor/routes/image-editor.http.routes.js +1 -0
- package/build/image-editor/routes/index.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 +6 -0
- package/build/music/commands/index.js +1 -0
- package/build/music/commands/music-model/get-music-model-by-uuid.command.js +13 -0
- package/build/music/commands/music-model/index.js +17 -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/index.js +1 -0
- package/build/music/routes/music-model.amqp.routes.js +6 -0
- 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/constants/slide-layout-map.constant.js +1 -0
- package/build/presentation/enums/slide-content-type.enum.js +1 -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-edit.schema.js +18 -1
- package/build/presentation/models/slide-content.schema.js +30 -1
- 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/tool.schema.js +3 -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/index.js +1 -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/commands/video-model/get-video-model-by-uuid.command.js +13 -0
- package/build/video/commands/video-model/index.js +17 -0
- package/build/video/enums/video-pricing-rule-type.enum.js +1 -0
- package/build/video/enums/video-strategy.enum.js +1 -0
- package/build/video/models/video-job.schema.js +3 -0
- package/build/video/models/video-model.schema.js +9 -1
- package/build/video/routes/index.js +1 -0
- package/build/video/routes/video-model.amqp.routes.js +6 -0
- package/build/video/routes/video.http.routes.js +1 -0
- package/build/video/utils/calculate-video-generation-price.util.js +5 -1
- package/build/video-editor/commands/edit-video.command.js +2 -1
- package/build/video-editor/commands/index.js +1 -0
- 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/commands/video-editor-model/get-video-editor-model.command.js +13 -0
- package/build/video-editor/commands/video-editor-model/index.js +17 -0
- package/build/video-editor/models/video-editor-job.schema.js +3 -0
- package/build/video-editor/routes/index.js +1 -0
- package/build/video-editor/routes/video-editor-model.amqp.routes.js +6 -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 +163 -0
- package/common/models/attached-file.schema.ts +11 -0
- package/common/models/index.ts +1 -0
- package/image-editor/commands/image-editor-model/get-image-editor-model-by-uuid.command.ts +13 -0
- package/image-editor/commands/image-editor-model/index.ts +1 -0
- package/image-editor/commands/image-editor.command.ts +3 -1
- package/image-editor/commands/index.ts +1 -0
- 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-model.amqp.routes.ts +3 -0
- package/image-editor/routes/image-editor.http.routes.ts +1 -0
- package/image-editor/routes/index.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 +6 -0
- package/music/commands/index.ts +1 -0
- package/music/commands/music-model/get-music-model-by-uuid.command.ts +13 -0
- package/music/commands/music-model/index.ts +1 -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/index.ts +1 -0
- package/music/routes/music-model.amqp.routes.ts +3 -0
- 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/constants/slide-layout-map.constant.ts +1 -0
- package/presentation/enums/slide-content-type.enum.ts +1 -0
- package/presentation/models/pptx-export-payload.ts +20 -0
- package/presentation/models/presentation.schema.ts +3 -0
- package/presentation/models/slide-content-edit.schema.ts +21 -0
- package/presentation/models/slide-content.schema.ts +51 -0
- 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/tool.schema.ts +3 -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/index.ts +1 -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/commands/video-model/get-video-model-by-uuid.command.ts +13 -0
- package/video/commands/video-model/index.ts +1 -0
- package/video/enums/video-pricing-rule-type.enum.ts +1 -0
- package/video/enums/video-strategy.enum.ts +1 -0
- package/video/models/video-job.schema.ts +3 -0
- package/video/models/video-model.schema.ts +9 -1
- package/video/routes/index.ts +1 -0
- package/video/routes/video-model.amqp.routes.ts +3 -0
- package/video/routes/video.http.routes.ts +1 -0
- package/video/utils/calculate-video-generation-price.util.ts +7 -1
- package/video-editor/commands/edit-video.command.ts +2 -1
- package/video-editor/commands/index.ts +1 -0
- 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/commands/video-editor-model/get-video-editor-model.command.ts +13 -0
- package/video-editor/commands/video-editor-model/index.ts +1 -0
- package/video-editor/models/video-editor-job.schema.ts +3 -0
- package/video-editor/routes/index.ts +1 -0
- package/video-editor/routes/video-editor-model.amqp.routes.ts +3 -0
- package/writer/commands/set-reaction-writer-document.command.ts +19 -6
- package/writer/models/writer-document.schema.ts +1 -0
|
@@ -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>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AttachedFileSchema, IconVariantsSchema, TOOL_MODEL_STATUS } from '../../common';
|
|
3
|
+
import { IMAGE_GENERATION_MODEL_STRATEGY, IMAGE_GENERATION_RESOLUTION } from '../enums';
|
|
4
|
+
|
|
5
|
+
export const ImageGenerationRequestParamsSchema = z.object({
|
|
6
|
+
aspectRatio: z.string(),
|
|
7
|
+
attachedFiles: z.array(AttachedFileSchema),
|
|
8
|
+
enhancePrompt: z.boolean(),
|
|
9
|
+
resolution: z.nativeEnum(IMAGE_GENERATION_RESOLUTION).optional(),
|
|
10
|
+
});
|
|
11
|
+
export type ImageGenerationRequestParams = z.infer<typeof ImageGenerationRequestParamsSchema>;
|
|
12
|
+
|
|
13
|
+
export const ImageGenerationModelParamsSchema = z.object({
|
|
14
|
+
aspectRatio: z.record(
|
|
15
|
+
z.string(),
|
|
16
|
+
z.object({
|
|
17
|
+
width: z.number(),
|
|
18
|
+
height: z.number(),
|
|
19
|
+
}),
|
|
20
|
+
),
|
|
21
|
+
quality: z.string().optional(),
|
|
22
|
+
resolution: z
|
|
23
|
+
.object({
|
|
24
|
+
options: z.array(z.nativeEnum(IMAGE_GENERATION_RESOLUTION)),
|
|
25
|
+
})
|
|
26
|
+
.optional(),
|
|
27
|
+
});
|
|
28
|
+
export type ImageGenerationModelParams = z.infer<typeof ImageGenerationModelParamsSchema>;
|
|
29
|
+
|
|
30
|
+
export const ImageModelPricingRuleConditionSchema = z.object({
|
|
31
|
+
resolution: z.string().optional(),
|
|
32
|
+
withoutSub: z.boolean().optional(),
|
|
33
|
+
});
|
|
34
|
+
export type ImageModelPricingRuleCondition = z.infer<typeof ImageModelPricingRuleConditionSchema>;
|
|
35
|
+
|
|
36
|
+
export const ImageModelPricingRulesSchema = z.array(
|
|
37
|
+
z.object({
|
|
38
|
+
condition: ImageModelPricingRuleConditionSchema,
|
|
39
|
+
value: z.number(),
|
|
40
|
+
}),
|
|
41
|
+
);
|
|
42
|
+
export type ImageModelPricingRules = z.infer<typeof ImageModelPricingRulesSchema>;
|
|
43
|
+
|
|
44
|
+
export const ImageGenerationModelSchema = z.object({
|
|
45
|
+
uuid: z.string(),
|
|
46
|
+
title: z.string(),
|
|
47
|
+
description: z.string(),
|
|
48
|
+
aiModel: z.string(),
|
|
49
|
+
price: z.number(),
|
|
50
|
+
order: z.number(),
|
|
51
|
+
params: ImageGenerationModelParamsSchema,
|
|
52
|
+
strategy: z.nativeEnum(IMAGE_GENERATION_MODEL_STRATEGY),
|
|
53
|
+
status: z.nativeEnum(TOOL_MODEL_STATUS),
|
|
54
|
+
maxPromptLength: z.number(),
|
|
55
|
+
iconVariants: IconVariantsSchema,
|
|
56
|
+
supportsImageAttachment: z.boolean(),
|
|
57
|
+
maxAttachedImages: z.number(),
|
|
58
|
+
vendorId: z.string().uuid(),
|
|
59
|
+
pricingRules: ImageModelPricingRulesSchema,
|
|
60
|
+
createdAt: z.date(),
|
|
61
|
+
updatedAt: z.date(),
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
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,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { ImageGenerationConfigSchema } from '../models';
|
|
4
|
+
|
|
5
|
+
export namespace GetImageGenerationConfigQuery {
|
|
6
|
+
export const RequestSchema = z.object({});
|
|
7
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = ICommandResponseSchema(ImageGenerationConfigSchema);
|
|
10
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const IMAGE_GENERATION_AMQP_ROUTES = {
|
|
2
|
+
EXECUTE: 'tools.image-generation.execute.rpc',
|
|
3
|
+
CONFIG: 'tools.image-generation.config.rpc',
|
|
4
|
+
FORWARD_JOB: 'tools.image-generation.jobs.forward.rpc',
|
|
5
|
+
GET_JOB: 'tools.image-generation.jobs.get.rpc',
|
|
6
|
+
LIST_JOBS: 'tools.image-generation.jobs.list.rpc',
|
|
7
|
+
SET_REACTION: 'tools.image-generation.jobs.set-reaction.rpc',
|
|
8
|
+
UPDATE_TITLE: 'tools.image-generation.jobs.update-title.rpc',
|
|
9
|
+
SOFT_DELETE: 'tools.image-generation.jobs.soft-delete.rpc',
|
|
10
|
+
SOFT_DELETE_ALL: 'tools.image-generation.jobs.soft-delete-all.rpc',
|
|
11
|
+
} as const;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const IMAGE_GENERATION_CONTROLLER = 'image-generation';
|
|
2
|
+
|
|
3
|
+
export const IMAGE_GENERATION_ROUTES = {
|
|
4
|
+
KIE_MIDJOURNEY_CALLBACK: 'kie/midjourney/callback',
|
|
5
|
+
KIE_NANO_BANANA_CALLBACK: 'kie/nano-banana/callback',
|
|
6
|
+
KIE_FLUX_CALLBACK: 'kie/flux/callback',
|
|
7
|
+
} as const;
|
package/index.ts
CHANGED
|
@@ -7,9 +7,11 @@ 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';
|
|
12
13
|
export * from './ai-proxy';
|
|
14
|
+
export * from './ai-vendor';
|
|
13
15
|
|
|
14
16
|
import * as common from './common';
|
|
15
17
|
import * as paraphrase from './paraphrase';
|
|
@@ -21,8 +23,10 @@ import * as language from './language';
|
|
|
21
23
|
import * as video from './video';
|
|
22
24
|
import * as writer from './writer';
|
|
23
25
|
import * as imageEditor from './image-editor';
|
|
26
|
+
import * as imageGeneration from './image-generation';
|
|
24
27
|
import * as videoEditor from './video-editor';
|
|
25
28
|
import * as music from './music';
|
|
29
|
+
import * as aiVendor from './ai-vendor';
|
|
26
30
|
|
|
27
31
|
export namespace ToolService {
|
|
28
32
|
export import Common = common;
|
|
@@ -35,6 +39,8 @@ export namespace ToolService {
|
|
|
35
39
|
export import Video = video;
|
|
36
40
|
export import Writer = writer;
|
|
37
41
|
export import ImageEditor = imageEditor;
|
|
42
|
+
export import ImageGeneration = imageGeneration;
|
|
38
43
|
export import VideoEditor = videoEditor;
|
|
39
44
|
export import Music = music;
|
|
45
|
+
export import AiVendor = aiVendor;
|
|
40
46
|
}
|
package/music/commands/index.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MusicModelSchema } from '../../models';
|
|
3
|
+
import { ICommandResponseSchema } from '../../../common';
|
|
4
|
+
|
|
5
|
+
export namespace GetMusicModelByUuidCommand {
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
uuid: z.string().uuid(),
|
|
8
|
+
});
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = ICommandResponseSchema(MusicModelSchema);
|
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './get-music-model-by-uuid.command';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
-
import { MusicJobSchema } from '../models/music-job.schema';
|
|
3
|
+
import { MusicJobParamsSchema, MusicJobSchema } from '../models/music-job.schema';
|
|
4
4
|
|
|
5
5
|
export namespace RetryMusicJobCommand {
|
|
6
6
|
export const RequestSchema = z.object({
|
|
@@ -8,6 +8,8 @@ export namespace RetryMusicJobCommand {
|
|
|
8
8
|
userBalance: z.number(),
|
|
9
9
|
userId: z.string().uuid().nullable().optional(),
|
|
10
10
|
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
11
|
+
modelId: z.string().uuid().optional(),
|
|
12
|
+
params: MusicJobParamsSchema.optional(),
|
|
11
13
|
});
|
|
12
14
|
export type Request = z.infer<typeof RequestSchema>;
|
|
13
15
|
|
|
@@ -4,12 +4,25 @@ import { MusicJobSchema } from '../models/music-job.schema';
|
|
|
4
4
|
import { USER_REACTION } from '../../common';
|
|
5
5
|
|
|
6
6
|
export namespace SetReactionToMusicJobCommand {
|
|
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(MusicJobSchema);
|
|
@@ -35,6 +35,7 @@ export const MusicJobSchema = z.object({
|
|
|
35
35
|
uuid: z.string(),
|
|
36
36
|
prompt: z.string(),
|
|
37
37
|
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
38
|
+
dislikeReason: z.string().nullable(),
|
|
38
39
|
externalId: z.string().nullable(),
|
|
39
40
|
title: z.string(),
|
|
40
41
|
status: z.nativeEnum(JOB_STATUS),
|
package/music/routes/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
|
|
4
|
+
export namespace DeleteAllParaphraseJobsCommand {
|
|
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,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
|
|
4
|
+
export namespace DeleteParaphraseJobByUuidCommand {
|
|
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
|
+
}
|
|
@@ -1 +1,6 @@
|
|
|
1
1
|
export * from './paraphrase.command';
|
|
2
|
+
export * from './delete-paraphrase-job-by-uuid.command';
|
|
3
|
+
export * from './delete-all-paraphrase-jobs.command';
|
|
4
|
+
export * from './set-reaction-to-paraphrase-job.command';
|
|
5
|
+
export * from './update-paraphrase-job-title.command';
|
|
6
|
+
export * from './retry-paraphrase-job.command';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { ParaphraseJobSchema } from '../models/paraphrase-job.schema';
|
|
4
|
+
|
|
5
|
+
export namespace RetryParaphraseJobCommand {
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
uuid: z.string().uuid(),
|
|
8
|
+
userBalance: z.number(),
|
|
9
|
+
userId: z.string().uuid().nullable().optional(),
|
|
10
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
11
|
+
});
|
|
12
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = ICommandResponseSchema(ParaphraseJobSchema);
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { ParaphraseJobSchema } from '../models/paraphrase-job.schema';
|
|
4
|
+
import { USER_REACTION } from '../../common';
|
|
5
|
+
|
|
6
|
+
export namespace SetReactionToParaphraseJobCommand {
|
|
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(ParaphraseJobSchema);
|
|
29
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { ParaphraseJobSchema } from '../models/paraphrase-job.schema';
|
|
4
|
+
|
|
5
|
+
export namespace UpdateParaphraseJobTitleCommand {
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
uuid: z.string().uuid(),
|
|
8
|
+
userId: z.string().uuid().nullable().optional(),
|
|
9
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
10
|
+
title: z.string().min(1).max(40),
|
|
11
|
+
});
|
|
12
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = ICommandResponseSchema(ParaphraseJobSchema);
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { JOB_STATUS } from '../../tools';
|
|
3
|
+
import { USER_REACTION } from '../../common';
|
|
4
|
+
import { PARAPHRASING_INTENSITY } from '../enums';
|
|
3
5
|
|
|
4
6
|
export const ParaphraseJobSchema = z.object({
|
|
5
7
|
uuid: z.string(),
|
|
@@ -10,8 +12,13 @@ export const ParaphraseJobSchema = z.object({
|
|
|
10
12
|
aiTokenUsage: z.number().nullable(),
|
|
11
13
|
price: z.number(),
|
|
12
14
|
status: z.nativeEnum(JOB_STATUS),
|
|
15
|
+
title: z.string(),
|
|
16
|
+
error: z.string().nullable(),
|
|
17
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
18
|
+
dislikeReason: z.string().nullable(),
|
|
13
19
|
typeId: z.string(),
|
|
14
20
|
styleId: z.string(),
|
|
21
|
+
intensity: z.nativeEnum(PARAPHRASING_INTENSITY),
|
|
15
22
|
createdAt: z.date(),
|
|
16
23
|
updatedAt: z.date(),
|
|
17
24
|
completedAt: z.date().nullable(),
|