@pandi2352/gemini-ocr 1.0.0 → 2.0.0

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/dist/index.js CHANGED
@@ -199,7 +199,7 @@ async function processSingleFile(input, options) {
199
199
  entityResult,
200
200
  pageCount,
201
201
  language: 'en',
202
- documentType: 'unknown',
202
+ documentType: mimeType?.includes('pdf') ? 'pdf' : mimeType?.includes('image') ? 'image' : mimeType || 'unknown',
203
203
  confidence: null,
204
204
  timings: {
205
205
  startTime: startTime.toISOString(),
@@ -216,10 +216,19 @@ async function processSingleFile(input, options) {
216
216
  }
217
217
  catch (error) {
218
218
  const endTime = new Date();
219
+ let errorMessage = error.message || 'Unknown error';
220
+ try {
221
+ // Try to make the error message cleaner or parse if it looks like JSON
222
+ if (errorMessage.startsWith('[') || errorMessage.startsWith('{')) {
223
+ const parsed = JSON.parse(errorMessage);
224
+ errorMessage = parsed;
225
+ }
226
+ }
227
+ catch (e) { }
219
228
  // Error Result (Structured)
220
229
  return {
221
230
  status: 'error',
222
- error: error.message || 'Unknown error',
231
+ error: errorMessage,
223
232
  extractedText: '',
224
233
  summary: null,
225
234
  mindmap: null,
package/dist/types.d.ts CHANGED
@@ -33,7 +33,7 @@ export interface DocumentMetadata {
33
33
  }
34
34
  export interface OCRResult {
35
35
  status: 'success' | 'error';
36
- error: string | null;
36
+ error: string | any | null;
37
37
  extractedText: string;
38
38
  summary: string | null;
39
39
  mindmap: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandi2352/gemini-ocr",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "A lightweight OCR processing wrapper using Google Gemini Vision models.",
5
5
  "publishConfig": {
6
6
  "access": "public"