@purpleschool/gptbot 0.7.67 → 0.7.68

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.
@@ -9,6 +9,7 @@ var CreateWriterDocumentCommand;
9
9
  prompt: zod_1.z.string(),
10
10
  numPages: zod_1.z.number(),
11
11
  documentTypeId: zod_1.z.string(),
12
+ modelId: zod_1.z.string(),
12
13
  });
13
14
  CreateWriterDocumentCommand.ResponseSchema = zod_1.z.object({
14
15
  data: models_1.WriterDocumentSchema,
@@ -18,3 +18,4 @@ __exportStar(require("./writer-document-section-type.enum"), exports);
18
18
  __exportStar(require("./writer-document-stage.enum"), exports);
19
19
  __exportStar(require("./writer-ai-action-pricing-type.enum"), exports);
20
20
  __exportStar(require("./writer-ai-action-type.enum"), exports);
21
+ __exportStar(require("./tool-model-status.enum"), exports);
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TOOL_MODEL_STATUS = void 0;
4
+ var TOOL_MODEL_STATUS;
5
+ (function (TOOL_MODEL_STATUS) {
6
+ TOOL_MODEL_STATUS["ACTIVE"] = "active";
7
+ TOOL_MODEL_STATUS["INACTIVE"] = "inactive";
8
+ })(TOOL_MODEL_STATUS || (exports.TOOL_MODEL_STATUS = TOOL_MODEL_STATUS = {}));
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.calculateWriterContentGenerationPrice = calculateWriterContentGenerationPrice;
4
- function calculateWriterContentGenerationPrice(pages) {
5
- return Math.max(1, pages);
4
+ function calculateWriterContentGenerationPrice(pages, aiModel) {
5
+ return Math.max(1, pages * aiModel.pricePerPage);
6
6
  }
@@ -4,8 +4,10 @@ exports.WriterConfigSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const writer_document_type_schema_1 = require("./writer-document-type.schema");
6
6
  const writer_ai_action_schema_1 = require("./writer-ai-action.schema");
7
+ const writer_model_schema_1 = require("./writer-model.schema");
7
8
  exports.WriterConfigSchema = zod_1.z.object({
8
9
  maxPromptLength: zod_1.z.number(),
9
10
  documentTypes: zod_1.z.array(writer_document_type_schema_1.WriterDocumentTypeSchema),
10
11
  aiActions: zod_1.z.array(writer_ai_action_schema_1.WriterAiActionSchema),
12
+ models: zod_1.z.array(writer_model_schema_1.WriterModelSchema),
11
13
  });
@@ -15,6 +15,7 @@ exports.WriterDocumentSchema = zod_1.z.object({
15
15
  finalMd: zod_1.z.string().nullable(),
16
16
  userId: zod_1.z.string().nullable(),
17
17
  unregisteredUserId: zod_1.z.string().nullable(),
18
+ modelId: zod_1.z.string(),
18
19
  reaction: zod_1.z.nativeEnum(constants_1.USER_REACTION).nullable(),
19
20
  pages: zod_1.z.number(),
20
21
  createdAt: zod_1.z.date(),
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WriterModelSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const icon_variants_schema_1 = require("../../icon-variants.schema");
6
+ const constants_1 = require("../../../constants");
7
+ exports.WriterModelSchema = zod_1.z.object({
8
+ uuid: zod_1.z.string(),
9
+ title: zod_1.z.string(),
10
+ description: zod_1.z.string(),
11
+ pricePerPage: zod_1.z.number(),
12
+ order: zod_1.z.number(),
13
+ icons: icon_variants_schema_1.IconVariantsSchema,
14
+ maxInputLength: zod_1.z.number(),
15
+ status: zod_1.z.nativeEnum(constants_1.TOOL_MODEL_STATUS),
16
+ createdAt: zod_1.z.date(),
17
+ updatedAt: zod_1.z.date(),
18
+ });
@@ -6,6 +6,7 @@ export namespace CreateWriterDocumentCommand {
6
6
  prompt: z.string(),
7
7
  numPages: z.number(),
8
8
  documentTypeId: z.string(),
9
+ modelId: z.string(),
9
10
  });
10
11
  export type Request = z.infer<typeof RequestSchema>;
11
12
 
@@ -2,3 +2,4 @@ export * from './writer-document-section-type.enum';
2
2
  export * from './writer-document-stage.enum';
3
3
  export * from './writer-ai-action-pricing-type.enum';
4
4
  export * from './writer-ai-action-type.enum';
5
+ export * from './tool-model-status.enum';
@@ -0,0 +1,4 @@
1
+ export enum TOOL_MODEL_STATUS {
2
+ ACTIVE = 'active',
3
+ INACTIVE = 'inactive',
4
+ }
@@ -1,3 +1,5 @@
1
- export function calculateWriterContentGenerationPrice(pages: number): number {
2
- return Math.max(1, pages);
1
+ import { WriterModel } from '../../models/tools/writer/writer-model.schema';
2
+
3
+ export function calculateWriterContentGenerationPrice(pages: number, aiModel: WriterModel): number {
4
+ return Math.max(1, pages * aiModel.pricePerPage);
3
5
  }
@@ -1,10 +1,12 @@
1
1
  import { z } from 'zod';
2
2
  import { WriterDocumentTypeSchema } from './writer-document-type.schema';
3
3
  import { WriterAiActionSchema } from './writer-ai-action.schema';
4
+ import { WriterModelSchema } from './writer-model.schema';
4
5
 
5
6
  export const WriterConfigSchema = z.object({
6
7
  maxPromptLength: z.number(),
7
8
  documentTypes: z.array(WriterDocumentTypeSchema),
8
9
  aiActions: z.array(WriterAiActionSchema),
10
+ models: z.array(WriterModelSchema),
9
11
  });
10
12
  export type WriterConfig = z.infer<typeof WriterConfigSchema>;
@@ -13,6 +13,7 @@ export const WriterDocumentSchema = z.object({
13
13
  finalMd: z.string().nullable(),
14
14
  userId: z.string().nullable(),
15
15
  unregisteredUserId: z.string().nullable(),
16
+ modelId: z.string(),
16
17
  reaction: z.nativeEnum(USER_REACTION).nullable(),
17
18
  pages: z.number(),
18
19
  createdAt: z.date(),
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { IconVariantsSchema } from '../../icon-variants.schema';
3
+ import { TOOL_MODEL_STATUS } from '../../../constants';
4
+
5
+ export const WriterModelSchema = z.object({
6
+ uuid: z.string(),
7
+ title: z.string(),
8
+ description: z.string(),
9
+ pricePerPage: z.number(),
10
+ order: z.number(),
11
+ icons: IconVariantsSchema,
12
+ maxInputLength: z.number(),
13
+ status: z.nativeEnum(TOOL_MODEL_STATUS),
14
+ createdAt: z.date(),
15
+ updatedAt: z.date(),
16
+ });
17
+
18
+ export type WriterModel = z.infer<typeof WriterModelSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.7.67",
3
+ "version": "0.7.68",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",