@purpleschool/multisite 0.0.28 → 0.0.29
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/commands/image-editor/execute-image-editor.command.d.ts +12 -0
- package/build/commands/image-editor/execute-image-editor.command.d.ts.map +1 -1
- package/build/commands/image-editor/proxy-image-editor-callback.command.js +1 -1
- package/build/commands/image-editor/retry-image-editor-job.command.d.ts +12 -0
- package/build/commands/image-editor/retry-image-editor-job.command.d.ts.map +1 -1
- package/build/commands/image-editor/set-reaction-to-image-editor-job.command.d.ts +7 -0
- package/build/commands/image-editor/set-reaction-to-image-editor-job.command.d.ts.map +1 -1
- package/build/commands/image-editor/update-image-editor-job-title.command.d.ts +7 -0
- package/build/commands/image-editor/update-image-editor-job-title.command.d.ts.map +1 -1
- package/build/constants/image-editor/enums/image-editing-strategy.enum.d.ts +2 -1
- package/build/constants/image-editor/enums/image-editing-strategy.enum.d.ts.map +1 -1
- package/build/constants/image-editor/enums/image-editing-strategy.enum.js +1 -0
- package/build/helpers/image-generation/calculate-image-generation-price.helper.d.ts +4 -2
- package/build/helpers/image-generation/calculate-image-generation-price.helper.d.ts.map +1 -1
- package/build/helpers/index.d.ts +1 -0
- package/build/helpers/index.d.ts.map +1 -1
- package/build/helpers/index.js +1 -0
- package/build/helpers/openai-image-2/calculate-openai-image-2-price.helper.d.ts +20 -0
- package/build/helpers/openai-image-2/calculate-openai-image-2-price.helper.d.ts.map +1 -0
- package/build/helpers/openai-image-2/calculate-openai-image-2-price.helper.js +125 -0
- package/build/helpers/openai-image-2/index.d.ts +2 -0
- package/build/helpers/openai-image-2/index.d.ts.map +1 -0
- package/build/helpers/openai-image-2/index.js +17 -0
- package/build/models/image-editor/image-editor-config.schema.d.ts +25 -0
- package/build/models/image-editor/image-editor-config.schema.d.ts.map +1 -1
- package/build/models/image-editor/image-editor-job-params.schema.d.ts +3 -0
- package/build/models/image-editor/image-editor-job-params.schema.d.ts.map +1 -1
- package/build/models/image-editor/image-editor-job-params.schema.js +1 -0
- package/build/models/image-editor/image-editor-job-request-params.schema.d.ts +3 -0
- package/build/models/image-editor/image-editor-job-request-params.schema.d.ts.map +1 -1
- package/build/models/image-editor/image-editor-job-request-params.schema.js +1 -0
- package/build/models/image-editor/image-editor-job.schema.d.ts +5 -0
- package/build/models/image-editor/image-editor-job.schema.d.ts.map +1 -1
- package/build/models/image-editor/image-editor-model-params.schema.d.ts +13 -0
- package/build/models/image-editor/image-editor-model-params.schema.d.ts.map +1 -1
- package/build/models/image-editor/image-editor-model-params.schema.js +5 -0
- package/build/models/image-editor/image-editor-model.schema.d.ts +19 -0
- package/build/models/image-editor/image-editor-model.schema.d.ts.map +1 -1
- package/build/queries/image-editor/find-image-editor-jobs.command.d.ts +7 -0
- package/build/queries/image-editor/find-image-editor-jobs.command.d.ts.map +1 -1
- package/build/queries/image-editor/get-image-editor-config.command.d.ts +31 -0
- package/build/queries/image-editor/get-image-editor-config.command.d.ts.map +1 -1
- package/build/queries/image-editor/get-image-editor-job.command.d.ts +7 -0
- package/build/queries/image-editor/get-image-editor-job.command.d.ts.map +1 -1
- package/commands/image-editor/proxy-image-editor-callback.command.ts +1 -1
- package/constants/image-editor/enums/image-editing-strategy.enum.ts +1 -0
- package/helpers/image-generation/calculate-image-generation-price.helper.ts +4 -2
- package/helpers/index.ts +1 -0
- package/helpers/openai-image-2/calculate-openai-image-2-price.helper.ts +160 -0
- package/helpers/openai-image-2/index.ts +1 -0
- package/models/image-editor/image-editor-job-params.schema.ts +1 -0
- package/models/image-editor/image-editor-job-request-params.schema.ts +1 -0
- package/models/image-editor/image-editor-model-params.schema.ts +5 -0
- package/package.json +1 -1
|
@@ -7,14 +7,17 @@ export declare namespace ExecuteImageEditorCommand {
|
|
|
7
7
|
imageUrls: z.ZodArray<z.ZodString, "many">;
|
|
8
8
|
systemPromptId: z.ZodOptional<z.ZodString>;
|
|
9
9
|
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
10
|
+
resolution: z.ZodOptional<z.ZodString>;
|
|
10
11
|
}, "strip", z.ZodTypeAny, {
|
|
11
12
|
imageUrls: string[];
|
|
12
13
|
systemPromptId?: string | undefined;
|
|
13
14
|
aspectRatio?: string | undefined;
|
|
15
|
+
resolution?: string | undefined;
|
|
14
16
|
}, {
|
|
15
17
|
imageUrls: string[];
|
|
16
18
|
systemPromptId?: string | undefined;
|
|
17
19
|
aspectRatio?: string | undefined;
|
|
20
|
+
resolution?: string | undefined;
|
|
18
21
|
}>;
|
|
19
22
|
}, "strip", z.ZodTypeAny, {
|
|
20
23
|
modelId: string;
|
|
@@ -23,6 +26,7 @@ export declare namespace ExecuteImageEditorCommand {
|
|
|
23
26
|
imageUrls: string[];
|
|
24
27
|
systemPromptId?: string | undefined;
|
|
25
28
|
aspectRatio?: string | undefined;
|
|
29
|
+
resolution?: string | undefined;
|
|
26
30
|
};
|
|
27
31
|
}, {
|
|
28
32
|
modelId: string;
|
|
@@ -31,6 +35,7 @@ export declare namespace ExecuteImageEditorCommand {
|
|
|
31
35
|
imageUrls: string[];
|
|
32
36
|
systemPromptId?: string | undefined;
|
|
33
37
|
aspectRatio?: string | undefined;
|
|
38
|
+
resolution?: string | undefined;
|
|
34
39
|
};
|
|
35
40
|
}>;
|
|
36
41
|
type Request = z.infer<typeof RequestSchema>;
|
|
@@ -76,6 +81,7 @@ export declare namespace ExecuteImageEditorCommand {
|
|
|
76
81
|
imageUrls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
77
82
|
systemPromptId: z.ZodOptional<z.ZodString>;
|
|
78
83
|
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
84
|
+
resolution: z.ZodOptional<z.ZodString>;
|
|
79
85
|
userHasActiveSubscriptionOrProduct: z.ZodOptional<z.ZodBoolean>;
|
|
80
86
|
}, "strip", z.ZodTypeAny, {
|
|
81
87
|
attachedFiles?: {
|
|
@@ -90,6 +96,7 @@ export declare namespace ExecuteImageEditorCommand {
|
|
|
90
96
|
imageUrls?: string[] | undefined;
|
|
91
97
|
systemPromptId?: string | undefined;
|
|
92
98
|
aspectRatio?: string | undefined;
|
|
99
|
+
resolution?: string | undefined;
|
|
93
100
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
94
101
|
}, {
|
|
95
102
|
attachedFiles?: {
|
|
@@ -104,6 +111,7 @@ export declare namespace ExecuteImageEditorCommand {
|
|
|
104
111
|
imageUrls?: string[] | undefined;
|
|
105
112
|
systemPromptId?: string | undefined;
|
|
106
113
|
aspectRatio?: string | undefined;
|
|
114
|
+
resolution?: string | undefined;
|
|
107
115
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
108
116
|
}>;
|
|
109
117
|
imageUrls: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -141,6 +149,7 @@ export declare namespace ExecuteImageEditorCommand {
|
|
|
141
149
|
imageUrls?: string[] | undefined;
|
|
142
150
|
systemPromptId?: string | undefined;
|
|
143
151
|
aspectRatio?: string | undefined;
|
|
152
|
+
resolution?: string | undefined;
|
|
144
153
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
145
154
|
};
|
|
146
155
|
imageUrls: string[];
|
|
@@ -178,6 +187,7 @@ export declare namespace ExecuteImageEditorCommand {
|
|
|
178
187
|
imageUrls?: string[] | undefined;
|
|
179
188
|
systemPromptId?: string | undefined;
|
|
180
189
|
aspectRatio?: string | undefined;
|
|
190
|
+
resolution?: string | undefined;
|
|
181
191
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
182
192
|
};
|
|
183
193
|
imageUrls?: string[] | undefined;
|
|
@@ -217,6 +227,7 @@ export declare namespace ExecuteImageEditorCommand {
|
|
|
217
227
|
imageUrls?: string[] | undefined;
|
|
218
228
|
systemPromptId?: string | undefined;
|
|
219
229
|
aspectRatio?: string | undefined;
|
|
230
|
+
resolution?: string | undefined;
|
|
220
231
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
221
232
|
};
|
|
222
233
|
imageUrls: string[];
|
|
@@ -256,6 +267,7 @@ export declare namespace ExecuteImageEditorCommand {
|
|
|
256
267
|
imageUrls?: string[] | undefined;
|
|
257
268
|
systemPromptId?: string | undefined;
|
|
258
269
|
aspectRatio?: string | undefined;
|
|
270
|
+
resolution?: string | undefined;
|
|
259
271
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
260
272
|
};
|
|
261
273
|
imageUrls?: string[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-image-editor.command.d.ts","sourceRoot":"","sources":["../../../commands/image-editor/execute-image-editor.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,yBAAiB,yBAAyB,CAAC;IAChC,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"execute-image-editor.command.d.ts","sourceRoot":"","sources":["../../../commands/image-editor/execute-image-editor.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,yBAAiB,yBAAyB,CAAC;IAChC,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAIxB,CAAC;IAEH,KAAY,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;IAE7C,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
|
|
@@ -6,7 +6,7 @@ var ProxyImageEditorCallbackCommand;
|
|
|
6
6
|
(function (ProxyImageEditorCallbackCommand) {
|
|
7
7
|
ProxyImageEditorCallbackCommand.RequestSchema = zod_1.z.object({
|
|
8
8
|
jobId: zod_1.z.string().min(1),
|
|
9
|
-
imageUrl: zod_1.z.string().
|
|
9
|
+
imageUrl: zod_1.z.string().min(1).optional(),
|
|
10
10
|
error: zod_1.z.string().optional(),
|
|
11
11
|
});
|
|
12
12
|
ProxyImageEditorCallbackCommand.ResponseSchema = zod_1.z.object({
|
|
@@ -7,14 +7,17 @@ export declare namespace RetryImageEditorJobCommand {
|
|
|
7
7
|
imageUrls: z.ZodArray<z.ZodString, "many">;
|
|
8
8
|
systemPromptId: z.ZodOptional<z.ZodString>;
|
|
9
9
|
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
10
|
+
resolution: z.ZodOptional<z.ZodString>;
|
|
10
11
|
}, "strip", z.ZodTypeAny, {
|
|
11
12
|
imageUrls: string[];
|
|
12
13
|
systemPromptId?: string | undefined;
|
|
13
14
|
aspectRatio?: string | undefined;
|
|
15
|
+
resolution?: string | undefined;
|
|
14
16
|
}, {
|
|
15
17
|
imageUrls: string[];
|
|
16
18
|
systemPromptId?: string | undefined;
|
|
17
19
|
aspectRatio?: string | undefined;
|
|
20
|
+
resolution?: string | undefined;
|
|
18
21
|
}>>;
|
|
19
22
|
}, "strip", z.ZodTypeAny, {
|
|
20
23
|
prompt?: string | undefined;
|
|
@@ -23,6 +26,7 @@ export declare namespace RetryImageEditorJobCommand {
|
|
|
23
26
|
imageUrls: string[];
|
|
24
27
|
systemPromptId?: string | undefined;
|
|
25
28
|
aspectRatio?: string | undefined;
|
|
29
|
+
resolution?: string | undefined;
|
|
26
30
|
} | undefined;
|
|
27
31
|
}, {
|
|
28
32
|
prompt?: string | undefined;
|
|
@@ -31,6 +35,7 @@ export declare namespace RetryImageEditorJobCommand {
|
|
|
31
35
|
imageUrls: string[];
|
|
32
36
|
systemPromptId?: string | undefined;
|
|
33
37
|
aspectRatio?: string | undefined;
|
|
38
|
+
resolution?: string | undefined;
|
|
34
39
|
} | undefined;
|
|
35
40
|
}>;
|
|
36
41
|
type Request = z.infer<typeof RequestSchema>;
|
|
@@ -76,6 +81,7 @@ export declare namespace RetryImageEditorJobCommand {
|
|
|
76
81
|
imageUrls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
77
82
|
systemPromptId: z.ZodOptional<z.ZodString>;
|
|
78
83
|
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
84
|
+
resolution: z.ZodOptional<z.ZodString>;
|
|
79
85
|
userHasActiveSubscriptionOrProduct: z.ZodOptional<z.ZodBoolean>;
|
|
80
86
|
}, "strip", z.ZodTypeAny, {
|
|
81
87
|
attachedFiles?: {
|
|
@@ -90,6 +96,7 @@ export declare namespace RetryImageEditorJobCommand {
|
|
|
90
96
|
imageUrls?: string[] | undefined;
|
|
91
97
|
systemPromptId?: string | undefined;
|
|
92
98
|
aspectRatio?: string | undefined;
|
|
99
|
+
resolution?: string | undefined;
|
|
93
100
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
94
101
|
}, {
|
|
95
102
|
attachedFiles?: {
|
|
@@ -104,6 +111,7 @@ export declare namespace RetryImageEditorJobCommand {
|
|
|
104
111
|
imageUrls?: string[] | undefined;
|
|
105
112
|
systemPromptId?: string | undefined;
|
|
106
113
|
aspectRatio?: string | undefined;
|
|
114
|
+
resolution?: string | undefined;
|
|
107
115
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
108
116
|
}>;
|
|
109
117
|
imageUrls: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -141,6 +149,7 @@ export declare namespace RetryImageEditorJobCommand {
|
|
|
141
149
|
imageUrls?: string[] | undefined;
|
|
142
150
|
systemPromptId?: string | undefined;
|
|
143
151
|
aspectRatio?: string | undefined;
|
|
152
|
+
resolution?: string | undefined;
|
|
144
153
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
145
154
|
};
|
|
146
155
|
imageUrls: string[];
|
|
@@ -178,6 +187,7 @@ export declare namespace RetryImageEditorJobCommand {
|
|
|
178
187
|
imageUrls?: string[] | undefined;
|
|
179
188
|
systemPromptId?: string | undefined;
|
|
180
189
|
aspectRatio?: string | undefined;
|
|
190
|
+
resolution?: string | undefined;
|
|
181
191
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
182
192
|
};
|
|
183
193
|
imageUrls?: string[] | undefined;
|
|
@@ -217,6 +227,7 @@ export declare namespace RetryImageEditorJobCommand {
|
|
|
217
227
|
imageUrls?: string[] | undefined;
|
|
218
228
|
systemPromptId?: string | undefined;
|
|
219
229
|
aspectRatio?: string | undefined;
|
|
230
|
+
resolution?: string | undefined;
|
|
220
231
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
221
232
|
};
|
|
222
233
|
imageUrls: string[];
|
|
@@ -256,6 +267,7 @@ export declare namespace RetryImageEditorJobCommand {
|
|
|
256
267
|
imageUrls?: string[] | undefined;
|
|
257
268
|
systemPromptId?: string | undefined;
|
|
258
269
|
aspectRatio?: string | undefined;
|
|
270
|
+
resolution?: string | undefined;
|
|
259
271
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
260
272
|
};
|
|
261
273
|
imageUrls?: string[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry-image-editor-job.command.d.ts","sourceRoot":"","sources":["../../../commands/image-editor/retry-image-editor-job.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,yBAAiB,0BAA0B,CAAC;IACjC,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"retry-image-editor-job.command.d.ts","sourceRoot":"","sources":["../../../commands/image-editor/retry-image-editor-job.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,yBAAiB,0BAA0B,CAAC;IACjC,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAIxB,CAAC;IAEH,KAAY,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;IAE7C,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEzB,CAAC;IACH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
|
|
@@ -54,6 +54,7 @@ export declare namespace SetReactionToImageEditorJobCommand {
|
|
|
54
54
|
imageUrls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
55
55
|
systemPromptId: z.ZodOptional<z.ZodString>;
|
|
56
56
|
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
57
|
+
resolution: z.ZodOptional<z.ZodString>;
|
|
57
58
|
userHasActiveSubscriptionOrProduct: z.ZodOptional<z.ZodBoolean>;
|
|
58
59
|
}, "strip", z.ZodTypeAny, {
|
|
59
60
|
attachedFiles?: {
|
|
@@ -68,6 +69,7 @@ export declare namespace SetReactionToImageEditorJobCommand {
|
|
|
68
69
|
imageUrls?: string[] | undefined;
|
|
69
70
|
systemPromptId?: string | undefined;
|
|
70
71
|
aspectRatio?: string | undefined;
|
|
72
|
+
resolution?: string | undefined;
|
|
71
73
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
72
74
|
}, {
|
|
73
75
|
attachedFiles?: {
|
|
@@ -82,6 +84,7 @@ export declare namespace SetReactionToImageEditorJobCommand {
|
|
|
82
84
|
imageUrls?: string[] | undefined;
|
|
83
85
|
systemPromptId?: string | undefined;
|
|
84
86
|
aspectRatio?: string | undefined;
|
|
87
|
+
resolution?: string | undefined;
|
|
85
88
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
86
89
|
}>;
|
|
87
90
|
imageUrls: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -119,6 +122,7 @@ export declare namespace SetReactionToImageEditorJobCommand {
|
|
|
119
122
|
imageUrls?: string[] | undefined;
|
|
120
123
|
systemPromptId?: string | undefined;
|
|
121
124
|
aspectRatio?: string | undefined;
|
|
125
|
+
resolution?: string | undefined;
|
|
122
126
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
123
127
|
};
|
|
124
128
|
imageUrls: string[];
|
|
@@ -156,6 +160,7 @@ export declare namespace SetReactionToImageEditorJobCommand {
|
|
|
156
160
|
imageUrls?: string[] | undefined;
|
|
157
161
|
systemPromptId?: string | undefined;
|
|
158
162
|
aspectRatio?: string | undefined;
|
|
163
|
+
resolution?: string | undefined;
|
|
159
164
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
160
165
|
};
|
|
161
166
|
imageUrls?: string[] | undefined;
|
|
@@ -195,6 +200,7 @@ export declare namespace SetReactionToImageEditorJobCommand {
|
|
|
195
200
|
imageUrls?: string[] | undefined;
|
|
196
201
|
systemPromptId?: string | undefined;
|
|
197
202
|
aspectRatio?: string | undefined;
|
|
203
|
+
resolution?: string | undefined;
|
|
198
204
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
199
205
|
};
|
|
200
206
|
imageUrls: string[];
|
|
@@ -234,6 +240,7 @@ export declare namespace SetReactionToImageEditorJobCommand {
|
|
|
234
240
|
imageUrls?: string[] | undefined;
|
|
235
241
|
systemPromptId?: string | undefined;
|
|
236
242
|
aspectRatio?: string | undefined;
|
|
243
|
+
resolution?: string | undefined;
|
|
237
244
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
238
245
|
};
|
|
239
246
|
imageUrls?: string[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-reaction-to-image-editor-job.command.d.ts","sourceRoot":"","sources":["../../../commands/image-editor/set-reaction-to-image-editor-job.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,yBAAiB,kCAAkC,CAAC;IACzC,MAAM,aAAa;;;;;;;;;MAGxB,CAAC;IAEH,KAAY,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;IAE7C,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"set-reaction-to-image-editor-job.command.d.ts","sourceRoot":"","sources":["../../../commands/image-editor/set-reaction-to-image-editor-job.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,yBAAiB,kCAAkC,CAAC;IACzC,MAAM,aAAa;;;;;;;;;MAGxB,CAAC;IAEH,KAAY,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;IAE7C,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
|
|
@@ -50,6 +50,7 @@ export declare namespace UpdateImageEditorJobTitleCommand {
|
|
|
50
50
|
imageUrls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
51
51
|
systemPromptId: z.ZodOptional<z.ZodString>;
|
|
52
52
|
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
53
|
+
resolution: z.ZodOptional<z.ZodString>;
|
|
53
54
|
userHasActiveSubscriptionOrProduct: z.ZodOptional<z.ZodBoolean>;
|
|
54
55
|
}, "strip", z.ZodTypeAny, {
|
|
55
56
|
attachedFiles?: {
|
|
@@ -64,6 +65,7 @@ export declare namespace UpdateImageEditorJobTitleCommand {
|
|
|
64
65
|
imageUrls?: string[] | undefined;
|
|
65
66
|
systemPromptId?: string | undefined;
|
|
66
67
|
aspectRatio?: string | undefined;
|
|
68
|
+
resolution?: string | undefined;
|
|
67
69
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
68
70
|
}, {
|
|
69
71
|
attachedFiles?: {
|
|
@@ -78,6 +80,7 @@ export declare namespace UpdateImageEditorJobTitleCommand {
|
|
|
78
80
|
imageUrls?: string[] | undefined;
|
|
79
81
|
systemPromptId?: string | undefined;
|
|
80
82
|
aspectRatio?: string | undefined;
|
|
83
|
+
resolution?: string | undefined;
|
|
81
84
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
82
85
|
}>;
|
|
83
86
|
imageUrls: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -115,6 +118,7 @@ export declare namespace UpdateImageEditorJobTitleCommand {
|
|
|
115
118
|
imageUrls?: string[] | undefined;
|
|
116
119
|
systemPromptId?: string | undefined;
|
|
117
120
|
aspectRatio?: string | undefined;
|
|
121
|
+
resolution?: string | undefined;
|
|
118
122
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
119
123
|
};
|
|
120
124
|
imageUrls: string[];
|
|
@@ -152,6 +156,7 @@ export declare namespace UpdateImageEditorJobTitleCommand {
|
|
|
152
156
|
imageUrls?: string[] | undefined;
|
|
153
157
|
systemPromptId?: string | undefined;
|
|
154
158
|
aspectRatio?: string | undefined;
|
|
159
|
+
resolution?: string | undefined;
|
|
155
160
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
156
161
|
};
|
|
157
162
|
imageUrls?: string[] | undefined;
|
|
@@ -191,6 +196,7 @@ export declare namespace UpdateImageEditorJobTitleCommand {
|
|
|
191
196
|
imageUrls?: string[] | undefined;
|
|
192
197
|
systemPromptId?: string | undefined;
|
|
193
198
|
aspectRatio?: string | undefined;
|
|
199
|
+
resolution?: string | undefined;
|
|
194
200
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
195
201
|
};
|
|
196
202
|
imageUrls: string[];
|
|
@@ -230,6 +236,7 @@ export declare namespace UpdateImageEditorJobTitleCommand {
|
|
|
230
236
|
imageUrls?: string[] | undefined;
|
|
231
237
|
systemPromptId?: string | undefined;
|
|
232
238
|
aspectRatio?: string | undefined;
|
|
239
|
+
resolution?: string | undefined;
|
|
233
240
|
userHasActiveSubscriptionOrProduct?: boolean | undefined;
|
|
234
241
|
};
|
|
235
242
|
imageUrls?: string[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-image-editor-job-title.command.d.ts","sourceRoot":"","sources":["../../../commands/image-editor/update-image-editor-job-title.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,yBAAiB,gCAAgC,CAAC;IACvC,MAAM,aAAa;;;;;;MAExB,CAAC;IAEH,KAAY,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;IAE7C,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"update-image-editor-job-title.command.d.ts","sourceRoot":"","sources":["../../../commands/image-editor/update-image-editor-job-title.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,yBAAiB,gCAAgC,CAAC;IACvC,MAAM,aAAa;;;;;;MAExB,CAAC;IAEH,KAAY,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;IAE7C,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
|
|
@@ -5,6 +5,7 @@ export declare enum IMAGE_EDITING_STRATEGY {
|
|
|
5
5
|
RECRAFT_REMOVE_BACKGROUND_POLLING = "RECRAFT_REMOVE_BACKGROUND_POLLING",
|
|
6
6
|
NANO_BANANA_PRO_CALLBACK = "NANO_BANANA_PRO_CALLBACK",
|
|
7
7
|
NANO_BANANA_PRO_POLLING = "NANO_BANANA_PRO_POLLING",
|
|
8
|
-
SEEDREAM_EDITING_CALLBACK = "SEEDREAM_EDITING_CALLBACK"
|
|
8
|
+
SEEDREAM_EDITING_CALLBACK = "SEEDREAM_EDITING_CALLBACK",
|
|
9
|
+
OPENAI_IMAGE_2_CALLBACK = "OPENAI_IMAGE_2_CALLBACK"
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=image-editing-strategy.enum.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-editing-strategy.enum.d.ts","sourceRoot":"","sources":["../../../../constants/image-editor/enums/image-editing-strategy.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,sBAAsB;IAC9B,mBAAmB,wBAAwB;IAC3C,oBAAoB,yBAAyB;IAC7C,kCAAkC,uCAAuC;IACzE,iCAAiC,sCAAsC;IACvE,wBAAwB,6BAA6B;IACrD,uBAAuB,4BAA4B;IACnD,yBAAyB,8BAA8B;
|
|
1
|
+
{"version":3,"file":"image-editing-strategy.enum.d.ts","sourceRoot":"","sources":["../../../../constants/image-editor/enums/image-editing-strategy.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,sBAAsB;IAC9B,mBAAmB,wBAAwB;IAC3C,oBAAoB,yBAAyB;IAC7C,kCAAkC,uCAAuC;IACzE,iCAAiC,sCAAsC;IACvE,wBAAwB,6BAA6B;IACrD,uBAAuB,4BAA4B;IACnD,yBAAyB,8BAA8B;IACvD,uBAAuB,4BAA4B;CACtD"}
|
|
@@ -10,4 +10,5 @@ var IMAGE_EDITING_STRATEGY;
|
|
|
10
10
|
IMAGE_EDITING_STRATEGY["NANO_BANANA_PRO_CALLBACK"] = "NANO_BANANA_PRO_CALLBACK";
|
|
11
11
|
IMAGE_EDITING_STRATEGY["NANO_BANANA_PRO_POLLING"] = "NANO_BANANA_PRO_POLLING";
|
|
12
12
|
IMAGE_EDITING_STRATEGY["SEEDREAM_EDITING_CALLBACK"] = "SEEDREAM_EDITING_CALLBACK";
|
|
13
|
+
IMAGE_EDITING_STRATEGY["OPENAI_IMAGE_2_CALLBACK"] = "OPENAI_IMAGE_2_CALLBACK";
|
|
13
14
|
})(IMAGE_EDITING_STRATEGY || (exports.IMAGE_EDITING_STRATEGY = IMAGE_EDITING_STRATEGY = {}));
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ImageGenerationPricingRules } from '../../models';
|
|
2
2
|
export declare function calculateImageGenerationPrice({ basePrice, params, userHasActiveSubscriptionOrProduct, rules, }: {
|
|
3
3
|
basePrice: number;
|
|
4
|
-
params:
|
|
4
|
+
params: {
|
|
5
|
+
resolution?: string;
|
|
6
|
+
};
|
|
5
7
|
userHasActiveSubscriptionOrProduct: boolean;
|
|
6
8
|
rules: ImageGenerationPricingRules;
|
|
7
9
|
}): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-image-generation-price.helper.d.ts","sourceRoot":"","sources":["../../../helpers/image-generation/calculate-image-generation-price.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"calculate-image-generation-price.helper.d.ts","sourceRoot":"","sources":["../../../helpers/image-generation/calculate-image-generation-price.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAE3D,wBAAgB,6BAA6B,CAAC,EAC1C,SAAS,EACT,MAAM,EACN,kCAAkC,EAClC,KAAK,GACR,EAAE;IACC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE;QACJ,UAAU,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,kCAAkC,EAAE,OAAO,CAAC;IAC5C,KAAK,EAAE,2BAA2B,CAAC;CACtC,GAAG,MAAM,CAgBT"}
|
package/build/helpers/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
|
package/build/helpers/index.js
CHANGED
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./image-generation"), exports);
|
|
18
18
|
__exportStar(require("./image-editor"), exports);
|
|
19
|
+
__exportStar(require("./openai-image-2"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type Image2Size = {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
};
|
|
5
|
+
export type OpenAIImage2PricedModel = {
|
|
6
|
+
aiModel: string;
|
|
7
|
+
params?: {
|
|
8
|
+
quality?: unknown;
|
|
9
|
+
aspectRatio?: Partial<Record<string, Image2Size | 'auto'>>;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare function isOpenAIImage2Model(model: Pick<OpenAIImage2PricedModel, 'aiModel'>): boolean;
|
|
13
|
+
export declare function calculateOpenAIImage2InternalPrice(params: {
|
|
14
|
+
model: OpenAIImage2PricedModel;
|
|
15
|
+
aspectRatio: string;
|
|
16
|
+
resolution?: string;
|
|
17
|
+
hasAttachedImage?: boolean;
|
|
18
|
+
}): number | null;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=calculate-openai-image-2-price.helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculate-openai-image-2-price.helper.d.ts","sourceRoot":"","sources":["../../../helpers/openai-image-2/calculate-openai-image-2-price.helper.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD,MAAM,MAAM,uBAAuB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE;QACL,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,WAAW,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC;KAC9D,CAAC;CACL,CAAC;AAwBF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,uBAAuB,EAAE,SAAS,CAAC,GAAG,OAAO,CAE5F;AAED,wBAAgB,kCAAkC,CAAC,MAAM,EAAE;IACvD,KAAK,EAAE,uBAAuB,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B,GAAG,MAAM,GAAG,IAAI,CAiChB"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isOpenAIImage2Model = isOpenAIImage2Model;
|
|
4
|
+
exports.calculateOpenAIImage2InternalPrice = calculateOpenAIImage2InternalPrice;
|
|
5
|
+
const LOW_QUALITY_SURCHARGE_STARS = 2;
|
|
6
|
+
const OPENAI_OUTPUT_PRICE_PER_1M_USD = 30;
|
|
7
|
+
const STAR_PRICE_USD = 0.018;
|
|
8
|
+
const TARGET_MARGIN = 0.6;
|
|
9
|
+
const IMAGE_2_INPUT_IMAGE_SURCHARGE_STARS = 2;
|
|
10
|
+
const IMAGE_2_QUALITY_BASE_TOKENS = {
|
|
11
|
+
low: 16,
|
|
12
|
+
medium: 48,
|
|
13
|
+
high: 96,
|
|
14
|
+
};
|
|
15
|
+
const IMAGE_2_RESOLUTION_MULTIPLIER = {
|
|
16
|
+
'1K': 1,
|
|
17
|
+
'2K': 2,
|
|
18
|
+
'4K': 4,
|
|
19
|
+
};
|
|
20
|
+
const IMAGE_2_MAX_EDGE = 3840;
|
|
21
|
+
const IMAGE_2_MAX_PIXEL_BUDGET = 8294400;
|
|
22
|
+
const IMAGE_2_SIZE_STEP = 16;
|
|
23
|
+
function isOpenAIImage2Model(model) {
|
|
24
|
+
return model.aiModel.toLowerCase().startsWith('gpt-image-2');
|
|
25
|
+
}
|
|
26
|
+
function calculateOpenAIImage2InternalPrice(params) {
|
|
27
|
+
var _a, _b, _c;
|
|
28
|
+
const { model, aspectRatio, resolution, hasAttachedImage = false } = params;
|
|
29
|
+
const quality = resolveQuality(model.aiModel, (_a = model.params) === null || _a === void 0 ? void 0 : _a.quality);
|
|
30
|
+
const normalizedResolution = normalizeResolution(resolution);
|
|
31
|
+
const baseSize = (_c = (_b = model.params) === null || _b === void 0 ? void 0 : _b.aspectRatio) === null || _c === void 0 ? void 0 : _c[aspectRatio];
|
|
32
|
+
if (!quality || !isImage2Size(baseSize) || !normalizedResolution) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const multiplier = IMAGE_2_RESOLUTION_MULTIPLIER[normalizedResolution];
|
|
36
|
+
const normalizedSize = normalizeImage2SizeToOpenAILimits({
|
|
37
|
+
width: Math.round(baseSize.width * multiplier),
|
|
38
|
+
height: Math.round(baseSize.height * multiplier),
|
|
39
|
+
});
|
|
40
|
+
const outputTokens = calculateImage2OutputTokens(Object.assign({ quality }, normalizedSize));
|
|
41
|
+
const costUsd = (outputTokens / 1000000) * OPENAI_OUTPUT_PRICE_PER_1M_USD;
|
|
42
|
+
const sellUsd = costUsd / (1 - TARGET_MARGIN);
|
|
43
|
+
let finalStars = Math.max(1, Math.ceil(sellUsd / STAR_PRICE_USD));
|
|
44
|
+
if (hasAttachedImage) {
|
|
45
|
+
finalStars += IMAGE_2_INPUT_IMAGE_SURCHARGE_STARS;
|
|
46
|
+
}
|
|
47
|
+
if (quality === 'low') {
|
|
48
|
+
finalStars += LOW_QUALITY_SURCHARGE_STARS;
|
|
49
|
+
}
|
|
50
|
+
return finalStars;
|
|
51
|
+
}
|
|
52
|
+
function isImage2Size(value) {
|
|
53
|
+
if (!value || typeof value !== 'object')
|
|
54
|
+
return false;
|
|
55
|
+
const candidate = value;
|
|
56
|
+
return typeof candidate.width === 'number' && typeof candidate.height === 'number';
|
|
57
|
+
}
|
|
58
|
+
function resolveQuality(aiModel, rawQuality) {
|
|
59
|
+
const normalizedModel = aiModel.toLowerCase();
|
|
60
|
+
if (normalizedModel.endsWith('-low'))
|
|
61
|
+
return 'low';
|
|
62
|
+
if (normalizedModel.endsWith('-medium'))
|
|
63
|
+
return 'medium';
|
|
64
|
+
if (normalizedModel.endsWith('-high'))
|
|
65
|
+
return 'high';
|
|
66
|
+
if (typeof rawQuality === 'string') {
|
|
67
|
+
return normalizeQuality(rawQuality);
|
|
68
|
+
}
|
|
69
|
+
if (rawQuality && typeof rawQuality === 'object') {
|
|
70
|
+
const values = Object.values(rawQuality);
|
|
71
|
+
for (const value of values) {
|
|
72
|
+
if (typeof value !== 'string')
|
|
73
|
+
continue;
|
|
74
|
+
const normalized = normalizeQuality(value);
|
|
75
|
+
if (normalized)
|
|
76
|
+
return normalized;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
function normalizeQuality(value) {
|
|
82
|
+
const normalized = value.trim().toLowerCase();
|
|
83
|
+
if (normalized === 'low')
|
|
84
|
+
return 'low';
|
|
85
|
+
if (normalized === 'medium')
|
|
86
|
+
return 'medium';
|
|
87
|
+
if (normalized === 'high')
|
|
88
|
+
return 'high';
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
function normalizeResolution(value) {
|
|
92
|
+
if (!value)
|
|
93
|
+
return '1K';
|
|
94
|
+
if (value === '1K' || value === '2K' || value === '4K') {
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
function normalizeImage2SizeToOpenAILimits(size) {
|
|
100
|
+
let scale = 1;
|
|
101
|
+
const longestEdge = Math.max(size.width, size.height);
|
|
102
|
+
if (longestEdge > IMAGE_2_MAX_EDGE) {
|
|
103
|
+
scale = Math.min(scale, IMAGE_2_MAX_EDGE / longestEdge);
|
|
104
|
+
}
|
|
105
|
+
const pixelCount = size.width * size.height;
|
|
106
|
+
if (pixelCount > IMAGE_2_MAX_PIXEL_BUDGET) {
|
|
107
|
+
scale = Math.min(scale, Math.sqrt(IMAGE_2_MAX_PIXEL_BUDGET / pixelCount));
|
|
108
|
+
}
|
|
109
|
+
const normalizedWidth = Math.floor((size.width * scale) / IMAGE_2_SIZE_STEP) * IMAGE_2_SIZE_STEP;
|
|
110
|
+
const normalizedHeight = Math.floor((size.height * scale) / IMAGE_2_SIZE_STEP) * IMAGE_2_SIZE_STEP;
|
|
111
|
+
return {
|
|
112
|
+
width: Math.max(IMAGE_2_SIZE_STEP, normalizedWidth),
|
|
113
|
+
height: Math.max(IMAGE_2_SIZE_STEP, normalizedHeight),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function calculateImage2OutputTokens(params) {
|
|
117
|
+
const { quality, width, height } = params;
|
|
118
|
+
const longestEdge = Math.max(width, height);
|
|
119
|
+
const shortestEdge = Math.min(width, height);
|
|
120
|
+
const qualityBaseTokens = IMAGE_2_QUALITY_BASE_TOKENS[quality];
|
|
121
|
+
const scaledShortEdgeTokens = Math.round((qualityBaseTokens * shortestEdge) / longestEdge);
|
|
122
|
+
const widthTokens = width >= height ? qualityBaseTokens : scaledShortEdgeTokens;
|
|
123
|
+
const heightTokens = width >= height ? scaledShortEdgeTokens : qualityBaseTokens;
|
|
124
|
+
return Math.ceil((widthTokens * heightTokens * (2000000 + width * height)) / 4000000);
|
|
125
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../helpers/openai-image-2/index.ts"],"names":[],"mappings":"AAAA,cAAc,yCAAyC,CAAC"}
|
|
@@ -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("./calculate-openai-image-2-price.helper"), exports);
|
|
@@ -76,6 +76,13 @@ export declare const ImageEditorConfigSchema: z.ZodObject<{
|
|
|
76
76
|
width: number;
|
|
77
77
|
height: number;
|
|
78
78
|
}>>;
|
|
79
|
+
resolution: z.ZodOptional<z.ZodObject<{
|
|
80
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
options: string[];
|
|
83
|
+
}, {
|
|
84
|
+
options: string[];
|
|
85
|
+
}>>;
|
|
79
86
|
}, "strip", z.ZodTypeAny, {
|
|
80
87
|
imageAttachment: {
|
|
81
88
|
supported: boolean;
|
|
@@ -86,6 +93,9 @@ export declare const ImageEditorConfigSchema: z.ZodObject<{
|
|
|
86
93
|
width: number;
|
|
87
94
|
height: number;
|
|
88
95
|
}>;
|
|
96
|
+
resolution?: {
|
|
97
|
+
options: string[];
|
|
98
|
+
} | undefined;
|
|
89
99
|
}, {
|
|
90
100
|
imageAttachment: {
|
|
91
101
|
supported: boolean;
|
|
@@ -96,6 +106,9 @@ export declare const ImageEditorConfigSchema: z.ZodObject<{
|
|
|
96
106
|
width: number;
|
|
97
107
|
height: number;
|
|
98
108
|
}>;
|
|
109
|
+
resolution?: {
|
|
110
|
+
options: string[];
|
|
111
|
+
} | undefined;
|
|
99
112
|
}>;
|
|
100
113
|
pricingRules: z.ZodArray<z.ZodObject<{
|
|
101
114
|
condition: z.ZodObject<{
|
|
@@ -153,6 +166,9 @@ export declare const ImageEditorConfigSchema: z.ZodObject<{
|
|
|
153
166
|
width: number;
|
|
154
167
|
height: number;
|
|
155
168
|
}>;
|
|
169
|
+
resolution?: {
|
|
170
|
+
options: string[];
|
|
171
|
+
} | undefined;
|
|
156
172
|
};
|
|
157
173
|
pricingRules: {
|
|
158
174
|
condition: {
|
|
@@ -196,6 +212,9 @@ export declare const ImageEditorConfigSchema: z.ZodObject<{
|
|
|
196
212
|
width: number;
|
|
197
213
|
height: number;
|
|
198
214
|
}>;
|
|
215
|
+
resolution?: {
|
|
216
|
+
options: string[];
|
|
217
|
+
} | undefined;
|
|
199
218
|
};
|
|
200
219
|
pricingRules: {
|
|
201
220
|
condition: {
|
|
@@ -387,6 +406,9 @@ export declare const ImageEditorConfigSchema: z.ZodObject<{
|
|
|
387
406
|
width: number;
|
|
388
407
|
height: number;
|
|
389
408
|
}>;
|
|
409
|
+
resolution?: {
|
|
410
|
+
options: string[];
|
|
411
|
+
} | undefined;
|
|
390
412
|
};
|
|
391
413
|
pricingRules: {
|
|
392
414
|
condition: {
|
|
@@ -462,6 +484,9 @@ export declare const ImageEditorConfigSchema: z.ZodObject<{
|
|
|
462
484
|
width: number;
|
|
463
485
|
height: number;
|
|
464
486
|
}>;
|
|
487
|
+
resolution?: {
|
|
488
|
+
options: string[];
|
|
489
|
+
} | undefined;
|
|
465
490
|
};
|
|
466
491
|
pricingRules: {
|
|
467
492
|
condition: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-editor-config.schema.d.ts","sourceRoot":"","sources":["../../../models/image-editor/image-editor-config.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"image-editor-config.schema.d.ts","sourceRoot":"","sources":["../../../models/image-editor/image-editor-config.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|