@chenchaolong/plugin-mineru 1.1.7 → 1.1.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"transformer-mineru.strategy.d.ts","sourceRoot":"","sources":["../../src/lib/transformer-mineru.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAG/D,OAAO,EACL,aAAa,EAGb,oBAAoB,EACpB,4BAA4B,EAC5B,qBAAqB,EAEtB,MAAM,sBAAsB,CAAA;AAI7B,OAAO,EAAgB,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAInE,qBAEa,yBAA0B,YAAW,4BAA4B,CAAC,wBAAwB,CAAC;IAEtG,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA2B;IAGxD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAe;IAE7C,QAAQ,CAAC,WAAW,mDAWnB;IAED,QAAQ,CAAC,IAAI;;;;;;;;;;;kBAWM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAwE1B;IAED,cAAc,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpC,kBAAkB,CACtB,SAAS,EAAE,OAAO,CAAC,kBAAkB,CAAC,EAAE,EACxC,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC;CAwFzD"}
1
+ {"version":3,"file":"transformer-mineru.strategy.d.ts","sourceRoot":"","sources":["../../src/lib/transformer-mineru.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAG/D,OAAO,EACL,aAAa,EAGb,oBAAoB,EACpB,4BAA4B,EAC5B,qBAAqB,EAEtB,MAAM,sBAAsB,CAAA;AAI7B,OAAO,EAAgB,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAInE,qBAEa,yBAA0B,YAAW,4BAA4B,CAAC,wBAAwB,CAAC;IAEtG,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA2B;IAGxD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAe;IAE7C,QAAQ,CAAC,WAAW,mDAWnB;IAED,QAAQ,CAAC,IAAI;;;;;;;;;;;kBAWM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAwE1B;IAED,cAAc,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpC,kBAAkB,CACtB,SAAS,EAAE,OAAO,CAAC,kBAAkB,CAAC,EAAE,EACxC,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC;CAsFzD"}
@@ -115,22 +115,20 @@ let MinerUTransformerStrategy = class MinerUTransformerStrategy {
115
115
  const parsedResults = [];
116
116
  for await (const document of documents) {
117
117
  if (mineru.serverType === 'self-hosted') {
118
- // Handle missing filePath: if filePath is not provided but fileUrl is available,
119
- // download the file to a temporary directory
118
+ // Resolve filePath for self-hosted mode
119
+ // Priority: 1) document.filePath, 2) download remote fileUrl, 3) resolve local fileUrl
120
120
  let filePath = document.filePath;
121
- if (!filePath && document.fileUrl && isRemoteFile(document.fileUrl)) {
122
- const tempDir = config.tempDir || '/tmp/';
123
- const fileName = document.name || path.basename(document.fileUrl) || 'document.pdf';
124
- const tempFilePath = path.join(tempDir, `mineru_${Date.now()}_${fileName}`);
125
- // Ensure the temp directory exists
126
- await fsPromises.mkdir(path.dirname(tempFilePath), { recursive: true });
127
- // Download the remote file to a local temporary directory
128
- filePath = await downloadRemoteFile(document.fileUrl, tempFilePath);
129
- }
130
- else if (!filePath && document.fileUrl && config.permissions?.fileSystem) {
131
- // If fileUrl is not remote but filePath is missing, try to resolve using fileSystem
132
- // This handles cases where fileUrl might be a relative path
133
- filePath = config.permissions.fileSystem.fullPath(document.fileUrl);
121
+ if (!filePath && document.fileUrl) {
122
+ if (isRemoteFile(document.fileUrl)) {
123
+ const tempDir = config.tempDir || '/tmp/';
124
+ const fileName = document.name || path.basename(document.fileUrl) || 'document.pdf';
125
+ const tempFilePath = path.join(tempDir, `mineru_${Date.now()}_${fileName}`);
126
+ await fsPromises.mkdir(path.dirname(tempFilePath), { recursive: true });
127
+ filePath = await downloadRemoteFile(document.fileUrl, tempFilePath);
128
+ }
129
+ else if (config.permissions?.fileSystem) {
130
+ filePath = config.permissions.fileSystem.fullPath(document.fileUrl);
131
+ }
134
132
  }
135
133
  if (!filePath) {
136
134
  throw new Error('MinerU self-hosted mode requires filePath to be provided. ' +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chenchaolong/plugin-mineru",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/xpert-ai/xpert-plugins.git"