@purpleschool/gptbot-tools 0.0.97 → 0.0.98
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/build/image-generation/commands/forward-image-generation-job.command.js +32 -0
- package/build/image-generation/commands/index.js +1 -0
- package/build/image-generation/routes/image-generation.amqp.routes.js +1 -0
- package/build/tools/enums/tool-content-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/image-generation/commands/forward-image-generation-job.command.ts +32 -0
- package/image-generation/commands/index.ts +1 -0
- package/image-generation/routes/image-generation.amqp.routes.ts +1 -0
- package/package.json +1 -1
- package/tools/enums/tool-content-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
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ForwardImageGenerationJobCommand = 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 job_status_enum_1 = require("../../tools/enums/job-status.enum");
|
|
8
|
+
const user_reaction_enum_1 = require("../../common/enums/user-reaction.enum");
|
|
9
|
+
var ForwardImageGenerationJobCommand;
|
|
10
|
+
(function (ForwardImageGenerationJobCommand) {
|
|
11
|
+
ForwardImageGenerationJobCommand.RequestSchema = zod_1.z.object({
|
|
12
|
+
uuid: zod_1.z.string().uuid(),
|
|
13
|
+
prompt: zod_1.z.string(),
|
|
14
|
+
title: zod_1.z.string(),
|
|
15
|
+
status: zod_1.z.nativeEnum(job_status_enum_1.JOB_STATUS),
|
|
16
|
+
error: zod_1.z.string().nullable(),
|
|
17
|
+
price: zod_1.z.number(),
|
|
18
|
+
reaction: zod_1.z.nativeEnum(user_reaction_enum_1.USER_REACTION).nullable(),
|
|
19
|
+
externalId: zod_1.z.string().nullable(),
|
|
20
|
+
output: zod_1.z.array(zod_1.z.string()),
|
|
21
|
+
params: models_1.ImageGenerationJobParamsSchema,
|
|
22
|
+
modelId: zod_1.z.string().uuid(),
|
|
23
|
+
presetId: zod_1.z.string().uuid().nullable().optional(),
|
|
24
|
+
userId: zod_1.z.string().uuid().nullable().optional(),
|
|
25
|
+
unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
|
|
26
|
+
isDeleted: zod_1.z.boolean(),
|
|
27
|
+
internalError: zod_1.z.string().nullable(),
|
|
28
|
+
createdAt: zod_1.z.coerce.date(),
|
|
29
|
+
updatedAt: zod_1.z.coerce.date(),
|
|
30
|
+
});
|
|
31
|
+
ForwardImageGenerationJobCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.ImageGenerationJobSchema);
|
|
32
|
+
})(ForwardImageGenerationJobCommand || (exports.ForwardImageGenerationJobCommand = ForwardImageGenerationJobCommand = {}));
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./execute-image-generation.command"), exports);
|
|
18
|
+
__exportStar(require("./forward-image-generation-job.command"), exports);
|
|
18
19
|
__exportStar(require("./save-image-generation-job.command"), exports);
|
|
19
20
|
__exportStar(require("./soft-delete-image-generation-job-by-uuid.command"), exports);
|
|
20
21
|
__exportStar(require("./soft-delete-image-generation-jobs-by-criteria.command"), exports);
|
|
@@ -4,6 +4,7 @@ exports.IMAGE_GENERATION_AMQP_ROUTES = void 0;
|
|
|
4
4
|
exports.IMAGE_GENERATION_AMQP_ROUTES = {
|
|
5
5
|
EXECUTE: 'tools.image-generation.execute.rpc',
|
|
6
6
|
CONFIG: 'tools.image-generation.config.rpc',
|
|
7
|
+
FORWARD_JOB: 'tools.image-generation.jobs.forward.rpc',
|
|
7
8
|
GET_JOB: 'tools.image-generation.jobs.get.rpc',
|
|
8
9
|
LIST_JOBS: 'tools.image-generation.jobs.list.rpc',
|
|
9
10
|
SET_REACTION: 'tools.image-generation.jobs.set-reaction.rpc',
|
|
@@ -4,6 +4,7 @@ exports.TOOL_CONTENT_TYPE = void 0;
|
|
|
4
4
|
var TOOL_CONTENT_TYPE;
|
|
5
5
|
(function (TOOL_CONTENT_TYPE) {
|
|
6
6
|
TOOL_CONTENT_TYPE["IMAGE_EDITOR"] = "IMAGE_EDITOR";
|
|
7
|
+
TOOL_CONTENT_TYPE["IMAGE_GENERATION"] = "IMAGE_GENERATION";
|
|
7
8
|
TOOL_CONTENT_TYPE["TEXT_TO_SPEECH"] = "TEXT_TO_SPEECH";
|
|
8
9
|
TOOL_CONTENT_TYPE["SPEECH_TO_TEXT"] = "SPEECH_TO_TEXT";
|
|
9
10
|
TOOL_CONTENT_TYPE["REPHRASE"] = "REPHRASE";
|
|
@@ -7,6 +7,7 @@ const video_1 = require("../../video");
|
|
|
7
7
|
const music_1 = require("../../music");
|
|
8
8
|
const writer_1 = require("../../writer");
|
|
9
9
|
const image_editor_1 = require("../../image-editor");
|
|
10
|
+
const image_generation_1 = require("../../image-generation");
|
|
10
11
|
const paraphrase_1 = require("../../paraphrase");
|
|
11
12
|
const presentation_1 = require("../../presentation");
|
|
12
13
|
const video_editor_1 = require("../../video-editor");
|
|
@@ -17,6 +18,7 @@ exports.GlobalToolsConfigSchema = zod_1.z.object({
|
|
|
17
18
|
[enums_1.TOOL_CONTENT_TYPE.MUSIC]: music_1.MusicConfigSchema,
|
|
18
19
|
[enums_1.TOOL_CONTENT_TYPE.WRITER]: writer_1.WriterConfigSchema,
|
|
19
20
|
[enums_1.TOOL_CONTENT_TYPE.IMAGE_EDITOR]: image_editor_1.ImageEditorConfigSchema,
|
|
21
|
+
[enums_1.TOOL_CONTENT_TYPE.IMAGE_GENERATION]: image_generation_1.ImageGenerationConfigSchema,
|
|
20
22
|
[enums_1.TOOL_CONTENT_TYPE.REPHRASE]: paraphrase_1.ParaphraseToolConfigSchema,
|
|
21
23
|
[enums_1.TOOL_CONTENT_TYPE.PRESENTATION]: presentation_1.PresentationConfigSchema,
|
|
22
24
|
[enums_1.TOOL_CONTENT_TYPE.VIDEO_EDITOR]: video_editor_1.VideoEditorConfigSchema,
|
|
@@ -7,6 +7,7 @@ const video_1 = require("../../video");
|
|
|
7
7
|
const music_1 = require("../../music");
|
|
8
8
|
const writer_1 = require("../../writer");
|
|
9
9
|
const image_editor_1 = require("../../image-editor");
|
|
10
|
+
const image_generation_1 = require("../../image-generation");
|
|
10
11
|
const paraphrase_1 = require("../../paraphrase");
|
|
11
12
|
const presentation_1 = require("../../presentation");
|
|
12
13
|
const video_editor_1 = require("../../video-editor");
|
|
@@ -31,6 +32,10 @@ exports.ToolWithConfigSchema = zod_1.z.discriminatedUnion('contentType', [
|
|
|
31
32
|
contentType: zod_1.z.literal(enums_1.TOOL_CONTENT_TYPE.IMAGE_EDITOR),
|
|
32
33
|
config: image_editor_1.ImageEditorConfigSchema,
|
|
33
34
|
})),
|
|
35
|
+
tool_schema_1.ToolSchema.merge(zod_1.z.object({
|
|
36
|
+
contentType: zod_1.z.literal(enums_1.TOOL_CONTENT_TYPE.IMAGE_GENERATION),
|
|
37
|
+
config: image_generation_1.ImageGenerationConfigSchema,
|
|
38
|
+
})),
|
|
34
39
|
tool_schema_1.ToolSchema.merge(zod_1.z.object({
|
|
35
40
|
contentType: zod_1.z.literal(enums_1.TOOL_CONTENT_TYPE.REPHRASE),
|
|
36
41
|
config: paraphrase_1.ParaphraseToolConfigSchema,
|
|
@@ -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
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './execute-image-generation.command';
|
|
2
|
+
export * from './forward-image-generation-job.command';
|
|
2
3
|
export * from './save-image-generation-job.command';
|
|
3
4
|
export * from './soft-delete-image-generation-job-by-uuid.command';
|
|
4
5
|
export * from './soft-delete-image-generation-jobs-by-criteria.command';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const IMAGE_GENERATION_AMQP_ROUTES = {
|
|
2
2
|
EXECUTE: 'tools.image-generation.execute.rpc',
|
|
3
3
|
CONFIG: 'tools.image-generation.config.rpc',
|
|
4
|
+
FORWARD_JOB: 'tools.image-generation.jobs.forward.rpc',
|
|
4
5
|
GET_JOB: 'tools.image-generation.jobs.get.rpc',
|
|
5
6
|
LIST_JOBS: 'tools.image-generation.jobs.list.rpc',
|
|
6
7
|
SET_REACTION: 'tools.image-generation.jobs.set-reaction.rpc',
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import { VideoConfigSchema } from '../../video';
|
|
|
4
4
|
import { MusicConfigSchema } from '../../music';
|
|
5
5
|
import { WriterConfigSchema } from '../../writer';
|
|
6
6
|
import { ImageEditorConfigSchema } from '../../image-editor';
|
|
7
|
+
import { ImageGenerationConfigSchema } from '../../image-generation';
|
|
7
8
|
import { ParaphraseToolConfigSchema } from '../../paraphrase';
|
|
8
9
|
import { PresentationConfigSchema } from '../../presentation';
|
|
9
10
|
import { VideoEditorConfigSchema } from '../../video-editor';
|
|
@@ -15,6 +16,7 @@ export const GlobalToolsConfigSchema = z.object({
|
|
|
15
16
|
[TOOL_CONTENT_TYPE.MUSIC]: MusicConfigSchema,
|
|
16
17
|
[TOOL_CONTENT_TYPE.WRITER]: WriterConfigSchema,
|
|
17
18
|
[TOOL_CONTENT_TYPE.IMAGE_EDITOR]: ImageEditorConfigSchema,
|
|
19
|
+
[TOOL_CONTENT_TYPE.IMAGE_GENERATION]: ImageGenerationConfigSchema,
|
|
18
20
|
[TOOL_CONTENT_TYPE.REPHRASE]: ParaphraseToolConfigSchema,
|
|
19
21
|
[TOOL_CONTENT_TYPE.PRESENTATION]: PresentationConfigSchema,
|
|
20
22
|
[TOOL_CONTENT_TYPE.VIDEO_EDITOR]: VideoEditorConfigSchema,
|
|
@@ -4,6 +4,7 @@ import { VideoConfigSchema } from '../../video';
|
|
|
4
4
|
import { MusicConfigSchema } from '../../music';
|
|
5
5
|
import { WriterConfigSchema } from '../../writer';
|
|
6
6
|
import { ImageEditorConfigSchema } from '../../image-editor';
|
|
7
|
+
import { ImageGenerationConfigSchema } from '../../image-generation';
|
|
7
8
|
import { ParaphraseToolConfigSchema } from '../../paraphrase';
|
|
8
9
|
import { PresentationConfigSchema } from '../../presentation';
|
|
9
10
|
import { VideoEditorConfigSchema } from '../../video-editor';
|
|
@@ -37,6 +38,12 @@ export const ToolWithConfigSchema = z.discriminatedUnion('contentType', [
|
|
|
37
38
|
config: ImageEditorConfigSchema,
|
|
38
39
|
}),
|
|
39
40
|
),
|
|
41
|
+
ToolSchema.merge(
|
|
42
|
+
z.object({
|
|
43
|
+
contentType: z.literal(TOOL_CONTENT_TYPE.IMAGE_GENERATION),
|
|
44
|
+
config: ImageGenerationConfigSchema,
|
|
45
|
+
}),
|
|
46
|
+
),
|
|
40
47
|
ToolSchema.merge(
|
|
41
48
|
z.object({
|
|
42
49
|
contentType: z.literal(TOOL_CONTENT_TYPE.REPHRASE),
|