@umituz/react-native-ai-pruna-provider 1.0.16 → 1.0.18

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.16",
3
+ "version": "1.0.18",
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",
@@ -0,0 +1 @@
1
+ declare const __DEV__: boolean;
@@ -130,7 +130,30 @@ export async function submitPrediction(
130
130
  const startTime = Date.now();
131
131
 
132
132
  const requestBody = { input };
133
- generationLogCollector.log(sessionId, TAG, `Request body: ${JSON.stringify(requestBody).substring(0, 200)}...`);
133
+
134
+ // __DEV__ detailed request logging
135
+ if (typeof __DEV__ !== 'undefined' && __DEV__) {
136
+ const inputSummary: Record<string, string> = {};
137
+ for (const [key, value] of Object.entries(input)) {
138
+ if (typeof value === 'string' && value.length > 100) {
139
+ inputSummary[key] = `[string ${value.length} chars]`;
140
+ } else if (Array.isArray(value)) {
141
+ inputSummary[key] = `[array ${value.length} items]`;
142
+ } else {
143
+ inputSummary[key] = JSON.stringify(value);
144
+ }
145
+ }
146
+ console.log(`[DEV] [${TAG}] Request details:`, {
147
+ url: PRUNA_PREDICTIONS_URL,
148
+ model,
149
+ modelHeader: model,
150
+ bodyTopLevelKeys: Object.keys(requestBody),
151
+ inputKeys: Object.keys(input),
152
+ inputSummary,
153
+ });
154
+ }
155
+
156
+ generationLogCollector.log(sessionId, TAG, `Request: model=${model}, bodyKeys=${JSON.stringify(Object.keys(requestBody))}, inputKeys=${JSON.stringify(Object.keys(input))}`);
134
157
 
135
158
  const response = await fetch(PRUNA_PREDICTIONS_URL, {
136
159
  method: 'POST',
@@ -156,6 +179,18 @@ export async function submitPrediction(
156
179
 
157
180
  generationLogCollector.error(sessionId, TAG, `Prediction failed (${response.status}): ${errorMessage}`);
158
181
 
182
+ // __DEV__ detailed error logging
183
+ if (typeof __DEV__ !== 'undefined' && __DEV__) {
184
+ console.error(`[DEV] [${TAG}] Prediction FAILED:`, {
185
+ status: response.status,
186
+ statusText: response.statusText,
187
+ errorMessage,
188
+ rawBody: rawBody.substring(0, 500),
189
+ model,
190
+ inputKeys: Object.keys(input),
191
+ });
192
+ }
193
+
159
194
  const error = new Error(errorMessage);
160
195
  (error as Error & { statusCode?: number }).statusCode = response.status;
161
196
  throw error;
@@ -171,6 +206,15 @@ export async function submitPrediction(
171
206
  status: result.status,
172
207
  });
173
208
 
209
+ // __DEV__ response logging
210
+ if (typeof __DEV__ !== 'undefined' && __DEV__) {
211
+ console.log(`[DEV] [${TAG}] Prediction SUCCESS in ${elapsed}ms:`, {
212
+ hasUri: !!extractUri(result),
213
+ status: result.status,
214
+ responseKeys: Object.keys(result),
215
+ });
216
+ }
217
+
174
218
  return result;
175
219
  }
176
220