@purpleschool/gptbot-tools 0.0.89 → 0.0.91

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.
@@ -1238,6 +1238,16 @@ exports.ERRORS = {
1238
1238
  message: 'Превышено время ожидания генерации изображения',
1239
1239
  httpCode: 500,
1240
1240
  },
1241
+ IMAGE_ATTACHMENT_NOT_SUPPORTED: {
1242
+ code: 'IMAGE_GENERATION.IMAGE_ATTACHMENT_NOT_SUPPORTED',
1243
+ message: 'Выбранная модель не поддерживает вложение изображений',
1244
+ httpCode: 400,
1245
+ },
1246
+ TOO_MANY_ATTACHED_IMAGES: {
1247
+ code: 'IMAGE_GENERATION.TOO_MANY_ATTACHED_IMAGES',
1248
+ message: 'Слишком много вложенных изображений',
1249
+ httpCode: 400,
1250
+ },
1241
1251
  },
1242
1252
  IMAGE_GENERATION_MODEL: {
1243
1253
  SAVE_ERROR: {
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ImageGenerationJobSchema = void 0;
3
+ exports.ImageGenerationJobSchema = exports.ImageGenerationJobParamsSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const tools_1 = require("../../tools");
6
6
  const common_1 = require("../../common");
7
+ exports.ImageGenerationJobParamsSchema = zod_1.z.object({
8
+ aspectRatio: zod_1.z.string().optional(),
9
+ attachedImages: zod_1.z.string().array().optional(),
10
+ });
7
11
  exports.ImageGenerationJobSchema = zod_1.z.object({
8
12
  uuid: zod_1.z.string(),
9
13
  prompt: zod_1.z.string(),
@@ -13,8 +17,9 @@ exports.ImageGenerationJobSchema = zod_1.z.object({
13
17
  price: zod_1.z.number(),
14
18
  reaction: zod_1.z.nativeEnum(common_1.USER_REACTION).nullable(),
15
19
  externalId: zod_1.z.string().nullable(),
16
- params: zod_1.z.any(),
20
+ params: exports.ImageGenerationJobParamsSchema,
17
21
  output: zod_1.z.array(zod_1.z.string()),
22
+ presetId: zod_1.z.string().nullable().optional(),
18
23
  modelId: zod_1.z.string(),
19
24
  attempts: zod_1.z.array(zod_1.z.any()),
20
25
  userId: zod_1.z.string().nullable().optional(),
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ImageGenerationModelSchema = exports.ImageGenerationRequestParamsSchema = void 0;
3
+ exports.ImageGenerationModelSchema = exports.ImageGenerationModelParamsSchema = exports.ImageGenerationRequestParamsSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const common_1 = require("../../common");
6
6
  const enums_1 = require("../enums");
@@ -9,6 +9,13 @@ exports.ImageGenerationRequestParamsSchema = zod_1.z.object({
9
9
  attachedImages: zod_1.z.array(zod_1.z.string()),
10
10
  enhancePrompt: zod_1.z.boolean(),
11
11
  });
12
+ exports.ImageGenerationModelParamsSchema = zod_1.z.object({
13
+ aspectRatio: zod_1.z.record(zod_1.z.string(), zod_1.z.object({
14
+ width: zod_1.z.number(),
15
+ height: zod_1.z.number(),
16
+ })),
17
+ quality: zod_1.z.string().optional(),
18
+ });
12
19
  exports.ImageGenerationModelSchema = zod_1.z.object({
13
20
  uuid: zod_1.z.string(),
14
21
  title: zod_1.z.string(),
@@ -16,11 +23,13 @@ exports.ImageGenerationModelSchema = zod_1.z.object({
16
23
  aiModel: zod_1.z.string(),
17
24
  price: zod_1.z.number(),
18
25
  order: zod_1.z.number(),
19
- params: zod_1.z.any(),
26
+ params: exports.ImageGenerationModelParamsSchema,
20
27
  strategy: zod_1.z.nativeEnum(enums_1.IMAGE_GENERATION_MODEL_STRATEGY),
21
28
  status: zod_1.z.nativeEnum(common_1.TOOL_MODEL_STATUS),
22
29
  maxPromptLength: zod_1.z.number(),
23
30
  iconVariants: common_1.IconVariantsSchema,
31
+ supportsImageAttachment: zod_1.z.boolean(),
32
+ maxAttachedImages: zod_1.z.number(),
24
33
  createdAt: zod_1.z.date(),
25
34
  updatedAt: zod_1.z.date(),
26
35
  });
@@ -1248,6 +1248,16 @@ export const ERRORS = {
1248
1248
  message: 'Превышено время ожидания генерации изображения',
1249
1249
  httpCode: 500,
1250
1250
  },
1251
+ IMAGE_ATTACHMENT_NOT_SUPPORTED: {
1252
+ code: 'IMAGE_GENERATION.IMAGE_ATTACHMENT_NOT_SUPPORTED',
1253
+ message: 'Выбранная модель не поддерживает вложение изображений',
1254
+ httpCode: 400,
1255
+ },
1256
+ TOO_MANY_ATTACHED_IMAGES: {
1257
+ code: 'IMAGE_GENERATION.TOO_MANY_ATTACHED_IMAGES',
1258
+ message: 'Слишком много вложенных изображений',
1259
+ httpCode: 400,
1260
+ },
1251
1261
  },
1252
1262
  IMAGE_GENERATION_MODEL: {
1253
1263
  SAVE_ERROR: {
@@ -2,6 +2,12 @@ import { z } from 'zod';
2
2
  import { JOB_STATUS } from '../../tools';
3
3
  import { USER_REACTION } from '../../common';
4
4
 
5
+ export const ImageGenerationJobParamsSchema = z.object({
6
+ aspectRatio: z.string().optional(),
7
+ attachedImages: z.string().array().optional(),
8
+ });
9
+ export type ImageGenerationJobParams = z.infer<typeof ImageGenerationJobParamsSchema>;
10
+
5
11
  export const ImageGenerationJobSchema = z.object({
6
12
  uuid: z.string(),
7
13
  prompt: z.string(),
@@ -11,8 +17,9 @@ export const ImageGenerationJobSchema = z.object({
11
17
  price: z.number(),
12
18
  reaction: z.nativeEnum(USER_REACTION).nullable(),
13
19
  externalId: z.string().nullable(),
14
- params: z.any(),
20
+ params: ImageGenerationJobParamsSchema,
15
21
  output: z.array(z.string()),
22
+ presetId: z.string().nullable().optional(),
16
23
  modelId: z.string(),
17
24
  attempts: z.array(z.any()),
18
25
  userId: z.string().nullable().optional(),
@@ -9,6 +9,18 @@ export const ImageGenerationRequestParamsSchema = z.object({
9
9
  });
10
10
  export type ImageGenerationRequestParams = z.infer<typeof ImageGenerationRequestParamsSchema>;
11
11
 
12
+ export const ImageGenerationModelParamsSchema = z.object({
13
+ aspectRatio: z.record(
14
+ z.string(),
15
+ z.object({
16
+ width: z.number(),
17
+ height: z.number(),
18
+ }),
19
+ ),
20
+ quality: z.string().optional(),
21
+ });
22
+ export type ImageGenerationModelParams = z.infer<typeof ImageGenerationModelParamsSchema>;
23
+
12
24
  export const ImageGenerationModelSchema = z.object({
13
25
  uuid: z.string(),
14
26
  title: z.string(),
@@ -16,11 +28,13 @@ export const ImageGenerationModelSchema = z.object({
16
28
  aiModel: z.string(),
17
29
  price: z.number(),
18
30
  order: z.number(),
19
- params: z.any(),
31
+ params: ImageGenerationModelParamsSchema,
20
32
  strategy: z.nativeEnum(IMAGE_GENERATION_MODEL_STRATEGY),
21
33
  status: z.nativeEnum(TOOL_MODEL_STATUS),
22
34
  maxPromptLength: z.number(),
23
35
  iconVariants: IconVariantsSchema,
36
+ supportsImageAttachment: z.boolean(),
37
+ maxAttachedImages: z.number(),
24
38
  createdAt: z.date(),
25
39
  updatedAt: z.date(),
26
40
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot-tools",
3
- "version": "0.0.89",
3
+ "version": "0.0.91",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "scripts": {