@vargai/gateway 0.1.3 → 0.1.5

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.
Files changed (2) hide show
  1. package/dist/index.js +29 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14164,7 +14164,19 @@ class VargVideoModel {
14164
14164
  if (options.aspectRatio)
14165
14165
  params.aspect_ratio = options.aspectRatio;
14166
14166
  if (options.files && options.files.length > 0) {
14167
- params.files = options.files.filter((f) => f.type === "url").map((f) => ({ url: f.url }));
14167
+ const fileUrls = [];
14168
+ for (const f of options.files) {
14169
+ if (f.type === "url") {
14170
+ fileUrls.push({ url: f.url });
14171
+ } else if (f.type === "file") {
14172
+ const fileData = f;
14173
+ const uploaded = await this.client.uploadFile(new Blob([fileData.data], { type: fileData.mediaType }), fileData.mediaType);
14174
+ fileUrls.push({ url: uploaded.url });
14175
+ }
14176
+ }
14177
+ if (fileUrls.length > 0) {
14178
+ params.files = fileUrls;
14179
+ }
14168
14180
  }
14169
14181
  if (options.providerOptions?.varg) {
14170
14182
  params.provider_options = options.providerOptions.varg;
@@ -14200,6 +14212,21 @@ class VargImageModel {
14200
14212
  };
14201
14213
  if (options.aspectRatio)
14202
14214
  params.aspect_ratio = options.aspectRatio;
14215
+ if (options.files && options.files.length > 0) {
14216
+ const fileUrls = [];
14217
+ for (const f of options.files) {
14218
+ if (f.type === "url") {
14219
+ fileUrls.push({ url: f.url });
14220
+ } else if (f.type === "file") {
14221
+ const fileData = f;
14222
+ const uploaded = await this.client.uploadFile(new Blob([fileData.data], { type: fileData.mediaType }), fileData.mediaType);
14223
+ fileUrls.push({ url: uploaded.url });
14224
+ }
14225
+ }
14226
+ if (fileUrls.length > 0) {
14227
+ params.files = fileUrls;
14228
+ }
14229
+ }
14203
14230
  if (options.providerOptions?.varg) {
14204
14231
  params.provider_options = options.providerOptions.varg;
14205
14232
  }
@@ -14239,8 +14266,7 @@ class VargSpeechModel {
14239
14266
  warnings,
14240
14267
  response: {
14241
14268
  timestamp: new Date,
14242
- modelId: this.modelId,
14243
- headers: undefined
14269
+ modelId: this.modelId
14244
14270
  }
14245
14271
  };
14246
14272
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vargai/gateway",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "typescript client for varg gateway api",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",