@purpleschool/gptbot-tools 0.0.75 → 0.0.76-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.
@@ -0,0 +1 @@
1
+ export * from './routes';
@@ -0,0 +1,6 @@
1
+ export const AI_PROXY_CONTROLLER = 'ai-proxy';
2
+
3
+ export const AI_PROXY_ROUTES = {
4
+ VIDEO_CALLBACK: 'video/callback',
5
+ VIDEO_EDITOR_CALLBACK: 'video-editor/callback',
6
+ };
@@ -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,8 @@
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
+ };
@@ -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"));
@@ -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().optional(),
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),
@@ -6,5 +6,4 @@ exports.VIDEO_GENERATION_ROUTES = {
6
6
  KIE_VEO_CALLBACK: 'kie/veo/callback',
7
7
  KIE_RUNWAY_CALLBACK: 'kie/runway/callback',
8
8
  KIE_SORA_2_CALLBACK: 'kie/sora-2/callback',
9
- KIE_SEEDANCE_CALLBACK: 'kie/seedance/callback',
10
9
  };
@@ -17,11 +17,7 @@ function matchesCondition(condition, params) {
17
17
  });
18
18
  }
19
19
  function calculateVideoGenerationPrice({ pricePerSecond, params, rules, }) {
20
- const perSecondRule = rules
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;
@@ -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
@@ -9,6 +9,7 @@ export * from './writer';
9
9
  export * from './image-editor';
10
10
  export * from './video-editor';
11
11
  export * from './music';
12
+ export * from './ai-proxy';
12
13
 
13
14
  import * as common from './common';
14
15
  import * as paraphrase from './paraphrase';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot-tools",
3
- "version": "0.0.75",
3
+ "version": "0.0.76-ai-proxy",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "scripts": {
@@ -1,4 +1,3 @@
1
1
  export enum VIDEO_PRICING_RULE_TYPE {
2
2
  FLAT = 'flat',
3
- PER_SECOND = 'per_second',
4
3
  }
@@ -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().optional(),
43
- resolution: z.string().optional(),
36
+ aspectRatio: z.string(),
44
37
  });
45
38
  export type VideoModelPricingRuleCondition = z.infer<typeof VideoModelPricingRuleConditionSchema>;
46
39
 
@@ -4,5 +4,4 @@ export const VIDEO_GENERATION_ROUTES = {
4
4
  KIE_VEO_CALLBACK: 'kie/veo/callback',
5
5
  KIE_RUNWAY_CALLBACK: 'kie/runway/callback',
6
6
  KIE_SORA_2_CALLBACK: 'kie/sora-2/callback',
7
- KIE_SEEDANCE_CALLBACK: 'kie/seedance/callback',
8
7
  };
@@ -36,13 +36,7 @@ export function calculateVideoGenerationPrice({
36
36
  params: VideoGenerationRequestParams;
37
37
  rules: VideoModelPricingRules;
38
38
  }) {
39
- const perSecondRule = rules
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) {