@purpleschool/gptbot-tools 0.0.7 → 0.0.9

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.
@@ -16,6 +16,11 @@ exports.ERRORS = {
16
16
  message: 'Произошла ошибка во время запроса к AI',
17
17
  httpCode: 500,
18
18
  },
19
+ INSUFFICIENT_BALANCE: {
20
+ code: 'PARAPHRASE.INSUFFICIENT_BALANCE',
21
+ message: 'У пользователя недостаточно средств',
22
+ httpCode: 400,
23
+ },
19
24
  },
20
25
  PARAPHRASE_REQUEST: {
21
26
  SAVE_ERROR: {
@@ -8,9 +8,9 @@ const enums_1 = require("../enums");
8
8
  var ParaphraseCommand;
9
9
  (function (ParaphraseCommand) {
10
10
  ParaphraseCommand.RequestSchema = zod_1.z.object({
11
- jobId: zod_1.z.string().uuid(),
12
11
  userId: zod_1.z.string().uuid().nullable().optional(),
13
12
  unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
13
+ userBalance: zod_1.z.number(),
14
14
  prompt: zod_1.z.string(),
15
15
  typeId: zod_1.z.string().uuid(),
16
16
  styleId: zod_1.z.string().uuid(),
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ParaphraseJobSchema = void 0;
4
4
  const zod_1 = require("zod");
5
+ const tools_1 = require("../../tools");
5
6
  exports.ParaphraseJobSchema = zod_1.z.object({
6
7
  uuid: zod_1.z.string(),
7
8
  userId: zod_1.z.string().nullable(),
@@ -10,7 +11,7 @@ exports.ParaphraseJobSchema = zod_1.z.object({
10
11
  aiOutput: zod_1.z.string().nullable(),
11
12
  aiTokenUsage: zod_1.z.number().nullable(),
12
13
  price: zod_1.z.number(),
13
- status: zod_1.z.string(),
14
+ status: zod_1.z.nativeEnum(tools_1.JOB_STATUS),
14
15
  typeId: zod_1.z.string(),
15
16
  styleId: zod_1.z.string(),
16
17
  createdAt: zod_1.z.date(),
@@ -14,6 +14,11 @@ export const ERRORS = {
14
14
  message: 'Произошла ошибка во время запроса к AI',
15
15
  httpCode: 500,
16
16
  },
17
+ INSUFFICIENT_BALANCE: {
18
+ code: 'PARAPHRASE.INSUFFICIENT_BALANCE',
19
+ message: 'У пользователя недостаточно средств',
20
+ httpCode: 400,
21
+ },
17
22
  },
18
23
  PARAPHRASE_REQUEST: {
19
24
  SAVE_ERROR: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot-tools",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "scripts": {
@@ -5,9 +5,9 @@ import { PARAPHRASING_INTENSITY } from '../enums';
5
5
 
6
6
  export namespace ParaphraseCommand {
7
7
  export const RequestSchema = z.object({
8
- jobId: z.string().uuid(),
9
8
  userId: z.string().uuid().nullable().optional(),
10
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ userBalance: z.number(),
11
11
  prompt: z.string(),
12
12
  typeId: z.string().uuid(),
13
13
  styleId: z.string().uuid(),
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { JOB_STATUS } from '../../tools';
2
3
 
3
4
  export const ParaphraseJobSchema = z.object({
4
5
  uuid: z.string(),
@@ -8,7 +9,7 @@ export const ParaphraseJobSchema = z.object({
8
9
  aiOutput: z.string().nullable(),
9
10
  aiTokenUsage: z.number().nullable(),
10
11
  price: z.number(),
11
- status: z.string(),
12
+ status: z.nativeEnum(JOB_STATUS),
12
13
  typeId: z.string(),
13
14
  styleId: z.string(),
14
15
  createdAt: z.date(),