@purpleschool/gptbot-tools 0.0.76 → 0.0.77-ai-proxy
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/ai-proxy/index.ts +1 -0
- package/ai-proxy/routes/ai-proxy.routes.ts +7 -0
- package/ai-proxy/routes/index.ts +1 -0
- package/build/ai-proxy/index.js +17 -0
- package/build/ai-proxy/routes/ai-proxy.routes.js +9 -0
- package/build/ai-proxy/routes/index.js +17 -0
- package/build/common/errors/errors.js +0 -5
- package/build/index.js +1 -0
- package/build/music/routes/music.http.routes.js +1 -4
- package/build/presentation/constants/slide-layout-map.constant.js +0 -1
- package/build/presentation/enums/slide-content-type.enum.js +0 -1
- package/build/presentation/models/slide-content-edit.schema.js +1 -18
- package/build/presentation/models/slide-content.schema.js +1 -26
- package/build/video/enums/video-pricing-rule-type.enum.js +0 -1
- package/build/video/enums/video-strategy.enum.js +0 -1
- package/build/video/models/video-model.schema.js +1 -8
- package/build/video/routes/video.http.routes.js +0 -1
- package/build/video/utils/calculate-video-generation-price.util.js +1 -5
- package/common/errors/errors.ts +0 -5
- package/index.ts +1 -0
- package/music/routes/music.http.routes.ts +0 -4
- package/package.json +1 -1
- package/presentation/constants/slide-layout-map.constant.ts +0 -1
- package/presentation/enums/slide-content-type.enum.ts +0 -1
- package/presentation/models/slide-content-edit.schema.ts +0 -21
- package/presentation/models/slide-content.schema.ts +0 -45
- package/video/enums/video-pricing-rule-type.enum.ts +0 -1
- package/video/enums/video-strategy.enum.ts +0 -1
- package/video/models/video-model.schema.ts +1 -8
- package/video/routes/video.http.routes.ts +0 -1
- package/video/utils/calculate-video-generation-price.util.ts +1 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './routes';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ai-proxy.routes';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./routes"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AI_PROXY_ROUTES = exports.AI_PROXY_CONTROLLER = void 0;
|
|
4
|
+
exports.AI_PROXY_CONTROLLER = 'ai-proxy';
|
|
5
|
+
exports.AI_PROXY_ROUTES = {
|
|
6
|
+
VIDEO_CALLBACK: 'video/callback',
|
|
7
|
+
VIDEO_EDITOR_CALLBACK: 'video-editor/callback',
|
|
8
|
+
MUSIC_CALLBACK: 'music/callback',
|
|
9
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ai-proxy.routes"), exports);
|
|
@@ -578,11 +578,6 @@ exports.ERRORS = {
|
|
|
578
578
|
message: 'Некорректное соотношение сторон',
|
|
579
579
|
httpCode: 400,
|
|
580
580
|
},
|
|
581
|
-
INVALID_RESOLUTION: {
|
|
582
|
-
code: 'VIDEO.INVALID_RESOLUTION',
|
|
583
|
-
message: 'Некорректное разрешение видео',
|
|
584
|
-
httpCode: 400,
|
|
585
|
-
},
|
|
586
581
|
RUNWAY_CONTENT_POLICY: {
|
|
587
582
|
code: 'VIDEO.RUNWAY_CONTENT_POLICY',
|
|
588
583
|
message: 'Запрос на создание видео был отклонен, т.к. он не соответствует требованиям политики безопасности Runway.',
|
package/build/index.js
CHANGED
|
@@ -48,6 +48,7 @@ __exportStar(require("./writer"), exports);
|
|
|
48
48
|
__exportStar(require("./image-editor"), exports);
|
|
49
49
|
__exportStar(require("./video-editor"), exports);
|
|
50
50
|
__exportStar(require("./music"), exports);
|
|
51
|
+
__exportStar(require("./ai-proxy"), exports);
|
|
51
52
|
const common = __importStar(require("./common"));
|
|
52
53
|
const paraphrase = __importStar(require("./paraphrase"));
|
|
53
54
|
const tools = __importStar(require("./tools"));
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.MUSIC_CONTROLLER = void 0;
|
|
4
4
|
exports.MUSIC_CONTROLLER = 'music';
|
|
5
|
-
exports.MUSIC_ROUTES = {
|
|
6
|
-
KIE_SUNO_CALLBACK: '/kie/suno/callback',
|
|
7
|
-
};
|
|
@@ -13,5 +13,4 @@ exports.SLIDE_LAYOUT_MAP = new Map([
|
|
|
13
13
|
[enums_1.SLIDE_CONTENT_TYPE.THANK_YOU, [slide_layout_enum_1.SLIDE_LAYOUT.TYPE_1]],
|
|
14
14
|
[enums_1.SLIDE_CONTENT_TYPE.TABLE, [slide_layout_enum_1.SLIDE_LAYOUT.TYPE_1]],
|
|
15
15
|
[enums_1.SLIDE_CONTENT_TYPE.CHART, [slide_layout_enum_1.SLIDE_LAYOUT.TYPE_1]],
|
|
16
|
-
[enums_1.SLIDE_CONTENT_TYPE.TIMELINE, [slide_layout_enum_1.SLIDE_LAYOUT.TYPE_1]],
|
|
17
16
|
]);
|
|
@@ -12,5 +12,4 @@ var SLIDE_CONTENT_TYPE;
|
|
|
12
12
|
SLIDE_CONTENT_TYPE["THANK_YOU"] = "THANK_YOU";
|
|
13
13
|
SLIDE_CONTENT_TYPE["TABLE"] = "TABLE";
|
|
14
14
|
SLIDE_CONTENT_TYPE["CHART"] = "CHART";
|
|
15
|
-
SLIDE_CONTENT_TYPE["TIMELINE"] = "TIMELINE";
|
|
16
15
|
})(SLIDE_CONTENT_TYPE || (exports.SLIDE_CONTENT_TYPE = SLIDE_CONTENT_TYPE = {}));
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SlideContentUserEditSchema = exports.
|
|
6
|
+
exports.SlideContentUserEditSchema = exports.ChartSlideDataUserEditSchema = exports.BarChartSlideDataUserEditSchema = exports.TableSlideDataUserEditSchema = exports.SectionBreakSlideDataUserEditSchema = exports.ImageSlideDataUserEditSchema = exports.ContentsSlideDataUserEditSchema = exports.StructuredListSlideDataUserEditSchema = exports.TextSlideDataUserEditSchema = exports.ThankYouSlideDataUserEditSchema = exports.CoverSlideDataUserEditSchema = void 0;
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
8
|
const enums_1 = require("../enums");
|
|
9
9
|
const slide_content_schema_1 = require("./slide-content.schema");
|
|
@@ -122,22 +122,6 @@ exports.ChartSlideDataUserEditSchema = zod_1.default.object({
|
|
|
122
122
|
chart: zod_1.default.discriminatedUnion('type', [exports.BarChartSlideDataUserEditSchema]),
|
|
123
123
|
version: zod_1.default.literal(1),
|
|
124
124
|
});
|
|
125
|
-
exports.TimelineSlideDataUserEditSchema = zod_1.default.object({
|
|
126
|
-
contentType: zod_1.default.literal(enums_1.SLIDE_CONTENT_TYPE.TIMELINE),
|
|
127
|
-
title: zod_1.default.string().min(1).max(500),
|
|
128
|
-
description: zod_1.default.string().min(1).max(1000),
|
|
129
|
-
timeline: zod_1.default.object({
|
|
130
|
-
events: zod_1.default
|
|
131
|
-
.array(zod_1.default.object({
|
|
132
|
-
date: zod_1.default.string().min(1).max(100),
|
|
133
|
-
title: zod_1.default.string().min(1).max(200),
|
|
134
|
-
description: zod_1.default.string().min(1).max(500),
|
|
135
|
-
}))
|
|
136
|
-
.min(2)
|
|
137
|
-
.max(10),
|
|
138
|
-
}),
|
|
139
|
-
version: zod_1.default.literal(1),
|
|
140
|
-
});
|
|
141
125
|
exports.SlideContentUserEditSchema = zod_1.default.discriminatedUnion('contentType', [
|
|
142
126
|
exports.CoverSlideDataUserEditSchema,
|
|
143
127
|
exports.StructuredListSlideDataUserEditSchema,
|
|
@@ -148,5 +132,4 @@ exports.SlideContentUserEditSchema = zod_1.default.discriminatedUnion('contentTy
|
|
|
148
132
|
exports.ThankYouSlideDataUserEditSchema,
|
|
149
133
|
exports.TableSlideDataUserEditSchema,
|
|
150
134
|
exports.ChartSlideDataUserEditSchema,
|
|
151
|
-
exports.TimelineSlideDataUserEditSchema,
|
|
152
135
|
]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SlideContentSchema = exports.
|
|
3
|
+
exports.SlideContentSchema = exports.ChartSlideDataSchema = exports.BarChartSlideDataSchema = exports.TableSlideDataSchema = exports.SectionBreakSlideDataSchema = exports.ImageSlideDataSchema = exports.ContentsSlideDataSchema = exports.TextSlideDataSchema = exports.StructuredListSlideDataSchema = exports.ThankYouSlideDataSchema = exports.CoverSlideDataSchema = exports.IconSlotSchema = exports.ImageSlotSchema = exports.SLIDE_CHART_TYPE = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const enums_1 = require("../enums");
|
|
6
6
|
var SLIDE_CHART_TYPE;
|
|
@@ -184,30 +184,6 @@ exports.ChartSlideDataSchema = zod_1.z.object({
|
|
|
184
184
|
chart: zod_1.z.discriminatedUnion('type', [exports.BarChartSlideDataSchema]),
|
|
185
185
|
version: zod_1.z.literal(1),
|
|
186
186
|
});
|
|
187
|
-
exports.TimelineSlideDataSchema = zod_1.z.object({
|
|
188
|
-
contentType: zod_1.z.literal(enums_1.SLIDE_CONTENT_TYPE.TIMELINE),
|
|
189
|
-
title: zod_1.z.string().describe('Slide title in about 6 words').min(10).max(150),
|
|
190
|
-
description: zod_1.z.string().describe('Brief context for the timeline').min(10).max(200),
|
|
191
|
-
timeline: zod_1.z.object({
|
|
192
|
-
events: zod_1.z
|
|
193
|
-
.array(zod_1.z.object({
|
|
194
|
-
date: zod_1.z
|
|
195
|
-
.string()
|
|
196
|
-
.describe('Date or time period label. MUST be general/approximate if exact date unknown (e.g., "Early 2020s", "Mid-1990s", "Recent years")')
|
|
197
|
-
.min(2)
|
|
198
|
-
.max(50),
|
|
199
|
-
title: zod_1.z.string().describe('Event title in 2-4 words').min(5).max(80),
|
|
200
|
-
description: zod_1.z
|
|
201
|
-
.string()
|
|
202
|
-
.describe('Brief description of the event or milestone')
|
|
203
|
-
.min(20)
|
|
204
|
-
.max(150),
|
|
205
|
-
}))
|
|
206
|
-
.length(5)
|
|
207
|
-
.describe('Timeline must contain exactly 5 chronological events'),
|
|
208
|
-
}),
|
|
209
|
-
version: zod_1.z.literal(1),
|
|
210
|
-
});
|
|
211
187
|
exports.SlideContentSchema = zod_1.z.discriminatedUnion('contentType', [
|
|
212
188
|
exports.CoverSlideDataSchema,
|
|
213
189
|
exports.StructuredListSlideDataSchema,
|
|
@@ -218,5 +194,4 @@ exports.SlideContentSchema = zod_1.z.discriminatedUnion('contentType', [
|
|
|
218
194
|
exports.ThankYouSlideDataSchema,
|
|
219
195
|
exports.TableSlideDataSchema,
|
|
220
196
|
exports.ChartSlideDataSchema,
|
|
221
|
-
exports.TimelineSlideDataSchema,
|
|
222
197
|
]);
|
|
@@ -4,5 +4,4 @@ exports.VIDEO_PRICING_RULE_TYPE = void 0;
|
|
|
4
4
|
var VIDEO_PRICING_RULE_TYPE;
|
|
5
5
|
(function (VIDEO_PRICING_RULE_TYPE) {
|
|
6
6
|
VIDEO_PRICING_RULE_TYPE["FLAT"] = "flat";
|
|
7
|
-
VIDEO_PRICING_RULE_TYPE["PER_SECOND"] = "per_second";
|
|
8
7
|
})(VIDEO_PRICING_RULE_TYPE || (exports.VIDEO_PRICING_RULE_TYPE = VIDEO_PRICING_RULE_TYPE = {}));
|
|
@@ -9,5 +9,4 @@ var VIDEO_GENERATION_STRATEGY;
|
|
|
9
9
|
VIDEO_GENERATION_STRATEGY["RUNWAY_CALLBACK"] = "RUNWAY_CALLBACK";
|
|
10
10
|
VIDEO_GENERATION_STRATEGY["SORA_2_VIDEO_GENERATION_POLLING"] = "SORA_2_VIDEO_GENERATION_POLLING";
|
|
11
11
|
VIDEO_GENERATION_STRATEGY["SORA_2_VIDEO_GENERATION_CALLBACK"] = "SORA_2_VIDEO_GENERATION_CALLBACK";
|
|
12
|
-
VIDEO_GENERATION_STRATEGY["SEEDANCE_VIDEO_GENERATION_CALLBACK"] = "SEEDANCE_VIDEO_GENERATION_CALLBACK";
|
|
13
12
|
})(VIDEO_GENERATION_STRATEGY || (exports.VIDEO_GENERATION_STRATEGY = VIDEO_GENERATION_STRATEGY = {}));
|
|
@@ -18,22 +18,15 @@ exports.VideoModelParamsSchema = zod_1.z.object({
|
|
|
18
18
|
})
|
|
19
19
|
.optional(),
|
|
20
20
|
quality: zod_1.z.string().optional(),
|
|
21
|
-
resolution: zod_1.z
|
|
22
|
-
.object({
|
|
23
|
-
options: zod_1.z.array(zod_1.z.string()),
|
|
24
|
-
})
|
|
25
|
-
.optional(),
|
|
26
21
|
});
|
|
27
22
|
exports.VideoGenerationRequestParamsSchema = zod_1.z.object({
|
|
28
23
|
imageUrls: zod_1.z.string().array().optional(),
|
|
29
24
|
duration: zod_1.z.number(),
|
|
30
25
|
aspectRatio: zod_1.z.string().optional(),
|
|
31
26
|
quality: zod_1.z.string().optional(),
|
|
32
|
-
resolution: zod_1.z.string().optional(),
|
|
33
27
|
});
|
|
34
28
|
exports.VideoModelPricingRuleConditionSchema = zod_1.z.object({
|
|
35
|
-
aspectRatio: zod_1.z.string()
|
|
36
|
-
resolution: zod_1.z.string().optional(),
|
|
29
|
+
aspectRatio: zod_1.z.string(),
|
|
37
30
|
});
|
|
38
31
|
exports.VideoModelPricingRulesSchema = zod_1.z.array(zod_1.z.object({
|
|
39
32
|
type: zod_1.z.nativeEnum(enums_1.VIDEO_PRICING_RULE_TYPE),
|
|
@@ -17,11 +17,7 @@ function matchesCondition(condition, params) {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
function calculateVideoGenerationPrice({ pricePerSecond, params, rules, }) {
|
|
20
|
-
const
|
|
21
|
-
.filter((r) => r.type === enums_1.VIDEO_PRICING_RULE_TYPE.PER_SECOND)
|
|
22
|
-
.find((r) => matchesCondition(r.condition, params));
|
|
23
|
-
const effectivePricePerSecond = perSecondRule ? perSecondRule.value : pricePerSecond;
|
|
24
|
-
const base = effectivePricePerSecond * params.duration;
|
|
20
|
+
const base = pricePerSecond * params.duration;
|
|
25
21
|
const flatMarkup = rules.reduce((sum, r) => {
|
|
26
22
|
if (r.type !== enums_1.VIDEO_PRICING_RULE_TYPE.FLAT) {
|
|
27
23
|
return sum;
|
package/common/errors/errors.ts
CHANGED
|
@@ -577,11 +577,6 @@ export const ERRORS = {
|
|
|
577
577
|
message: 'Некорректное соотношение сторон',
|
|
578
578
|
httpCode: 400,
|
|
579
579
|
},
|
|
580
|
-
INVALID_RESOLUTION: {
|
|
581
|
-
code: 'VIDEO.INVALID_RESOLUTION',
|
|
582
|
-
message: 'Некорректное разрешение видео',
|
|
583
|
-
httpCode: 400,
|
|
584
|
-
},
|
|
585
580
|
RUNWAY_CONTENT_POLICY: {
|
|
586
581
|
code: 'VIDEO.RUNWAY_CONTENT_POLICY',
|
|
587
582
|
message:
|
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -11,5 +11,4 @@ export const SLIDE_LAYOUT_MAP = new Map<SLIDE_CONTENT_TYPE, SLIDE_LAYOUT[]>([
|
|
|
11
11
|
[SLIDE_CONTENT_TYPE.THANK_YOU, [SLIDE_LAYOUT.TYPE_1]],
|
|
12
12
|
[SLIDE_CONTENT_TYPE.TABLE, [SLIDE_LAYOUT.TYPE_1]],
|
|
13
13
|
[SLIDE_CONTENT_TYPE.CHART, [SLIDE_LAYOUT.TYPE_1]],
|
|
14
|
-
[SLIDE_CONTENT_TYPE.TIMELINE, [SLIDE_LAYOUT.TYPE_1]],
|
|
15
14
|
]);
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
IBarChartSlideDataStructure,
|
|
14
14
|
IChartSlideDataStructure,
|
|
15
15
|
ImageSlotSchema,
|
|
16
|
-
ITimelineSlideDataStructure,
|
|
17
16
|
} from './slide-content.schema';
|
|
18
17
|
|
|
19
18
|
export const CoverSlideDataUserEditSchema = z.object({
|
|
@@ -147,25 +146,6 @@ export const ChartSlideDataUserEditSchema = z.object({
|
|
|
147
146
|
version: z.literal(1),
|
|
148
147
|
}) satisfies z.ZodType<IChartSlideDataStructure>;
|
|
149
148
|
|
|
150
|
-
export const TimelineSlideDataUserEditSchema = z.object({
|
|
151
|
-
contentType: z.literal(SLIDE_CONTENT_TYPE.TIMELINE),
|
|
152
|
-
title: z.string().min(1).max(500),
|
|
153
|
-
description: z.string().min(1).max(1000),
|
|
154
|
-
timeline: z.object({
|
|
155
|
-
events: z
|
|
156
|
-
.array(
|
|
157
|
-
z.object({
|
|
158
|
-
date: z.string().min(1).max(100),
|
|
159
|
-
title: z.string().min(1).max(200),
|
|
160
|
-
description: z.string().min(1).max(500),
|
|
161
|
-
}),
|
|
162
|
-
)
|
|
163
|
-
.min(2)
|
|
164
|
-
.max(10),
|
|
165
|
-
}),
|
|
166
|
-
version: z.literal(1),
|
|
167
|
-
}) satisfies z.ZodType<ITimelineSlideDataStructure>;
|
|
168
|
-
|
|
169
149
|
export const SlideContentUserEditSchema = z.discriminatedUnion('contentType', [
|
|
170
150
|
CoverSlideDataUserEditSchema,
|
|
171
151
|
StructuredListSlideDataUserEditSchema,
|
|
@@ -176,6 +156,5 @@ export const SlideContentUserEditSchema = z.discriminatedUnion('contentType', [
|
|
|
176
156
|
ThankYouSlideDataUserEditSchema,
|
|
177
157
|
TableSlideDataUserEditSchema,
|
|
178
158
|
ChartSlideDataUserEditSchema,
|
|
179
|
-
TimelineSlideDataUserEditSchema,
|
|
180
159
|
]);
|
|
181
160
|
export type SlideContentUserEdit = z.infer<typeof SlideContentUserEditSchema>;
|
|
@@ -108,20 +108,6 @@ export interface IChartSlideDataStructure {
|
|
|
108
108
|
version: 1;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
export interface ITimelineSlideDataStructure {
|
|
112
|
-
contentType: SLIDE_CONTENT_TYPE.TIMELINE;
|
|
113
|
-
title: string;
|
|
114
|
-
description: string;
|
|
115
|
-
timeline: {
|
|
116
|
-
events: Array<{
|
|
117
|
-
date: string;
|
|
118
|
-
title: string;
|
|
119
|
-
description: string;
|
|
120
|
-
}>;
|
|
121
|
-
};
|
|
122
|
-
version: 1;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
111
|
export const CoverSlideDataSchema = z.object({
|
|
126
112
|
contentType: z.literal(SLIDE_CONTENT_TYPE.COVER),
|
|
127
113
|
title: z.string().describe('Slide title in about 6 words').min(10).max(150),
|
|
@@ -327,36 +313,6 @@ export const ChartSlideDataSchema = z.object({
|
|
|
327
313
|
}) satisfies z.ZodType<IChartSlideDataStructure>;
|
|
328
314
|
export type ChartSlideData = z.infer<typeof ChartSlideDataSchema>;
|
|
329
315
|
|
|
330
|
-
export const TimelineSlideDataSchema = z.object({
|
|
331
|
-
contentType: z.literal(SLIDE_CONTENT_TYPE.TIMELINE),
|
|
332
|
-
title: z.string().describe('Slide title in about 6 words').min(10).max(150),
|
|
333
|
-
description: z.string().describe('Brief context for the timeline').min(10).max(200),
|
|
334
|
-
timeline: z.object({
|
|
335
|
-
events: z
|
|
336
|
-
.array(
|
|
337
|
-
z.object({
|
|
338
|
-
date: z
|
|
339
|
-
.string()
|
|
340
|
-
.describe(
|
|
341
|
-
'Date or time period label. MUST be general/approximate if exact date unknown (e.g., "Early 2020s", "Mid-1990s", "Recent years")',
|
|
342
|
-
)
|
|
343
|
-
.min(2)
|
|
344
|
-
.max(50),
|
|
345
|
-
title: z.string().describe('Event title in 2-4 words').min(5).max(80),
|
|
346
|
-
description: z
|
|
347
|
-
.string()
|
|
348
|
-
.describe('Brief description of the event or milestone')
|
|
349
|
-
.min(20)
|
|
350
|
-
.max(150),
|
|
351
|
-
}),
|
|
352
|
-
)
|
|
353
|
-
.length(5)
|
|
354
|
-
.describe('Timeline must contain exactly 5 chronological events'),
|
|
355
|
-
}),
|
|
356
|
-
version: z.literal(1),
|
|
357
|
-
}) satisfies z.ZodType<ITimelineSlideDataStructure>;
|
|
358
|
-
export type TimelineSlideData = z.infer<typeof TimelineSlideDataSchema>;
|
|
359
|
-
|
|
360
316
|
export const SlideContentSchema = z.discriminatedUnion('contentType', [
|
|
361
317
|
CoverSlideDataSchema,
|
|
362
318
|
StructuredListSlideDataSchema,
|
|
@@ -367,6 +323,5 @@ export const SlideContentSchema = z.discriminatedUnion('contentType', [
|
|
|
367
323
|
ThankYouSlideDataSchema,
|
|
368
324
|
TableSlideDataSchema,
|
|
369
325
|
ChartSlideDataSchema,
|
|
370
|
-
TimelineSlideDataSchema,
|
|
371
326
|
]);
|
|
372
327
|
export type SlideContent = z.infer<typeof SlideContentSchema>;
|
|
@@ -5,5 +5,4 @@ export enum VIDEO_GENERATION_STRATEGY {
|
|
|
5
5
|
RUNWAY_CALLBACK = 'RUNWAY_CALLBACK',
|
|
6
6
|
SORA_2_VIDEO_GENERATION_POLLING = 'SORA_2_VIDEO_GENERATION_POLLING',
|
|
7
7
|
SORA_2_VIDEO_GENERATION_CALLBACK = 'SORA_2_VIDEO_GENERATION_CALLBACK',
|
|
8
|
-
SEEDANCE_VIDEO_GENERATION_CALLBACK = 'SEEDANCE_VIDEO_GENERATION_CALLBACK',
|
|
9
8
|
}
|
|
@@ -20,11 +20,6 @@ export const VideoModelParamsSchema = z.object({
|
|
|
20
20
|
})
|
|
21
21
|
.optional(),
|
|
22
22
|
quality: z.string().optional(),
|
|
23
|
-
resolution: z
|
|
24
|
-
.object({
|
|
25
|
-
options: z.array(z.string()),
|
|
26
|
-
})
|
|
27
|
-
.optional(),
|
|
28
23
|
});
|
|
29
24
|
|
|
30
25
|
export type VideoModelParams = z.infer<typeof VideoModelParamsSchema>;
|
|
@@ -34,13 +29,11 @@ export const VideoGenerationRequestParamsSchema = z.object({
|
|
|
34
29
|
duration: z.number(),
|
|
35
30
|
aspectRatio: z.string().optional(),
|
|
36
31
|
quality: z.string().optional(),
|
|
37
|
-
resolution: z.string().optional(),
|
|
38
32
|
});
|
|
39
33
|
export type VideoGenerationRequestParams = z.infer<typeof VideoGenerationRequestParamsSchema>;
|
|
40
34
|
|
|
41
35
|
export const VideoModelPricingRuleConditionSchema = z.object({
|
|
42
|
-
aspectRatio: z.string()
|
|
43
|
-
resolution: z.string().optional(),
|
|
36
|
+
aspectRatio: z.string(),
|
|
44
37
|
});
|
|
45
38
|
export type VideoModelPricingRuleCondition = z.infer<typeof VideoModelPricingRuleConditionSchema>;
|
|
46
39
|
|
|
@@ -36,13 +36,7 @@ export function calculateVideoGenerationPrice({
|
|
|
36
36
|
params: VideoGenerationRequestParams;
|
|
37
37
|
rules: VideoModelPricingRules;
|
|
38
38
|
}) {
|
|
39
|
-
const
|
|
40
|
-
.filter((r) => r.type === VIDEO_PRICING_RULE_TYPE.PER_SECOND)
|
|
41
|
-
.find((r) => matchesCondition(r.condition, params));
|
|
42
|
-
|
|
43
|
-
const effectivePricePerSecond = perSecondRule ? perSecondRule.value : pricePerSecond;
|
|
44
|
-
|
|
45
|
-
const base = effectivePricePerSecond * params.duration;
|
|
39
|
+
const base = pricePerSecond * params.duration;
|
|
46
40
|
|
|
47
41
|
const flatMarkup = rules.reduce((sum, r) => {
|
|
48
42
|
if (r.type !== VIDEO_PRICING_RULE_TYPE.FLAT) {
|