@umituz/react-native-ai-pruna-provider 1.0.21 → 1.0.23

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-ai-pruna-provider",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "Pruna AI provider for React Native - implements IAIProvider interface for unified AI generation",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -46,6 +46,13 @@ export async function uploadFileToStorage(
46
46
 
47
47
  generationLogCollector.log(sessionId, TAG, 'Uploading file to Pruna storage...');
48
48
 
49
+ // Detect MIME type BEFORE creating temp file (needed for filename)
50
+ const mimeType = detectMimeType(base64Data);
51
+ const extension = getExtensionForMime(mimeType);
52
+ const filename = `upload.${extension}`;
53
+
54
+ generationLogCollector.log(sessionId, TAG, `Detected MIME type: ${mimeType}, extension: ${extension}`);
55
+
49
56
  // Use design system filesystem to create temp file (React Native compatible)
50
57
  const tempUri = await base64ToTempFile(base64Data);
51
58
 
@@ -57,11 +64,11 @@ export async function uploadFileToStorage(
57
64
  // Fetch the temp file to get a Blob
58
65
  const response = await fetch(tempUri);
59
66
  const blob = await response.blob();
60
- generationLogCollector.log(sessionId, TAG, `Temp file created (${blob.size} bytes), uploading to Pruna...`);
67
+ generationLogCollector.log(sessionId, TAG, `Temp file created (${blob.size} bytes, type: ${blob.type || mimeType}), uploading to Pruna as ${filename}...`);
61
68
 
62
- // Create FormData with the blob
69
+ // Create FormData with the blob AND proper filename with extension
63
70
  const formData = new FormData();
64
- formData.append('content', blob, 'upload');
71
+ formData.append('content', blob, filename);
65
72
 
66
73
  const startTime = Date.now();
67
74
 
@@ -106,7 +106,6 @@ async function buildImageEditInput(
106
106
  images: imageUrls,
107
107
  prompt,
108
108
  aspect_ratio: aspectRatio,
109
- reference_image: "1", // Required by Pruna API for p-image-edit
110
109
  };
111
110
 
112
111
  if (input.seed !== undefined) payload.seed = input.seed;