@purpleschool/gptbot 0.13.15 → 0.13.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/controllers/http/agents/agent.ts +6 -0
- package/api/controllers/http/index.ts +1 -0
- package/api/controllers/http/photo-studio.ts +21 -0
- package/build/api/controllers/http/agents/agent.js +3 -0
- package/build/api/controllers/http/index.js +1 -0
- package/build/api/controllers/http/photo-studio.js +21 -0
- package/build/commands/agents/agent-dialog/get-cabinet-price-preview.command.js +26 -0
- package/build/commands/agents/agent-dialog/get-dialog-context-length.command.js +30 -0
- package/build/commands/agents/agent-dialog/index.js +3 -0
- package/build/commands/agents/agent-dialog/send-cabinet-message.command.js +4 -4
- package/build/commands/agents/agent-dialog/stop-cabinet-stream.command.js +15 -0
- package/build/commands/agents/agent-lead/find-agent-leads.command.js +2 -4
- package/build/commands/index.js +1 -0
- package/build/commands/photo-studio/add-photo-studio-checkpoint.command.js +17 -0
- package/build/commands/photo-studio/clear-photo-studio-checkpoints.command.js +12 -0
- package/build/commands/photo-studio/create-photo-studio-canvas.command.js +15 -0
- package/build/commands/photo-studio/delete-photo-studio-canvas.command.js +11 -0
- package/build/commands/photo-studio/delete-photo-studio-checkpoint.command.js +14 -0
- package/build/commands/photo-studio/execute-photo-studio-action.command.js +47 -0
- package/build/commands/photo-studio/find-photo-studio-canvas-by-uuid.query.js +12 -0
- package/build/commands/photo-studio/find-photo-studio-canvases.query.js +18 -0
- package/build/commands/photo-studio/find-photo-studio-checkpoints.query.js +12 -0
- package/build/commands/photo-studio/find-photo-studio-job-by-id.query.js +32 -0
- package/build/commands/photo-studio/find-photo-studio-jobs.query.js +18 -0
- package/build/commands/photo-studio/get-photo-studio-actions.query.js +11 -0
- package/build/commands/photo-studio/index.js +31 -0
- package/build/commands/photo-studio/save-photo-studio-canvas.command.js +18 -0
- package/build/commands/photo-studio/update-photo-studio-canvas.command.js +15 -0
- package/build/commands/photo-studio/update-photo-studio-checkpoint.command.js +19 -0
- package/build/constants/index.js +1 -0
- package/build/constants/photo-studio/enums/index.js +17 -0
- package/build/constants/photo-studio/enums/photo-studio-checkpoint-action-type.enum.js +11 -0
- package/build/constants/photo-studio/index.js +17 -0
- package/build/models/agents/index.js +1 -0
- package/build/models/agents/message-attachment.schema.js +21 -0
- package/build/models/file.schema.js +7 -1
- package/build/models/index.js +1 -0
- package/build/models/photo-studio/index.js +20 -0
- package/build/models/photo-studio/photo-studio-action.schema.js +17 -0
- package/build/models/photo-studio/photo-studio-checkpoint.schema.js +21 -0
- package/build/models/photo-studio/photo-studio-image-node.schema.js +19 -0
- package/build/models/photo-studio/photo-studio.schema.js +15 -0
- package/build/models/tools/image-generation/image-generation-job.schema.js +3 -0
- package/commands/agents/agent-dialog/get-cabinet-price-preview.command.ts +28 -0
- package/commands/agents/agent-dialog/get-dialog-context-length.command.ts +33 -0
- package/commands/agents/agent-dialog/index.ts +3 -0
- package/commands/agents/agent-dialog/send-cabinet-message.command.ts +18 -10
- package/commands/agents/agent-dialog/stop-cabinet-stream.command.ts +15 -0
- package/commands/agents/agent-lead/find-agent-leads.command.ts +2 -4
- package/commands/index.ts +1 -0
- package/commands/photo-studio/add-photo-studio-checkpoint.command.ts +23 -0
- package/commands/photo-studio/clear-photo-studio-checkpoints.command.ts +12 -0
- package/commands/photo-studio/create-photo-studio-canvas.command.ts +16 -0
- package/commands/photo-studio/delete-photo-studio-canvas.command.ts +11 -0
- package/commands/photo-studio/delete-photo-studio-checkpoint.command.ts +14 -0
- package/commands/photo-studio/execute-photo-studio-action.command.ts +49 -0
- package/commands/photo-studio/find-photo-studio-canvas-by-uuid.query.ts +12 -0
- package/commands/photo-studio/find-photo-studio-canvases.query.ts +20 -0
- package/commands/photo-studio/find-photo-studio-checkpoints.query.ts +12 -0
- package/commands/photo-studio/find-photo-studio-job-by-id.query.ts +36 -0
- package/commands/photo-studio/find-photo-studio-jobs.query.ts +20 -0
- package/commands/photo-studio/get-photo-studio-actions.query.ts +10 -0
- package/commands/photo-studio/index.ts +15 -0
- package/commands/photo-studio/save-photo-studio-canvas.command.ts +24 -0
- package/commands/photo-studio/update-photo-studio-canvas.command.ts +17 -0
- package/commands/photo-studio/update-photo-studio-checkpoint.command.ts +25 -0
- package/constants/index.ts +1 -0
- package/constants/photo-studio/enums/index.ts +1 -0
- package/constants/photo-studio/enums/photo-studio-checkpoint-action-type.enum.ts +7 -0
- package/constants/photo-studio/index.ts +1 -0
- package/models/agents/index.ts +1 -0
- package/models/agents/message-attachment.schema.ts +22 -0
- package/models/file.schema.ts +8 -0
- package/models/index.ts +1 -0
- package/models/photo-studio/index.ts +4 -0
- package/models/photo-studio/photo-studio-action.schema.ts +18 -0
- package/models/photo-studio/photo-studio-checkpoint.schema.ts +22 -0
- package/models/photo-studio/photo-studio-image-node.schema.ts +22 -0
- package/models/photo-studio/photo-studio.schema.ts +16 -0
- package/models/tools/image-generation/image-generation-job.schema.ts +3 -0
- package/package.json +1 -1
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FileSchema = void 0;
|
|
3
|
+
exports.FileSchema = exports.FileResolutionSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
|
+
exports.FileResolutionSchema = zod_1.z.object({
|
|
7
|
+
width: zod_1.z.number().int().positive(),
|
|
8
|
+
height: zod_1.z.number().int().positive(),
|
|
9
|
+
});
|
|
6
10
|
exports.FileSchema = zod_1.z.object({
|
|
7
11
|
uuid: zod_1.z.string().uuid(),
|
|
8
12
|
name: zod_1.z.string(),
|
|
9
13
|
size: zod_1.z.number(),
|
|
14
|
+
originalName: zod_1.z.string().nullable().optional(),
|
|
15
|
+
resolution: exports.FileResolutionSchema.nullable().optional(),
|
|
10
16
|
mimeType: zod_1.z.string(),
|
|
11
17
|
url: zod_1.z.string(),
|
|
12
18
|
key: zod_1.z.string(),
|
package/build/models/index.js
CHANGED
|
@@ -38,6 +38,7 @@ __exportStar(require("./file.schema"), exports);
|
|
|
38
38
|
__exportStar(require("./key-value.schema"), exports);
|
|
39
39
|
__exportStar(require("./form-submission.schema"), exports);
|
|
40
40
|
__exportStar(require("./icon-variants.schema"), exports);
|
|
41
|
+
__exportStar(require("./photo-studio"), exports);
|
|
41
42
|
__exportStar(require("./lesson.schema"), exports);
|
|
42
43
|
__exportStar(require("./lesson-translation.schema"), exports);
|
|
43
44
|
__exportStar(require("./message.schema"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
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("./photo-studio-action.schema"), exports);
|
|
18
|
+
__exportStar(require("./photo-studio-checkpoint.schema"), exports);
|
|
19
|
+
__exportStar(require("./photo-studio-image-node.schema"), exports);
|
|
20
|
+
__exportStar(require("./photo-studio.schema"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PhotoStudioActionSchema = exports.PhotoStudioImageSettingsSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.PhotoStudioImageSettingsSchema = zod_1.z.object({
|
|
6
|
+
minImages: zod_1.z.number().int().min(0),
|
|
7
|
+
maxImages: zod_1.z.number().int().min(1),
|
|
8
|
+
});
|
|
9
|
+
exports.PhotoStudioActionSchema = zod_1.z.object({
|
|
10
|
+
alias: zod_1.z.string().min(1),
|
|
11
|
+
title: zod_1.z.string().min(1),
|
|
12
|
+
icon: zod_1.z.string().min(1),
|
|
13
|
+
allowUserPrompt: zod_1.z.boolean(),
|
|
14
|
+
systemPrompt: zod_1.z.string().nullable(),
|
|
15
|
+
imageSettings: exports.PhotoStudioImageSettingsSchema,
|
|
16
|
+
params: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).default({}),
|
|
17
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PhotoStudioCheckpointSchema = exports.PhotoStudioCheckpointActionSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
const photo_studio_image_node_schema_1 = require("./photo-studio-image-node.schema");
|
|
7
|
+
exports.PhotoStudioCheckpointActionSchema = zod_1.z.object({
|
|
8
|
+
type: zod_1.z.nativeEnum(constants_1.PHOTO_STUDIO_CHECKPOINT_ACTION_TYPE),
|
|
9
|
+
actionAlias: zod_1.z.string().nullable().optional(),
|
|
10
|
+
title: zod_1.z.string().nullable().optional(),
|
|
11
|
+
params: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).nullable().optional(),
|
|
12
|
+
});
|
|
13
|
+
exports.PhotoStudioCheckpointSchema = zod_1.z.object({
|
|
14
|
+
uuid: zod_1.z.string().uuid(),
|
|
15
|
+
canvasId: zod_1.z.string().uuid(),
|
|
16
|
+
sequence: zod_1.z.number().int().positive(),
|
|
17
|
+
action: exports.PhotoStudioCheckpointActionSchema,
|
|
18
|
+
images: zod_1.z.array(photo_studio_image_node_schema_1.PhotoStudioImageNodeSchema),
|
|
19
|
+
createdAt: zod_1.z.date(),
|
|
20
|
+
updatedAt: zod_1.z.date(),
|
|
21
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PhotoStudioImageInputSchema = exports.PhotoStudioImageNodeSchema = exports.PhotoStudioImageResolutionSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const canvas_node_schema_1 = require("../canvas-node.schema");
|
|
6
|
+
const file_schema_1 = require("../file.schema");
|
|
7
|
+
exports.PhotoStudioImageResolutionSchema = file_schema_1.FileResolutionSchema;
|
|
8
|
+
exports.PhotoStudioImageNodeSchema = zod_1.z.object({
|
|
9
|
+
uuid: zod_1.z.string().uuid(),
|
|
10
|
+
fileId: zod_1.z.string().uuid(),
|
|
11
|
+
url: zod_1.z.string().url(),
|
|
12
|
+
originalName: zod_1.z.string().nullable().optional(),
|
|
13
|
+
resolution: exports.PhotoStudioImageResolutionSchema.nullable().optional(),
|
|
14
|
+
position: canvas_node_schema_1.CanvasNodePositionSchema,
|
|
15
|
+
});
|
|
16
|
+
exports.PhotoStudioImageInputSchema = zod_1.z.object({
|
|
17
|
+
fileId: zod_1.z.string().uuid(),
|
|
18
|
+
position: canvas_node_schema_1.CanvasNodePositionSchema,
|
|
19
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PhotoStudioCanvasWithImagesSchema = exports.PhotoStudioCanvasSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const photo_studio_image_node_schema_1 = require("./photo-studio-image-node.schema");
|
|
6
|
+
exports.PhotoStudioCanvasSchema = zod_1.z.object({
|
|
7
|
+
uuid: zod_1.z.string().uuid(),
|
|
8
|
+
name: zod_1.z.string(),
|
|
9
|
+
userId: zod_1.z.string().uuid(),
|
|
10
|
+
createdAt: zod_1.z.date(),
|
|
11
|
+
updatedAt: zod_1.z.date(),
|
|
12
|
+
});
|
|
13
|
+
exports.PhotoStudioCanvasWithImagesSchema = exports.PhotoStudioCanvasSchema.extend({
|
|
14
|
+
images: zod_1.z.array(photo_studio_image_node_schema_1.PhotoStudioImageNodeSchema),
|
|
15
|
+
});
|
|
@@ -4,6 +4,7 @@ exports.ImageGenerationJobSchema = exports.ImageGenerationJobParamsSchema = expo
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const tool_job_schema_1 = require("../../tool-job.schema");
|
|
6
6
|
const constants_1 = require("../../../constants");
|
|
7
|
+
const file_schema_1 = require("../../file.schema");
|
|
7
8
|
exports.ImageGenerationFileAttachmentSchema = zod_1.z.object({
|
|
8
9
|
uuid: zod_1.z.string(),
|
|
9
10
|
url: zod_1.z.string(),
|
|
@@ -28,6 +29,8 @@ exports.ImageGenerationJobSchema = tool_job_schema_1.ToolJobSchema.extend({
|
|
|
28
29
|
.array(zod_1.z.object({
|
|
29
30
|
uuid: zod_1.z.string(),
|
|
30
31
|
url: zod_1.z.string(),
|
|
32
|
+
originalName: zod_1.z.string().nullable().optional(),
|
|
33
|
+
resolution: file_schema_1.FileResolutionSchema.nullable().optional(),
|
|
31
34
|
}))
|
|
32
35
|
.nullable(),
|
|
33
36
|
params: exports.ImageGenerationJobParamsSchema.optional(),
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace GetCabinetPricePreviewCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
agentId: z.string().uuid(),
|
|
6
|
+
dialogId: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
9
|
+
|
|
10
|
+
export const RequestBodySchema = z.object({
|
|
11
|
+
inputLength: z.number().int().min(0),
|
|
12
|
+
fileIds: z.array(z.string().uuid()).optional(),
|
|
13
|
+
useWebSearch: z.boolean().optional(),
|
|
14
|
+
});
|
|
15
|
+
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
16
|
+
|
|
17
|
+
export const ResponseSchema = z.object({
|
|
18
|
+
data: z.object({
|
|
19
|
+
price: z.number().int().min(0),
|
|
20
|
+
breakdown: z.object({
|
|
21
|
+
textCost: z.number().int().min(0),
|
|
22
|
+
attachmentsCost: z.number().int().min(0),
|
|
23
|
+
webSearchCost: z.number().int().min(0),
|
|
24
|
+
}),
|
|
25
|
+
}),
|
|
26
|
+
});
|
|
27
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MessageAttachmentTypeEnum } from '../../../models/agents/message-attachment.schema';
|
|
3
|
+
|
|
4
|
+
export namespace GetDialogContextLengthCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
teamAccountId: z.string().uuid(),
|
|
7
|
+
dialogId: z.string().uuid(),
|
|
8
|
+
inputLength: z.number().int().min(0),
|
|
9
|
+
attachments: z
|
|
10
|
+
.array(
|
|
11
|
+
z.object({
|
|
12
|
+
type: MessageAttachmentTypeEnum,
|
|
13
|
+
contentLength: z.number().int().optional(),
|
|
14
|
+
}),
|
|
15
|
+
)
|
|
16
|
+
.default([]),
|
|
17
|
+
});
|
|
18
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
19
|
+
|
|
20
|
+
export const ResponseSchema = z.object({
|
|
21
|
+
isSuccess: z.literal(true),
|
|
22
|
+
data: z.object({
|
|
23
|
+
historyChars: z.number().int().min(0),
|
|
24
|
+
totalInputChars: z.number().int().min(0),
|
|
25
|
+
modelPricing: z.object({
|
|
26
|
+
inputPrice: z.number(),
|
|
27
|
+
outputPrice: z.number(),
|
|
28
|
+
}),
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
32
|
+
export type ResponseData = z.infer<typeof ResponseSchema>['data'];
|
|
33
|
+
}
|
|
@@ -5,3 +5,6 @@ export * from './clear-agent-dialog-history.command';
|
|
|
5
5
|
export * from './send-agent-dialog-admin-reply.command';
|
|
6
6
|
export * from './start-cabinet-dialog.command';
|
|
7
7
|
export * from './send-cabinet-message.command';
|
|
8
|
+
export * from './get-dialog-context-length.command';
|
|
9
|
+
export * from './get-cabinet-price-preview.command';
|
|
10
|
+
export * from './stop-cabinet-stream.command';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { MessageAttachmentInputSchema } from '../../../models/agents/message-attachment.schema';
|
|
2
3
|
|
|
3
4
|
export namespace SendCabinetMessageCommand {
|
|
4
5
|
export const RequestParamsSchema = z.object({
|
|
@@ -10,17 +11,13 @@ export namespace SendCabinetMessageCommand {
|
|
|
10
11
|
export const RequestBodySchema = z
|
|
11
12
|
.object({
|
|
12
13
|
text: z.string().optional(),
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
fileIds: z.array(z.string().uuid()).optional(),
|
|
15
|
+
useWebSearch: z.boolean().optional(),
|
|
15
16
|
})
|
|
16
|
-
.refine(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
message: 'Message must contain text, images, or attachments',
|
|
21
|
-
path: ['text'],
|
|
22
|
-
},
|
|
23
|
-
);
|
|
17
|
+
.refine((data) => data.text || (data.fileIds?.length ?? 0) > 0, {
|
|
18
|
+
message: 'Message must contain text or file attachments',
|
|
19
|
+
path: ['text'],
|
|
20
|
+
});
|
|
24
21
|
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
25
22
|
|
|
26
23
|
export const ResponseSchema = z.object({
|
|
@@ -31,4 +28,15 @@ export namespace SendCabinetMessageCommand {
|
|
|
31
28
|
}),
|
|
32
29
|
});
|
|
33
30
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
31
|
+
|
|
32
|
+
// RMQ payload sent to rugpt-agents (new format with resolved attachments)
|
|
33
|
+
export type RmqRequest = {
|
|
34
|
+
teamAccountId: string;
|
|
35
|
+
userId: string;
|
|
36
|
+
teamMemberRole?: string;
|
|
37
|
+
dialogId: string;
|
|
38
|
+
text?: string;
|
|
39
|
+
attachments: z.infer<typeof MessageAttachmentInputSchema>[];
|
|
40
|
+
useWebSearch?: boolean;
|
|
41
|
+
};
|
|
34
42
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace StopCabinetStreamCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
agentId: z.string().uuid(),
|
|
6
|
+
dialogId: z.string().uuid(),
|
|
7
|
+
messageId: z.string().uuid(),
|
|
8
|
+
});
|
|
9
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
stopped: z.boolean(),
|
|
13
|
+
});
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { AgentLeadSchema } from '../../../models/agents/agent-lead.schema';
|
|
3
3
|
|
|
4
4
|
export namespace FindAgentLeadsCommand {
|
|
5
5
|
export const RequestQuerySchema = z.object({
|
|
6
6
|
dialogId: z.string().uuid().optional(),
|
|
7
|
-
limit: z.coerce.number().optional(),
|
|
8
|
-
offset: z.coerce.number().optional(),
|
|
9
7
|
});
|
|
10
8
|
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
11
9
|
|
|
12
10
|
export const ResponseSchema = z.object({
|
|
13
|
-
data:
|
|
11
|
+
data: z.array(AgentLeadSchema),
|
|
14
12
|
});
|
|
15
13
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
14
|
}
|
package/commands/index.ts
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
PhotoStudioCheckpointActionSchema,
|
|
4
|
+
PhotoStudioCheckpointSchema,
|
|
5
|
+
PhotoStudioImageInputSchema,
|
|
6
|
+
} from '../../models';
|
|
7
|
+
|
|
8
|
+
export namespace AddPhotoStudioCheckpointCommand {
|
|
9
|
+
export const RequestParamSchema = z.object({ canvasId: z.string().uuid() });
|
|
10
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
11
|
+
|
|
12
|
+
export const RequestSchema = z.object({
|
|
13
|
+
action: PhotoStudioCheckpointActionSchema,
|
|
14
|
+
images: z.array(PhotoStudioImageInputSchema).optional(),
|
|
15
|
+
baseCheckpointSequence: z.number().int().positive().optional(),
|
|
16
|
+
});
|
|
17
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
18
|
+
|
|
19
|
+
export const ResponseSchema = z.object({
|
|
20
|
+
data: PhotoStudioCheckpointSchema,
|
|
21
|
+
});
|
|
22
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PhotoStudioCheckpointSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace ClearPhotoStudioCheckpointsCommand {
|
|
5
|
+
export const RequestParamSchema = z.object({ canvasId: z.string().uuid() });
|
|
6
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
7
|
+
|
|
8
|
+
export const ResponseSchema = z.object({
|
|
9
|
+
data: z.array(PhotoStudioCheckpointSchema),
|
|
10
|
+
});
|
|
11
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PhotoStudioCanvasWithImagesSchema, PhotoStudioImageInputSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace CreatePhotoStudioCanvasCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
name: z.string().trim().min(1).optional(),
|
|
7
|
+
images: z.array(PhotoStudioImageInputSchema).default([]).optional(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
11
|
+
|
|
12
|
+
export const ResponseSchema = z.object({
|
|
13
|
+
data: PhotoStudioCanvasWithImagesSchema,
|
|
14
|
+
});
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace DeletePhotoStudioCanvasCommand {
|
|
4
|
+
export const RequestParamSchema = z.object({ uuid: z.string().uuid() });
|
|
5
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
6
|
+
|
|
7
|
+
export const ResponseSchema = z.object({
|
|
8
|
+
data: z.object({ isDeleted: z.boolean() }),
|
|
9
|
+
});
|
|
10
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace DeletePhotoStudioCheckpointCommand {
|
|
4
|
+
export const RequestParamSchema = z.object({
|
|
5
|
+
canvasId: z.string().uuid(),
|
|
6
|
+
checkpointId: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
data: z.object({ isDeleted: z.boolean() }),
|
|
12
|
+
});
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TOOL_CONTENT_TYPE } from '../../constants';
|
|
3
|
+
import { IMAGE_GENERATION_RESOLUTION } from '../../constants/tool-image-generation/enums/image-generation-resolution.enum';
|
|
4
|
+
import { CanvasNodePositionSchema, ToolJobSchema } from '../../models';
|
|
5
|
+
|
|
6
|
+
export namespace ExecutePhotoStudioActionCommand {
|
|
7
|
+
export const RequestSchema = z.object({
|
|
8
|
+
actionAlias: z.string().min(1),
|
|
9
|
+
modelId: z.string().uuid(),
|
|
10
|
+
prompt: z.string().optional(),
|
|
11
|
+
params: z
|
|
12
|
+
.object({
|
|
13
|
+
imageUrls: z.array(z.string().uuid()).optional(),
|
|
14
|
+
enhancePrompt: z.boolean().optional(),
|
|
15
|
+
resolution: z.nativeEnum(IMAGE_GENERATION_RESOLUTION).optional(),
|
|
16
|
+
aspectRatio: z.string().optional(),
|
|
17
|
+
effect: z.string().optional(),
|
|
18
|
+
size: z.enum(['2x', '4x', '8x']).optional(),
|
|
19
|
+
variationsCount: z.union([z.literal(2), z.literal(3), z.literal(4)]).optional(),
|
|
20
|
+
variationStrength: z.enum(['light', 'medium', 'high']).optional(),
|
|
21
|
+
fontStyle: z
|
|
22
|
+
.enum([
|
|
23
|
+
'calligraphy',
|
|
24
|
+
'handwritten',
|
|
25
|
+
'elegant',
|
|
26
|
+
'decorative',
|
|
27
|
+
'poster',
|
|
28
|
+
'engraving',
|
|
29
|
+
])
|
|
30
|
+
.optional(),
|
|
31
|
+
placement: z.enum(['top', 'center', 'bottom']).optional(),
|
|
32
|
+
color: z.string().optional(),
|
|
33
|
+
})
|
|
34
|
+
.default({}),
|
|
35
|
+
position: CanvasNodePositionSchema,
|
|
36
|
+
baseCheckpointSequence: z.number().int().positive().optional(),
|
|
37
|
+
});
|
|
38
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
39
|
+
|
|
40
|
+
export const PhotoStudioExecuteJobSchema = ToolJobSchema.extend({
|
|
41
|
+
toolType: z.nativeEnum(TOOL_CONTENT_TYPE),
|
|
42
|
+
});
|
|
43
|
+
export type PhotoStudioExecuteJob = z.infer<typeof PhotoStudioExecuteJobSchema>;
|
|
44
|
+
|
|
45
|
+
export const ResponseSchema = z.object({
|
|
46
|
+
data: z.array(PhotoStudioExecuteJobSchema),
|
|
47
|
+
});
|
|
48
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PhotoStudioCanvasWithImagesSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace FindPhotoStudioCanvasByUuidQuery {
|
|
5
|
+
export const RequestParamSchema = z.object({ uuid: z.string().uuid() });
|
|
6
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
7
|
+
|
|
8
|
+
export const ResponseSchema = z.object({
|
|
9
|
+
data: PhotoStudioCanvasWithImagesSchema,
|
|
10
|
+
});
|
|
11
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PhotoStudioCanvasSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace FindPhotoStudioCanvasesQuery {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
limit: z.coerce.number().int().min(1).default(20).optional(),
|
|
7
|
+
offset: z.coerce.number().int().min(0).default(0).optional(),
|
|
8
|
+
name: z.string().optional(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = z.object({
|
|
14
|
+
data: z.array(PhotoStudioCanvasSchema.extend({ countOfImages: z.number() })),
|
|
15
|
+
page: z.number(),
|
|
16
|
+
totalPages: z.number(),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PhotoStudioCheckpointSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace FindPhotoStudioCheckpointsQuery {
|
|
5
|
+
export const RequestParamSchema = z.object({ canvasId: z.string().uuid() });
|
|
6
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
7
|
+
|
|
8
|
+
export const ResponseSchema = z.object({
|
|
9
|
+
data: z.array(PhotoStudioCheckpointSchema),
|
|
10
|
+
});
|
|
11
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TOOL_CONTENT_TYPE, TOOL_JOB_STATUS } from '../../constants';
|
|
3
|
+
import { CanvasNodePositionSchema, FileResolutionSchema } from '../../models';
|
|
4
|
+
|
|
5
|
+
export namespace FindPhotoStudioJobByIdQuery {
|
|
6
|
+
export const RequestParamSchema = z.object({
|
|
7
|
+
canvasId: z.string().uuid(),
|
|
8
|
+
jobId: z.string().uuid(),
|
|
9
|
+
});
|
|
10
|
+
export type RequestParams = z.infer<typeof RequestParamSchema>;
|
|
11
|
+
|
|
12
|
+
export const PhotoStudioJobImageSchema = z.object({
|
|
13
|
+
fileId: z.string().uuid(),
|
|
14
|
+
url: z.string(),
|
|
15
|
+
originalName: z.string().nullable().optional(),
|
|
16
|
+
resolution: FileResolutionSchema.nullable().optional(),
|
|
17
|
+
});
|
|
18
|
+
export type PhotoStudioJobImage = z.infer<typeof PhotoStudioJobImageSchema>;
|
|
19
|
+
|
|
20
|
+
export const PhotoStudioJobSchema = z.object({
|
|
21
|
+
jobId: z.string().uuid(),
|
|
22
|
+
toolType: z.nativeEnum(TOOL_CONTENT_TYPE),
|
|
23
|
+
status: z.nativeEnum(TOOL_JOB_STATUS),
|
|
24
|
+
position: CanvasNodePositionSchema,
|
|
25
|
+
images: z.array(PhotoStudioJobImageSchema),
|
|
26
|
+
error: z.string().nullable(),
|
|
27
|
+
createdAt: z.date(),
|
|
28
|
+
updatedAt: z.date(),
|
|
29
|
+
});
|
|
30
|
+
export type PhotoStudioJob = z.infer<typeof PhotoStudioJobSchema>;
|
|
31
|
+
|
|
32
|
+
export const ResponseSchema = z.object({
|
|
33
|
+
data: PhotoStudioJobSchema,
|
|
34
|
+
});
|
|
35
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TOOL_JOB_STATUS } from '../../constants';
|
|
3
|
+
import { FindPhotoStudioJobByIdQuery } from './find-photo-studio-job-by-id.query';
|
|
4
|
+
|
|
5
|
+
export namespace FindPhotoStudioJobsQuery {
|
|
6
|
+
export const RequestParamSchema = z.object({
|
|
7
|
+
canvasId: z.string().uuid(),
|
|
8
|
+
});
|
|
9
|
+
export type RequestParams = z.infer<typeof RequestParamSchema>;
|
|
10
|
+
|
|
11
|
+
export const RequestQuerySchema = z.object({
|
|
12
|
+
status: z.nativeEnum(TOOL_JOB_STATUS).optional(),
|
|
13
|
+
});
|
|
14
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
15
|
+
|
|
16
|
+
export const ResponseSchema = z.object({
|
|
17
|
+
data: z.array(FindPhotoStudioJobByIdQuery.PhotoStudioJobSchema),
|
|
18
|
+
});
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PhotoStudioActionSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace GetPhotoStudioActionsQuery {
|
|
5
|
+
export const ResponseSchema = z.object({
|
|
6
|
+
data: z.array(PhotoStudioActionSchema),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './add-photo-studio-checkpoint.command';
|
|
2
|
+
export * from './clear-photo-studio-checkpoints.command';
|
|
3
|
+
export * from './create-photo-studio-canvas.command';
|
|
4
|
+
export * from './delete-photo-studio-canvas.command';
|
|
5
|
+
export * from './delete-photo-studio-checkpoint.command';
|
|
6
|
+
export * from './execute-photo-studio-action.command';
|
|
7
|
+
export * from './find-photo-studio-canvas-by-uuid.query';
|
|
8
|
+
export * from './find-photo-studio-canvases.query';
|
|
9
|
+
export * from './find-photo-studio-checkpoints.query';
|
|
10
|
+
export * from './find-photo-studio-job-by-id.query';
|
|
11
|
+
export * from './find-photo-studio-jobs.query';
|
|
12
|
+
export * from './get-photo-studio-actions.query';
|
|
13
|
+
export * from './save-photo-studio-canvas.command';
|
|
14
|
+
export * from './update-photo-studio-canvas.command';
|
|
15
|
+
export * from './update-photo-studio-checkpoint.command';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
PhotoStudioCanvasWithImagesSchema,
|
|
4
|
+
PhotoStudioCheckpointActionSchema,
|
|
5
|
+
PhotoStudioImageInputSchema,
|
|
6
|
+
} from '../../models';
|
|
7
|
+
|
|
8
|
+
export namespace SavePhotoStudioCanvasCommand {
|
|
9
|
+
export const RequestParamSchema = z.object({ uuid: z.string().uuid() });
|
|
10
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
11
|
+
|
|
12
|
+
export const RequestSchema = z.object({
|
|
13
|
+
updatedAt: z.coerce.date().optional(),
|
|
14
|
+
images: z.array(PhotoStudioImageInputSchema),
|
|
15
|
+
action: PhotoStudioCheckpointActionSchema.optional(),
|
|
16
|
+
baseCheckpointSequence: z.number().int().positive().optional(),
|
|
17
|
+
});
|
|
18
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
19
|
+
|
|
20
|
+
export const ResponseSchema = z.object({
|
|
21
|
+
data: PhotoStudioCanvasWithImagesSchema,
|
|
22
|
+
});
|
|
23
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PhotoStudioCanvasWithImagesSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace UpdatePhotoStudioCanvasCommand {
|
|
5
|
+
export const RequestParamSchema = z.object({ uuid: z.string().uuid() });
|
|
6
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
7
|
+
|
|
8
|
+
export const RequestSchema = z.object({
|
|
9
|
+
name: z.string().trim().min(1),
|
|
10
|
+
});
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = z.object({
|
|
14
|
+
data: PhotoStudioCanvasWithImagesSchema,
|
|
15
|
+
});
|
|
16
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
PhotoStudioCheckpointActionSchema,
|
|
4
|
+
PhotoStudioCheckpointSchema,
|
|
5
|
+
PhotoStudioImageInputSchema,
|
|
6
|
+
} from '../../models';
|
|
7
|
+
|
|
8
|
+
export namespace UpdatePhotoStudioCheckpointCommand {
|
|
9
|
+
export const RequestParamSchema = z.object({
|
|
10
|
+
canvasId: z.string().uuid(),
|
|
11
|
+
checkpointId: z.string().uuid(),
|
|
12
|
+
});
|
|
13
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
14
|
+
|
|
15
|
+
export const RequestSchema = z.object({
|
|
16
|
+
action: PhotoStudioCheckpointActionSchema.optional(),
|
|
17
|
+
images: z.array(PhotoStudioImageInputSchema).optional(),
|
|
18
|
+
});
|
|
19
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
20
|
+
|
|
21
|
+
export const ResponseSchema = z.object({
|
|
22
|
+
data: PhotoStudioCheckpointSchema,
|
|
23
|
+
});
|
|
24
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
25
|
+
}
|