vargai 0.4.0-alpha41 → 0.4.0-alpha43

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/package.json CHANGED
@@ -40,10 +40,9 @@
40
40
  "dependencies": {
41
41
  "@ai-sdk/fal": "^1.0.23",
42
42
  "@ai-sdk/fireworks": "^2.0.16",
43
- "@ai-sdk/groq": "^3.0.12",
44
43
  "@ai-sdk/google": "^3.0.13",
44
+ "@ai-sdk/groq": "^3.0.12",
45
45
  "@ai-sdk/openai": "^3.0.9",
46
- "@google/genai": "^1.0.0",
47
46
  "@ai-sdk/provider": "^3.0.2",
48
47
  "@ai-sdk/provider-utils": "^4.0.4",
49
48
  "@ai-sdk/replicate": "^2.0.5",
@@ -51,6 +50,7 @@
51
50
  "@aws-sdk/s3-request-presigner": "^3.937.0",
52
51
  "@elevenlabs/elevenlabs-js": "^2.28.0",
53
52
  "@fal-ai/client": "^1.7.2",
53
+ "@google/genai": "^1.0.0",
54
54
  "@higgsfield/client": "^0.1.2",
55
55
  "@inkjs/ui": "^2.0.0",
56
56
  "@remotion/cli": "^4.0.377",
@@ -61,6 +61,7 @@
61
61
  "fluent-ffmpeg": "^2.1.3",
62
62
  "groq-sdk": "^0.36.0",
63
63
  "ink": "^6.5.1",
64
+ "p-map": "^7.0.4",
64
65
  "react": "^19.2.0",
65
66
  "react-dom": "^19.2.0",
66
67
  "remotion": "^4.0.377",
@@ -68,7 +69,7 @@
68
69
  "sharp": "^0.34.5",
69
70
  "zod": "^4.2.1"
70
71
  },
71
- "version": "0.4.0-alpha41",
72
+ "version": "0.4.0-alpha43",
72
73
  "exports": {
73
74
  ".": "./src/index.ts",
74
75
  "./ai": "./src/ai-sdk/index.ts",
@@ -11,7 +11,7 @@ import {
11
11
  type TranscriptionModelV3CallOptions,
12
12
  } from "@ai-sdk/provider";
13
13
  import { fal } from "@fal-ai/client";
14
- import { uploadBuffer as uploadToR2 } from "../../providers/storage";
14
+ import pMap from "p-map";
15
15
  import { fileCache } from "../file-cache";
16
16
  import type { VideoModelV3, VideoModelV3CallOptions } from "../video-model";
17
17
 
@@ -183,21 +183,6 @@ function detectImageType(bytes: Uint8Array): string | undefined {
183
183
  return undefined;
184
184
  }
185
185
 
186
- function getExtFromMediaType(mediaType: string): string {
187
- const map: Record<string, string> = {
188
- "image/png": "png",
189
- "image/jpeg": "jpg",
190
- "image/gif": "gif",
191
- "image/webp": "webp",
192
- "video/mp4": "mp4",
193
- "video/webm": "webm",
194
- "audio/mpeg": "mp3",
195
- "audio/wav": "wav",
196
- "audio/ogg": "ogg",
197
- };
198
- return map[mediaType] ?? "bin";
199
- }
200
-
201
186
  async function fileToUrl(file: ImageModelV3File): Promise<string> {
202
187
  if (file.type === "url") return file.url;
203
188
  const data = file.data;
@@ -205,18 +190,13 @@ async function fileToUrl(file: ImageModelV3File): Promise<string> {
205
190
  typeof data === "string"
206
191
  ? Uint8Array.from(atob(data), (c) => c.charCodeAt(0))
207
192
  : data;
193
+ // Use mediaType from file if available, otherwise detect from bytes or default to png
208
194
  const mediaType = file.mediaType ?? detectImageType(bytes) ?? "image/png";
209
- const ext = getExtFromMediaType(mediaType);
210
- const hash = Bun.hash(bytes).toString(16);
211
- const key = `fal-uploads/${hash}.${ext}`;
212
- return uploadToR2(bytes, key, mediaType);
195
+ return fal.storage.upload(new Blob([bytes], { type: mediaType }));
213
196
  }
214
197
 
215
198
  async function uploadBuffer(buffer: ArrayBuffer): Promise<string> {
216
- const bytes = new Uint8Array(buffer);
217
- const hash = Bun.hash(bytes).toString(16);
218
- const key = `fal-uploads/${hash}.bin`;
219
- return uploadToR2(bytes, key);
199
+ return fal.storage.upload(new Blob([buffer]));
220
200
  }
221
201
 
222
202
  export function computePendingKey(
@@ -769,7 +749,7 @@ class FalImageModel implements ImageModelV3 {
769
749
  modelId: this.modelId,
770
750
  fileHashes,
771
751
  });
772
- input.image_urls = await Promise.all(files.map((f) => fileToUrl(f)));
752
+ input.image_urls = await pMap(files, fileToUrl, { concurrency: 2 });
773
753
  }
774
754
 
775
755
  if (isQwenAngles && !input.image_urls) {