@purpleschool/gptbot-tools 0.2.17-stage → 0.2.18-stage
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/build/html-page-builder/commands/get-html-page-builder-price-calculation-data.command.js +36 -0
- package/build/html-page-builder/commands/html-page-builder-execute.command.js +1 -12
- package/build/html-page-builder/commands/index.js +1 -1
- package/build/html-page-builder/routes/html-page-builder.amqp.routes.js +1 -1
- package/html-page-builder/commands/get-html-page-builder-price-calculation-data.command.ts +38 -0
- package/html-page-builder/commands/html-page-builder-execute.command.ts +10 -24
- package/html-page-builder/commands/index.ts +1 -1
- package/html-page-builder/routes/html-page-builder.amqp.routes.ts +1 -1
- package/package.json +1 -1
- package/build/html-page-builder/commands/get-html-page-builder-price.command.js +0 -17
- package/html-page-builder/commands/get-html-page-builder-price.command.ts +0 -19
package/build/html-page-builder/commands/get-html-page-builder-price-calculation-data.command.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetHtmlPageBuilderPriceCalculationDataCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
|
+
const enums_1 = require("../enums");
|
|
7
|
+
var GetHtmlPageBuilderPriceCalculationDataCommand;
|
|
8
|
+
(function (GetHtmlPageBuilderPriceCalculationDataCommand) {
|
|
9
|
+
GetHtmlPageBuilderPriceCalculationDataCommand.RequestSchema = zod_1.z.object({
|
|
10
|
+
modelId: zod_1.z.string().uuid(),
|
|
11
|
+
inputLength: zod_1.z.number().int().nonnegative(),
|
|
12
|
+
sessionId: zod_1.z.string().uuid().nullable().optional(),
|
|
13
|
+
});
|
|
14
|
+
GetHtmlPageBuilderPriceCalculationDataCommand.ResponseDataSchema = zod_1.z.object({
|
|
15
|
+
modelPricing: zod_1.z.object({
|
|
16
|
+
inputPrice: zod_1.z.number(),
|
|
17
|
+
outputPrice: zod_1.z.number(),
|
|
18
|
+
}),
|
|
19
|
+
effectivePromptLength: zod_1.z.number(),
|
|
20
|
+
breakdown: zod_1.z.object({
|
|
21
|
+
systemPromptLength: zod_1.z.number(),
|
|
22
|
+
inputLength: zod_1.z.number(),
|
|
23
|
+
currentHtmlLength: zod_1.z.number(),
|
|
24
|
+
userPromptTemplateOverheadLength: zod_1.z.number(),
|
|
25
|
+
modeHintLength: zod_1.z.number(),
|
|
26
|
+
userMessageLength: zod_1.z.number(),
|
|
27
|
+
attachmentsTextLength: zod_1.z.number(),
|
|
28
|
+
}),
|
|
29
|
+
metadata: zod_1.z.object({
|
|
30
|
+
mode: zod_1.z.nativeEnum(enums_1.HTML_PAGE_BUILDER_SESSION_STAGE),
|
|
31
|
+
modelId: zod_1.z.string().uuid(),
|
|
32
|
+
sessionId: zod_1.z.string().uuid().nullable(),
|
|
33
|
+
}),
|
|
34
|
+
});
|
|
35
|
+
GetHtmlPageBuilderPriceCalculationDataCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(GetHtmlPageBuilderPriceCalculationDataCommand.ResponseDataSchema);
|
|
36
|
+
})(GetHtmlPageBuilderPriceCalculationDataCommand || (exports.GetHtmlPageBuilderPriceCalculationDataCommand = GetHtmlPageBuilderPriceCalculationDataCommand = {}));
|
|
@@ -6,8 +6,7 @@ const command_response_schema_1 = require("../../common/models/command-response.
|
|
|
6
6
|
const models_1 = require("../models");
|
|
7
7
|
var HtmlPageBuilderExecuteCommand;
|
|
8
8
|
(function (HtmlPageBuilderExecuteCommand) {
|
|
9
|
-
HtmlPageBuilderExecuteCommand.RequestSchema = zod_1.z
|
|
10
|
-
.object({
|
|
9
|
+
HtmlPageBuilderExecuteCommand.RequestSchema = zod_1.z.object({
|
|
11
10
|
userId: zod_1.z.string().uuid().nullable().optional(),
|
|
12
11
|
unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
|
|
13
12
|
sessionId: zod_1.z.string().uuid().optional(),
|
|
@@ -16,16 +15,6 @@ var HtmlPageBuilderExecuteCommand;
|
|
|
16
15
|
params: models_1.HtmlPageBuilderJobParamsSchema,
|
|
17
16
|
tokenReservationId: zod_1.z.string().uuid().optional(),
|
|
18
17
|
precalculatedPrice: zod_1.z.number().optional(),
|
|
19
|
-
})
|
|
20
|
-
.refine((data) => {
|
|
21
|
-
return !(data.userId && data.unregisteredUserId);
|
|
22
|
-
}, {
|
|
23
|
-
message: 'userId and unregisteredUserId cannot be used together',
|
|
24
|
-
path: ['userId', 'unregisteredUserId'],
|
|
25
|
-
})
|
|
26
|
-
.refine((data) => { var _a; return Boolean((_a = data.userId) !== null && _a !== void 0 ? _a : data.unregisteredUserId); }, {
|
|
27
|
-
message: 'userId or unregisteredUserId is required',
|
|
28
|
-
path: ['userId', 'unregisteredUserId'],
|
|
29
18
|
});
|
|
30
19
|
HtmlPageBuilderExecuteCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.HtmlPageBuilderSessionSchema);
|
|
31
20
|
})(HtmlPageBuilderExecuteCommand || (exports.HtmlPageBuilderExecuteCommand = HtmlPageBuilderExecuteCommand = {}));
|
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./create-html-page-builder-session.command"), exports);
|
|
18
|
-
__exportStar(require("./get-html-page-builder-price.command"), exports);
|
|
18
|
+
__exportStar(require("./get-html-page-builder-price-calculation-data.command"), exports);
|
|
19
19
|
__exportStar(require("./html-page-builder-execute.command"), exports);
|
|
20
20
|
__exportStar(require("./soft-delete-all-html-page-builder-sessions.command"), exports);
|
|
21
21
|
__exportStar(require("./soft-delete-html-page-builder-session-by-uuid.command"), exports);
|
|
@@ -4,7 +4,7 @@ exports.HTML_PAGE_BUILDER_AMQP_ROUTES = void 0;
|
|
|
4
4
|
exports.HTML_PAGE_BUILDER_AMQP_ROUTES = {
|
|
5
5
|
CONFIG: 'tools.html-page-builder.config.rpc',
|
|
6
6
|
EXECUTE: 'tools.html-page-builder.execute.rpc',
|
|
7
|
-
|
|
7
|
+
GET_PRICE_CALCULATION_DATA: 'tools.html-page-builder.get-price-calculation-data.rpc',
|
|
8
8
|
CREATE_SESSION: 'tools.html-page-builder.sessions.create.rpc',
|
|
9
9
|
LIST_SESSIONS: 'tools.html-page-builder.sessions.list.rpc',
|
|
10
10
|
GET_SESSION: 'tools.html-page-builder.sessions.get.rpc',
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { HTML_PAGE_BUILDER_SESSION_STAGE } from '../enums';
|
|
4
|
+
|
|
5
|
+
export namespace GetHtmlPageBuilderPriceCalculationDataCommand {
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
modelId: z.string().uuid(),
|
|
8
|
+
inputLength: z.number().int().nonnegative(),
|
|
9
|
+
sessionId: z.string().uuid().nullable().optional(),
|
|
10
|
+
});
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseDataSchema = z.object({
|
|
14
|
+
modelPricing: z.object({
|
|
15
|
+
inputPrice: z.number(),
|
|
16
|
+
outputPrice: z.number(),
|
|
17
|
+
}),
|
|
18
|
+
effectivePromptLength: z.number(),
|
|
19
|
+
breakdown: z.object({
|
|
20
|
+
systemPromptLength: z.number(),
|
|
21
|
+
inputLength: z.number(),
|
|
22
|
+
currentHtmlLength: z.number(),
|
|
23
|
+
userPromptTemplateOverheadLength: z.number(),
|
|
24
|
+
modeHintLength: z.number(),
|
|
25
|
+
userMessageLength: z.number(),
|
|
26
|
+
attachmentsTextLength: z.number(),
|
|
27
|
+
}),
|
|
28
|
+
metadata: z.object({
|
|
29
|
+
mode: z.nativeEnum(HTML_PAGE_BUILDER_SESSION_STAGE),
|
|
30
|
+
modelId: z.string().uuid(),
|
|
31
|
+
sessionId: z.string().uuid().nullable(),
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
export type ResponseData = z.infer<typeof ResponseDataSchema>;
|
|
35
|
+
|
|
36
|
+
export const ResponseSchema = ICommandResponseSchema(ResponseDataSchema);
|
|
37
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
38
|
+
}
|
|
@@ -3,30 +3,16 @@ import { ICommandResponseSchema } from '../../common/models/command-response.sch
|
|
|
3
3
|
import { HtmlPageBuilderJobParamsSchema, HtmlPageBuilderSessionSchema } from '../models';
|
|
4
4
|
|
|
5
5
|
export namespace HtmlPageBuilderExecuteCommand {
|
|
6
|
-
export const RequestSchema = z
|
|
7
|
-
.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
})
|
|
17
|
-
.refine(
|
|
18
|
-
(data) => {
|
|
19
|
-
return !(data.userId && data.unregisteredUserId);
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
message: 'userId and unregisteredUserId cannot be used together',
|
|
23
|
-
path: ['userId', 'unregisteredUserId'],
|
|
24
|
-
},
|
|
25
|
-
)
|
|
26
|
-
.refine((data) => Boolean(data.userId ?? data.unregisteredUserId), {
|
|
27
|
-
message: 'userId or unregisteredUserId is required',
|
|
28
|
-
path: ['userId', 'unregisteredUserId'],
|
|
29
|
-
});
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
userId: z.string().uuid().nullable().optional(),
|
|
8
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
9
|
+
sessionId: z.string().uuid().optional(),
|
|
10
|
+
userPrompt: z.string(),
|
|
11
|
+
modelId: z.string().uuid(),
|
|
12
|
+
params: HtmlPageBuilderJobParamsSchema,
|
|
13
|
+
tokenReservationId: z.string().uuid().optional(),
|
|
14
|
+
precalculatedPrice: z.number().optional(),
|
|
15
|
+
});
|
|
30
16
|
export type Request = z.infer<typeof RequestSchema>;
|
|
31
17
|
|
|
32
18
|
export const ResponseSchema = ICommandResponseSchema(HtmlPageBuilderSessionSchema);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './create-html-page-builder-session.command';
|
|
2
|
-
export * from './get-html-page-builder-price.command';
|
|
2
|
+
export * from './get-html-page-builder-price-calculation-data.command';
|
|
3
3
|
export * from './html-page-builder-execute.command';
|
|
4
4
|
export * from './soft-delete-all-html-page-builder-sessions.command';
|
|
5
5
|
export * from './soft-delete-html-page-builder-session-by-uuid.command';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const HTML_PAGE_BUILDER_AMQP_ROUTES = {
|
|
2
2
|
CONFIG: 'tools.html-page-builder.config.rpc',
|
|
3
3
|
EXECUTE: 'tools.html-page-builder.execute.rpc',
|
|
4
|
-
|
|
4
|
+
GET_PRICE_CALCULATION_DATA: 'tools.html-page-builder.get-price-calculation-data.rpc',
|
|
5
5
|
CREATE_SESSION: 'tools.html-page-builder.sessions.create.rpc',
|
|
6
6
|
LIST_SESSIONS: 'tools.html-page-builder.sessions.list.rpc',
|
|
7
7
|
GET_SESSION: 'tools.html-page-builder.sessions.get.rpc',
|
package/package.json
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetHtmlPageBuilderPriceCommand = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
|
-
var GetHtmlPageBuilderPriceCommand;
|
|
7
|
-
(function (GetHtmlPageBuilderPriceCommand) {
|
|
8
|
-
GetHtmlPageBuilderPriceCommand.RequestSchema = zod_1.z.object({
|
|
9
|
-
modelId: zod_1.z.string().uuid(),
|
|
10
|
-
userPrompt: zod_1.z.string(),
|
|
11
|
-
sessionId: zod_1.z.string().uuid().nullable().optional(),
|
|
12
|
-
});
|
|
13
|
-
GetHtmlPageBuilderPriceCommand.ResponseDataSchema = zod_1.z.object({
|
|
14
|
-
price: zod_1.z.number(),
|
|
15
|
-
});
|
|
16
|
-
GetHtmlPageBuilderPriceCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(GetHtmlPageBuilderPriceCommand.ResponseDataSchema);
|
|
17
|
-
})(GetHtmlPageBuilderPriceCommand || (exports.GetHtmlPageBuilderPriceCommand = GetHtmlPageBuilderPriceCommand = {}));
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
-
|
|
4
|
-
export namespace GetHtmlPageBuilderPriceCommand {
|
|
5
|
-
export const RequestSchema = z.object({
|
|
6
|
-
modelId: z.string().uuid(),
|
|
7
|
-
userPrompt: z.string(),
|
|
8
|
-
sessionId: z.string().uuid().nullable().optional(),
|
|
9
|
-
});
|
|
10
|
-
export type Request = z.infer<typeof RequestSchema>;
|
|
11
|
-
|
|
12
|
-
export const ResponseDataSchema = z.object({
|
|
13
|
-
price: z.number(),
|
|
14
|
-
});
|
|
15
|
-
export type ResponseData = z.infer<typeof ResponseDataSchema>;
|
|
16
|
-
|
|
17
|
-
export const ResponseSchema = ICommandResponseSchema(ResponseDataSchema);
|
|
18
|
-
export type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
-
}
|