@purpleschool/gptbot 0.8.69 → 0.8.70

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.
@@ -5,6 +5,7 @@ export const B2B_ROUTES = {
5
5
  REFRESH_API_TOKEN: 'token/refresh',
6
6
  SEND_TEXT_REQUEST: 'completions',
7
7
  SEND_IMAGE_REQUEST: 'image/generation',
8
+ GET_B2B_IMAGE_JOB: (uuid: string) => `image/generation/jobs/${uuid}`,
8
9
  FILE_UPLOAD: 'file/upload',
9
10
  BALANCE_TOP_UP: 'balance/top-up',
10
11
  } as const;
package/api/routes.ts CHANGED
@@ -856,6 +856,8 @@ export const REST_API = {
856
856
  REFRESH_API_TOKEN: `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.REFRESH_API_TOKEN}`,
857
857
  SEND_TEXT_REQUEST: `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.SEND_TEXT_REQUEST}`,
858
858
  SEND_IMAGE_REQUEST: `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.SEND_IMAGE_REQUEST}`,
859
+ GET_B2B_IMAGE_JOB: (uuid: string) =>
860
+ `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.GET_B2B_IMAGE_JOB(uuid)}`,
859
861
  FILE_UPLOAD: `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.FILE_UPLOAD}`,
860
862
  BALANCE_TOP_UP: `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.BALANCE_TOP_UP}`,
861
863
  },
@@ -7,6 +7,7 @@ exports.B2B_ROUTES = {
7
7
  REFRESH_API_TOKEN: 'token/refresh',
8
8
  SEND_TEXT_REQUEST: 'completions',
9
9
  SEND_IMAGE_REQUEST: 'image/generation',
10
+ GET_B2B_IMAGE_JOB: (uuid) => `image/generation/jobs/${uuid}`,
10
11
  FILE_UPLOAD: 'file/upload',
11
12
  BALANCE_TOP_UP: 'balance/top-up',
12
13
  };
@@ -662,6 +662,7 @@ exports.REST_API = {
662
662
  REFRESH_API_TOKEN: `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.REFRESH_API_TOKEN}`,
663
663
  SEND_TEXT_REQUEST: `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.SEND_TEXT_REQUEST}`,
664
664
  SEND_IMAGE_REQUEST: `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.SEND_IMAGE_REQUEST}`,
665
+ GET_B2B_IMAGE_JOB: (uuid) => `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.GET_B2B_IMAGE_JOB(uuid)}`,
665
666
  FILE_UPLOAD: `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.FILE_UPLOAD}`,
666
667
  BALANCE_TOP_UP: `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.BALANCE_TOP_UP}`,
667
668
  },
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindB2bImageGenerationJobByUUIDCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("../../constants");
6
+ var FindB2bImageGenerationJobByUUIDCommand;
7
+ (function (FindB2bImageGenerationJobByUUIDCommand) {
8
+ FindB2bImageGenerationJobByUUIDCommand.RequestParamsSchema = zod_1.z.object({
9
+ uuid: zod_1.z.string().uuid(),
10
+ });
11
+ FindB2bImageGenerationJobByUUIDCommand.ResponseSchema = zod_1.z.object({
12
+ data: zod_1.z.object({
13
+ urls: zod_1.z.array(zod_1.z.string()).nullable(),
14
+ status: zod_1.z.nativeEnum(constants_1.TOOL_JOB_STATUS),
15
+ price: zod_1.z.number().nullable(),
16
+ error: zod_1.z.string().nullable(),
17
+ }),
18
+ });
19
+ })(FindB2bImageGenerationJobByUUIDCommand || (exports.FindB2bImageGenerationJobByUUIDCommand = FindB2bImageGenerationJobByUUIDCommand = {}));
@@ -19,3 +19,4 @@ __exportStar(require("./refresh-api-key.command"), exports);
19
19
  __exportStar(require("./send-text-request.command"), exports);
20
20
  __exportStar(require("./send-image-request.command"), exports);
21
21
  __exportStar(require("./submit-balance-top-up-form.command"), exports);
22
+ __exportStar(require("./find-b2b-image-generation-job-by-uuid.command"), exports);
@@ -3,22 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SendImageRequestCommand = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const constants_1 = require("../../constants");
6
+ const models_1 = require("../../models");
6
7
  var SendImageRequestCommand;
7
8
  (function (SendImageRequestCommand) {
8
9
  SendImageRequestCommand.RequestSchema = zod_1.z.object({
9
10
  model: zod_1.z.string(),
10
11
  prompt: zod_1.z.string(),
11
- params: zod_1.z.array(zod_1.z.object({
12
- type: zod_1.z.nativeEnum(constants_1.AI_MODEL_CONFIG_PARAM),
13
- option: zod_1.z.string().uuid(),
14
- })),
15
- refinePrompt: zod_1.z.boolean().default(false),
16
- features: zod_1.z.array(zod_1.z.nativeEnum(constants_1.AI_MODEL_FEATURE)).optional().default([]),
17
- files: zod_1.z.array(zod_1.z.string().uuid()).optional().default([]),
12
+ params: zod_1.z.object({
13
+ aspectRatio: zod_1.z.string(),
14
+ attachedFiles: zod_1.z.string().array(),
15
+ enhancePrompt: zod_1.z.boolean(),
16
+ resolution: zod_1.z.nativeEnum(constants_1.IMAGE_GENERATION_RESOLUTION).optional(),
17
+ }),
18
18
  });
19
19
  SendImageRequestCommand.ResponseSchema = zod_1.z.object({
20
- data: zod_1.z.object({
21
- urls: zod_1.z.array(zod_1.z.string()),
20
+ data: models_1.ToolJobSchema.pick({
21
+ uuid: true,
22
+ status: true,
23
+ error: true,
22
24
  }),
23
25
  });
24
26
  })(SendImageRequestCommand || (exports.SendImageRequestCommand = SendImageRequestCommand = {}));
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./tool-content-type.enum"), exports);
18
18
  __exportStar(require("./tool-job-status.enum"), exports);
19
19
  __exportStar(require("./tool-type.enum"), exports);
20
+ __exportStar(require("./job-request-origin.enum"), exports);
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JOB_REQUEST_ORIGIN = void 0;
4
+ var JOB_REQUEST_ORIGIN;
5
+ (function (JOB_REQUEST_ORIGIN) {
6
+ JOB_REQUEST_ORIGIN["API"] = "api";
7
+ JOB_REQUEST_ORIGIN["B2B"] = "b2b";
8
+ })(JOB_REQUEST_ORIGIN || (exports.JOB_REQUEST_ORIGIN = JOB_REQUEST_ORIGIN = {}));
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { TOOL_JOB_STATUS } from '../../constants';
3
+
4
+ export namespace FindB2bImageGenerationJobByUUIDCommand {
5
+ export const RequestParamsSchema = z.object({
6
+ uuid: z.string().uuid(),
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestParamsSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: z.object({
13
+ urls: z.array(z.string()).nullable(),
14
+ status: z.nativeEnum(TOOL_JOB_STATUS),
15
+ price: z.number().nullable(),
16
+ error: z.string().nullable(),
17
+ }),
18
+ });
19
+
20
+ export type Response = z.infer<typeof ResponseSchema>;
21
+ }
@@ -3,3 +3,4 @@ export * from './refresh-api-key.command';
3
3
  export * from './send-text-request.command';
4
4
  export * from './send-image-request.command';
5
5
  export * from './submit-balance-top-up-form.command';
6
+ export * from './find-b2b-image-generation-job-by-uuid.command';
@@ -1,26 +1,26 @@
1
1
  import { z } from 'zod';
2
- import { AI_MODEL_CONFIG_PARAM, AI_MODEL_FEATURE } from '../../constants';
2
+ import { IMAGE_GENERATION_RESOLUTION } from '../../constants';
3
+ import { ToolJobSchema } from '../../models';
3
4
 
4
5
  export namespace SendImageRequestCommand {
5
6
  export const RequestSchema = z.object({
6
7
  model: z.string(),
7
8
  prompt: z.string(),
8
- params: z.array(
9
- z.object({
10
- type: z.nativeEnum(AI_MODEL_CONFIG_PARAM),
11
- option: z.string().uuid(),
12
- }),
13
- ),
14
- refinePrompt: z.boolean().default(false),
15
- features: z.array(z.nativeEnum(AI_MODEL_FEATURE)).optional().default([]),
16
- files: z.array(z.string().uuid()).optional().default([]),
9
+ params: z.object({
10
+ aspectRatio: z.string(),
11
+ attachedFiles: z.string().array(),
12
+ enhancePrompt: z.boolean(),
13
+ resolution: z.nativeEnum(IMAGE_GENERATION_RESOLUTION).optional(),
14
+ }),
17
15
  });
18
16
 
19
17
  export type Request = z.infer<typeof RequestSchema>;
20
18
 
21
19
  export const ResponseSchema = z.object({
22
- data: z.object({
23
- urls: z.array(z.string()),
20
+ data: ToolJobSchema.pick({
21
+ uuid: true,
22
+ status: true,
23
+ error: true,
24
24
  }),
25
25
  });
26
26
 
@@ -1,3 +1,4 @@
1
1
  export * from './tool-content-type.enum';
2
2
  export * from './tool-job-status.enum';
3
3
  export * from './tool-type.enum';
4
+ export * from './job-request-origin.enum';
@@ -0,0 +1,4 @@
1
+ export enum JOB_REQUEST_ORIGIN {
2
+ API = 'api',
3
+ B2B = 'b2b',
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.8.69",
3
+ "version": "0.8.70",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",