@helloxiaohu/plugin-mineru6 0.0.2
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/README.md +101 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/lib/integration.strategy.d.ts +10 -0
- package/dist/lib/integration.strategy.d.ts.map +1 -0
- package/dist/lib/integration.strategy.js +118 -0
- package/dist/lib/mineru-toolset.strategy.d.ts +221 -0
- package/dist/lib/mineru-toolset.strategy.d.ts.map +1 -0
- package/dist/lib/mineru-toolset.strategy.js +236 -0
- package/dist/lib/mineru.client.d.ts +120 -0
- package/dist/lib/mineru.client.d.ts.map +1 -0
- package/dist/lib/mineru.client.js +456 -0
- package/dist/lib/mineru.controller.d.ts +9 -0
- package/dist/lib/mineru.controller.d.ts.map +1 -0
- package/dist/lib/mineru.controller.js +41 -0
- package/dist/lib/mineru.plugin.d.ts +13 -0
- package/dist/lib/mineru.plugin.d.ts.map +1 -0
- package/dist/lib/mineru.plugin.js +52 -0
- package/dist/lib/mineru.tool.d.ts +75 -0
- package/dist/lib/mineru.tool.d.ts.map +1 -0
- package/dist/lib/mineru.tool.js +141 -0
- package/dist/lib/mineru.toolset.d.ts +51 -0
- package/dist/lib/mineru.toolset.d.ts.map +1 -0
- package/dist/lib/mineru.toolset.js +52 -0
- package/dist/lib/path-meta.d.ts +5 -0
- package/dist/lib/path-meta.d.ts.map +1 -0
- package/dist/lib/path-meta.js +8 -0
- package/dist/lib/result-parser.service.d.ts +18 -0
- package/dist/lib/result-parser.service.d.ts.map +1 -0
- package/dist/lib/result-parser.service.js +171 -0
- package/dist/lib/transformer-mineru.strategy.d.ts +95 -0
- package/dist/lib/transformer-mineru.strategy.d.ts.map +1 -0
- package/dist/lib/transformer-mineru.strategy.js +163 -0
- package/dist/lib/types.d.ts +53 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +40 -0
- package/package.json +62 -0
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Xpert Plugin: MinerU
|
|
2
|
+
|
|
3
|
+
`@xpert-ai/plugin-mineru` is a MinerU document converter plugin for the [Xpert AI](https://github.com/xpert-ai/xpert) platform, providing extraction capabilities from PDF to Markdown and structured JSON. The plugin includes built-in MinerU integration strategies, document conversion strategies, and result parsing services, enabling secure access to the MinerU API in automated workflows, polling task status, and writing parsed content and attachment resources to the platform file system.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @xpert-ai/plugin-mineru
|
|
9
|
+
# or
|
|
10
|
+
npm install @xpert-ai/plugin-mineru
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
> **Note**: This plugin depends on `@xpert-ai/plugin-sdk`, `@nestjs/common@^11`, `@nestjs/config@^4`, `@metad/contracts`, `axios@1`, `chalk@4`, `@langchain/core@^0.3.72`, and `uuid@8` as peerDependencies. Please ensure these packages are installed in your host project.
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
1. **Prepare MinerU Credentials**
|
|
18
|
+
Obtain a valid API Key from the MinerU dashboard and confirm the service address (default: `https://mineru.net/api/v4`).
|
|
19
|
+
|
|
20
|
+
2. **Configure Integration in Xpert**
|
|
21
|
+
- Via Xpert Console: Create a MinerU integration and fill in the following fields.
|
|
22
|
+
- Or set environment variables in your deployment environment:
|
|
23
|
+
- `MINERU_API_BASE_URL`: Optional, defaults to `https://mineru.net/api/v4`.
|
|
24
|
+
- `MINERU_API_TOKEN`: Required, used as a fallback credential if no integration is configured.
|
|
25
|
+
|
|
26
|
+
Example integration configuration (JSON):
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"provider": "mineru",
|
|
31
|
+
"options": {
|
|
32
|
+
"apiUrl": "https://mineru.net/api/v4",
|
|
33
|
+
"apiKey": "your-mineru-api-key"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
3. **Register the Plugin**
|
|
39
|
+
Configure the plugin in your host service's plugin registration process:
|
|
40
|
+
|
|
41
|
+
```sh .env
|
|
42
|
+
PLUGINS=@xpert-ai/plugin-mineru
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The plugin returns the NestJS module `MinerUPlugin` in the `register` hook and logs messages during the `onStart`/`onStop` lifecycle.
|
|
46
|
+
|
|
47
|
+
## MinerU Integration Options
|
|
48
|
+
|
|
49
|
+
| Field | Type | Description | Required | Default |
|
|
50
|
+
| -------- | ------ | ------------------------------------- | -------- | ---------------------------- |
|
|
51
|
+
| apiUrl | string | MinerU API base URL | No | `https://mineru.net/api/v4` |
|
|
52
|
+
| apiKey | string | MinerU service API Key (keep secret) | Yes | — |
|
|
53
|
+
|
|
54
|
+
> If both integration configuration and environment variables are provided, options from the integration configuration take precedence.
|
|
55
|
+
|
|
56
|
+
## Document Conversion Parameters
|
|
57
|
+
|
|
58
|
+
`MinerUTransformerStrategy` supports the following configuration options (passed to the MinerU API when starting a workflow):
|
|
59
|
+
|
|
60
|
+
| Field | Type | Default | Description |
|
|
61
|
+
| ---------------- | ------- | ------------ | --------------------------------------------------- |
|
|
62
|
+
| `isOcr` | boolean | `true` | Enable OCR for image-based PDFs. |
|
|
63
|
+
| `enableFormula` | boolean | `true` | Recognize mathematical formulas and output tags. |
|
|
64
|
+
| `enableTable` | boolean | `true` | Recognize tables and output structured tags. |
|
|
65
|
+
| `language` | string | `"ch"` | Main document language, per MinerU API (`en`/`ch`). |
|
|
66
|
+
| `modelVersion` | string | `"pipeline"` | MinerU model version (`pipeline`, `vlm`, etc.). |
|
|
67
|
+
|
|
68
|
+
By default, the plugin creates MinerU tasks for each file to be processed, polls until `full_zip_url` is returned, then downloads and parses the zip package in memory.
|
|
69
|
+
|
|
70
|
+
## Permissions
|
|
71
|
+
|
|
72
|
+
- **Integration**: Access MinerU integration configuration to read API address and credentials.
|
|
73
|
+
- **File System**: Perform `read/write/list` on `XpFileSystem` to store image resources from MinerU results.
|
|
74
|
+
|
|
75
|
+
Ensure the plugin is granted these permissions in your authorization policy, or it will not be able to retrieve results or write attachments.
|
|
76
|
+
|
|
77
|
+
## Output Content
|
|
78
|
+
|
|
79
|
+
The parser generates:
|
|
80
|
+
|
|
81
|
+
- Full Markdown: Resource links are automatically replaced to point to actual URLs written via `XpFileSystem`.
|
|
82
|
+
- Structured metadata: Includes MinerU task ID, layout JSON (`layout.json`), content list (`content_list.json`), original PDF filename, etc.
|
|
83
|
+
- Attachment asset list: Records written image resources for easy association by callers.
|
|
84
|
+
|
|
85
|
+
The returned `Document<ChunkMetadata>` array currently defaults to a single chunk containing the full Markdown; you can split it as needed.
|
|
86
|
+
|
|
87
|
+
## Development & Debugging
|
|
88
|
+
|
|
89
|
+
Run the following commands in the repository root to build and test locally:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npm install
|
|
93
|
+
npx nx build @xpert-ai/plugin-mineru
|
|
94
|
+
npx nx test @xpert-ai/plugin-mineru
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
TypeScript build artifacts are output to `packages/mineru/dist`. Before publishing, ensure `package.json`, type declarations, and runtime files are in sync.
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
This project follows the [AGPL-3.0 License](../../../LICENSE) in the repository root.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { XpertPlugin } from '@xpert-ai/plugin-sdk';
|
|
3
|
+
declare const ConfigSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
4
|
+
declare const plugin: XpertPlugin<z.infer<typeof ConfigSchema>>;
|
|
5
|
+
export default plugin;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAexD,QAAA,MAAM,YAAY,gDAChB,CAAC;AAEH,QAAA,MAAM,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CA4BrD,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { dirname, join } from 'path';
|
|
5
|
+
import { MinerUPlugin } from './lib/mineru.plugin.js';
|
|
6
|
+
import { icon } from './lib/types.js';
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const dir_name = dirname(__filename);
|
|
9
|
+
const packageJson = JSON.parse(readFileSync(join(dir_name, '../package.json'), 'utf8'));
|
|
10
|
+
const ConfigSchema = z.object({});
|
|
11
|
+
const plugin = {
|
|
12
|
+
meta: {
|
|
13
|
+
name: packageJson.name,
|
|
14
|
+
version: packageJson.version,
|
|
15
|
+
category: 'tools',
|
|
16
|
+
icon: {
|
|
17
|
+
type: 'svg',
|
|
18
|
+
value: icon
|
|
19
|
+
},
|
|
20
|
+
displayName: 'MinerU Transformer6',
|
|
21
|
+
description: 'Provide PDF to Markdown and JSON transformation functionality',
|
|
22
|
+
keywords: ['integration', 'pdf', 'markdown', 'json', 'transformer'],
|
|
23
|
+
author: 'XpertAI Team',
|
|
24
|
+
homepage: 'https://www.npmjs.com/package/@xpert-ai/plugin-mineru',
|
|
25
|
+
},
|
|
26
|
+
config: {
|
|
27
|
+
schema: ConfigSchema,
|
|
28
|
+
},
|
|
29
|
+
register(ctx) {
|
|
30
|
+
ctx.logger.log('register mineru transformer plugin');
|
|
31
|
+
return { module: MinerUPlugin, global: true };
|
|
32
|
+
},
|
|
33
|
+
async onStart(ctx) {
|
|
34
|
+
ctx.logger.log('mineru transformer plugin started');
|
|
35
|
+
},
|
|
36
|
+
async onStop(ctx) {
|
|
37
|
+
ctx.logger.log('mineru transformer plugin stopped');
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export default plugin;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type IIntegration, TIntegrationProvider } from '@metad/contracts';
|
|
2
|
+
import { IntegrationStrategy, TIntegrationStrategyParams } from '@xpert-ai/plugin-sdk';
|
|
3
|
+
import { MinerUIntegrationOptions } from './types.js';
|
|
4
|
+
export declare class MinerUIntegrationStrategy implements IntegrationStrategy<MinerUIntegrationOptions> {
|
|
5
|
+
readonly meta: TIntegrationProvider;
|
|
6
|
+
private readonly configService;
|
|
7
|
+
execute(integration: IIntegration<MinerUIntegrationOptions>, payload: TIntegrationStrategyParams): Promise<any>;
|
|
8
|
+
validateConfig(config: MinerUIntegrationOptions): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=integration.strategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.strategy.d.ts","sourceRoot":"","sources":["../../src/lib/integration.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAO3E,OAAO,EACL,mBAAmB,EAGnB,0BAA0B,EAC3B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAA2B,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE/E,qBAEa,yBACX,YAAW,mBAAmB,CAAC,wBAAwB,CAAC;IAExD,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAsEjC;IAGF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAExC,OAAO,CACX,WAAW,EAAE,YAAY,CAAC,wBAAwB,CAAC,EACnD,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,GAAG,CAAC;IAIT,cAAc,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;CA2BtE"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { forwardRef, Inject, Injectable, } from '@nestjs/common';
|
|
3
|
+
import { ConfigService } from '@nestjs/config';
|
|
4
|
+
import { IntegrationStrategyKey, } from '@xpert-ai/plugin-sdk';
|
|
5
|
+
import { MinerUClient } from './mineru.client.js';
|
|
6
|
+
import { icon, MinerUIntegration } from './types.js';
|
|
7
|
+
let MinerUIntegrationStrategy = class MinerUIntegrationStrategy {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.meta = {
|
|
10
|
+
name: MinerUIntegration,
|
|
11
|
+
label: {
|
|
12
|
+
en_US: 'MinerU',
|
|
13
|
+
},
|
|
14
|
+
description: {
|
|
15
|
+
en_US: 'MinerU is a tool that converts PDFs into machine-readable formats (e.g., markdown, JSON), allowing for easy extraction into any format. ',
|
|
16
|
+
zh_Hans: 'MinerU 是一种将 PDF 转换为机器可读格式(例如 markdown、JSON)的工具,可以轻松提取为任何格式。',
|
|
17
|
+
},
|
|
18
|
+
icon: {
|
|
19
|
+
type: 'svg',
|
|
20
|
+
value: icon,
|
|
21
|
+
color: '#4CAF50',
|
|
22
|
+
},
|
|
23
|
+
schema: {
|
|
24
|
+
type: 'object',
|
|
25
|
+
properties: {
|
|
26
|
+
apiUrl: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
title: {
|
|
29
|
+
en_US: 'Base URL',
|
|
30
|
+
},
|
|
31
|
+
description: {
|
|
32
|
+
en_US: 'https://mineru.net/api/v4',
|
|
33
|
+
ja_JP: 'MinerUサーバのBase URLを入力してください',
|
|
34
|
+
zh_Hans: '请输入你的 MinerU 服务的 Base URL',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
apiKey: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
title: {
|
|
40
|
+
en_US: 'API Key',
|
|
41
|
+
},
|
|
42
|
+
description: {
|
|
43
|
+
en_US: 'The API Key of the MinerU server',
|
|
44
|
+
ja_JP: 'MinerUサーバのトークンを入力してください',
|
|
45
|
+
zh_Hans: '请输入你的 MinerU 服务的令牌',
|
|
46
|
+
},
|
|
47
|
+
'x-ui': {
|
|
48
|
+
component: 'secretInput',
|
|
49
|
+
label: 'API Key',
|
|
50
|
+
placeholder: 'MinerU API Key',
|
|
51
|
+
revealable: true,
|
|
52
|
+
maskSymbol: '*',
|
|
53
|
+
persist: true,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
serverType: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
title: {
|
|
59
|
+
en_US: 'Server Type',
|
|
60
|
+
ja_JP: 'サーバータイプ',
|
|
61
|
+
zh_Hans: '服务类型',
|
|
62
|
+
},
|
|
63
|
+
description: {
|
|
64
|
+
en_US: 'Please select MinerU service type, local deployment or official API',
|
|
65
|
+
ja_JP: 'MinerUサービスのタイプを選択してください、ローカルデプロイまたは公式API',
|
|
66
|
+
zh_Hans: '请选择MinerU服务类型,本地部署或官方API',
|
|
67
|
+
},
|
|
68
|
+
enum: ['official', 'self-hosted'],
|
|
69
|
+
default: 'official',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
features: [],
|
|
74
|
+
helpUrl: 'https://mineru.net/apiManage/docs',
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
async execute(integration, payload) {
|
|
78
|
+
throw new Error('Method not implemented.');
|
|
79
|
+
}
|
|
80
|
+
async validateConfig(config) {
|
|
81
|
+
const mineruClient = new MinerUClient(this.configService, {
|
|
82
|
+
integration: {
|
|
83
|
+
provider: MinerUIntegration,
|
|
84
|
+
options: config,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
if (mineruClient.serverType === 'official') {
|
|
88
|
+
try {
|
|
89
|
+
await mineruClient.validateOfficialApiToken();
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
console.error(`MinerU integration validation error:`);
|
|
93
|
+
console.error(error);
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
// Self-hosted MinerU validation logic: access openapi.json
|
|
99
|
+
try {
|
|
100
|
+
await mineruClient.getSelfHostedOpenApiSpec();
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
console.error(`MinerU self-hosted integration validation error:`);
|
|
104
|
+
console.error(error);
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
__decorate([
|
|
111
|
+
Inject(forwardRef(() => ConfigService)),
|
|
112
|
+
__metadata("design:type", ConfigService)
|
|
113
|
+
], MinerUIntegrationStrategy.prototype, "configService", void 0);
|
|
114
|
+
MinerUIntegrationStrategy = __decorate([
|
|
115
|
+
Injectable(),
|
|
116
|
+
IntegrationStrategyKey(MinerUIntegration)
|
|
117
|
+
], MinerUIntegrationStrategy);
|
|
118
|
+
export { MinerUIntegrationStrategy };
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { ConfigService } from '@nestjs/config';
|
|
2
|
+
import { BuiltinToolset, IToolsetStrategy, FileSystemPermission, ISchemaSecretField } from '@xpert-ai/plugin-sdk';
|
|
3
|
+
import { MinerUResultParserService } from './result-parser.service.js';
|
|
4
|
+
import { MinerUToolsetConfig } from './mineru.toolset.js';
|
|
5
|
+
/**
|
|
6
|
+
* ToolsetStrategy for MinerU PDF parser tool
|
|
7
|
+
* Registers MinerU as a toolset that can be used in agent workflows
|
|
8
|
+
*/
|
|
9
|
+
export declare class MinerUToolsetStrategy implements IToolsetStrategy<MinerUToolsetConfig> {
|
|
10
|
+
private readonly configService;
|
|
11
|
+
private readonly resultParser;
|
|
12
|
+
/**
|
|
13
|
+
* Metadata for MinerU toolset
|
|
14
|
+
*/
|
|
15
|
+
meta: {
|
|
16
|
+
author: string;
|
|
17
|
+
tags: string[];
|
|
18
|
+
name: string;
|
|
19
|
+
label: {
|
|
20
|
+
en_US: string;
|
|
21
|
+
zh_Hans: string;
|
|
22
|
+
};
|
|
23
|
+
description: {
|
|
24
|
+
en_US: string;
|
|
25
|
+
zh_Hans: string;
|
|
26
|
+
};
|
|
27
|
+
icon: {
|
|
28
|
+
svg: string;
|
|
29
|
+
color: string;
|
|
30
|
+
};
|
|
31
|
+
configSchema: {
|
|
32
|
+
type: string;
|
|
33
|
+
properties: {
|
|
34
|
+
/**
|
|
35
|
+
* NOTE:
|
|
36
|
+
* We intentionally keep MinerU as a "self-contained" toolset that stores its own API credentials,
|
|
37
|
+
* instead of relying on the platform IntegrationPermission flow.
|
|
38
|
+
*
|
|
39
|
+
* Reason: during the built-in toolset authorization step, the platform may send `credentials = null`,
|
|
40
|
+
* and backend may access `credentials.integration`, causing a 500 (`Cannot read properties of null (reading 'integration')`).
|
|
41
|
+
* Defining API fields directly ensures the authorization UI renders fields and always submits an object.
|
|
42
|
+
*/
|
|
43
|
+
apiUrl: {
|
|
44
|
+
type: string;
|
|
45
|
+
title: {
|
|
46
|
+
en_US: string;
|
|
47
|
+
zh_Hans: string;
|
|
48
|
+
};
|
|
49
|
+
description: {
|
|
50
|
+
en_US: string;
|
|
51
|
+
zh_Hans: string;
|
|
52
|
+
};
|
|
53
|
+
default: string;
|
|
54
|
+
};
|
|
55
|
+
apiKey: {
|
|
56
|
+
type: string;
|
|
57
|
+
title: {
|
|
58
|
+
en_US: string;
|
|
59
|
+
zh_Hans: string;
|
|
60
|
+
};
|
|
61
|
+
description: {
|
|
62
|
+
en_US: string;
|
|
63
|
+
zh_Hans: string;
|
|
64
|
+
};
|
|
65
|
+
'x-ui': ISchemaSecretField;
|
|
66
|
+
};
|
|
67
|
+
serverType: {
|
|
68
|
+
type: string;
|
|
69
|
+
title: {
|
|
70
|
+
en_US: string;
|
|
71
|
+
zh_Hans: string;
|
|
72
|
+
};
|
|
73
|
+
description: {
|
|
74
|
+
en_US: string;
|
|
75
|
+
zh_Hans: string;
|
|
76
|
+
};
|
|
77
|
+
enum: string[];
|
|
78
|
+
default: string;
|
|
79
|
+
};
|
|
80
|
+
isOcr: {
|
|
81
|
+
type: string;
|
|
82
|
+
title: {
|
|
83
|
+
en_US: string;
|
|
84
|
+
zh_Hans: string;
|
|
85
|
+
};
|
|
86
|
+
description: {
|
|
87
|
+
en_US: string;
|
|
88
|
+
zh_Hans: string;
|
|
89
|
+
};
|
|
90
|
+
default: boolean;
|
|
91
|
+
};
|
|
92
|
+
enableFormula: {
|
|
93
|
+
type: string;
|
|
94
|
+
title: {
|
|
95
|
+
en_US: string;
|
|
96
|
+
zh_Hans: string;
|
|
97
|
+
};
|
|
98
|
+
description: {
|
|
99
|
+
en_US: string;
|
|
100
|
+
zh_Hans: string;
|
|
101
|
+
};
|
|
102
|
+
default: boolean;
|
|
103
|
+
};
|
|
104
|
+
enableTable: {
|
|
105
|
+
type: string;
|
|
106
|
+
title: {
|
|
107
|
+
en_US: string;
|
|
108
|
+
zh_Hans: string;
|
|
109
|
+
};
|
|
110
|
+
description: {
|
|
111
|
+
en_US: string;
|
|
112
|
+
zh_Hans: string;
|
|
113
|
+
};
|
|
114
|
+
default: boolean;
|
|
115
|
+
};
|
|
116
|
+
language: {
|
|
117
|
+
type: string;
|
|
118
|
+
title: {
|
|
119
|
+
en_US: string;
|
|
120
|
+
zh_Hans: string;
|
|
121
|
+
};
|
|
122
|
+
description: {
|
|
123
|
+
en_US: string;
|
|
124
|
+
zh_Hans: string;
|
|
125
|
+
};
|
|
126
|
+
enum: string[];
|
|
127
|
+
default: string;
|
|
128
|
+
};
|
|
129
|
+
modelVersion: {
|
|
130
|
+
type: string;
|
|
131
|
+
title: {
|
|
132
|
+
en_US: string;
|
|
133
|
+
zh_Hans: string;
|
|
134
|
+
};
|
|
135
|
+
description: {
|
|
136
|
+
en_US: string;
|
|
137
|
+
zh_Hans: string;
|
|
138
|
+
};
|
|
139
|
+
enum: string[];
|
|
140
|
+
default: string;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
required: string[];
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Permissions required by MinerU toolset
|
|
148
|
+
*/
|
|
149
|
+
readonly permissions: FileSystemPermission[];
|
|
150
|
+
constructor(configService: ConfigService, resultParser: MinerUResultParserService);
|
|
151
|
+
/**
|
|
152
|
+
* Validate toolset configuration
|
|
153
|
+
*/
|
|
154
|
+
validateConfig(config: MinerUToolsetConfig | null | undefined): Promise<void>;
|
|
155
|
+
/**
|
|
156
|
+
* Create MinerU toolset instance
|
|
157
|
+
* Note: config may be null/undefined during authorization phase
|
|
158
|
+
*/
|
|
159
|
+
create(config: MinerUToolsetConfig | null | undefined): Promise<BuiltinToolset>;
|
|
160
|
+
/**
|
|
161
|
+
* Create tools for MinerU toolset
|
|
162
|
+
* Tools are created dynamically in MinerUToolset.initTools()
|
|
163
|
+
* based on the toolset credentials/configuration
|
|
164
|
+
*/
|
|
165
|
+
createTools(): import("@langchain/core/tools").DynamicStructuredTool<import("zod").ZodObject<{
|
|
166
|
+
doc_url: import("zod").ZodString;
|
|
167
|
+
token: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
168
|
+
url: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
169
|
+
server_type: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodEnum<["official", "self-hosted"]>>>;
|
|
170
|
+
enable_formula: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodBoolean>>;
|
|
171
|
+
enable_table: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodBoolean>>;
|
|
172
|
+
is_ocr: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodBoolean>>;
|
|
173
|
+
language: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodEnum<["en", "ch"]>>>;
|
|
174
|
+
model_version: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodEnum<["pipeline", "vlm"]>>>;
|
|
175
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
176
|
+
token?: string;
|
|
177
|
+
enable_formula?: boolean;
|
|
178
|
+
enable_table?: boolean;
|
|
179
|
+
language?: "en" | "ch";
|
|
180
|
+
model_version?: "vlm" | "pipeline";
|
|
181
|
+
url?: string;
|
|
182
|
+
is_ocr?: boolean;
|
|
183
|
+
doc_url?: string;
|
|
184
|
+
server_type?: "official" | "self-hosted";
|
|
185
|
+
}, {
|
|
186
|
+
token?: string;
|
|
187
|
+
enable_formula?: boolean;
|
|
188
|
+
enable_table?: boolean;
|
|
189
|
+
language?: "en" | "ch";
|
|
190
|
+
model_version?: "vlm" | "pipeline";
|
|
191
|
+
url?: string;
|
|
192
|
+
is_ocr?: boolean;
|
|
193
|
+
doc_url?: string;
|
|
194
|
+
server_type?: "official" | "self-hosted";
|
|
195
|
+
}>, {
|
|
196
|
+
token?: string;
|
|
197
|
+
enable_formula?: boolean;
|
|
198
|
+
enable_table?: boolean;
|
|
199
|
+
language?: "en" | "ch";
|
|
200
|
+
model_version?: "vlm" | "pipeline";
|
|
201
|
+
url?: string;
|
|
202
|
+
is_ocr?: boolean;
|
|
203
|
+
doc_url?: string;
|
|
204
|
+
server_type?: "official" | "self-hosted";
|
|
205
|
+
}, {
|
|
206
|
+
token?: string;
|
|
207
|
+
enable_formula?: boolean;
|
|
208
|
+
enable_table?: boolean;
|
|
209
|
+
language?: "en" | "ch";
|
|
210
|
+
model_version?: "vlm" | "pipeline";
|
|
211
|
+
url?: string;
|
|
212
|
+
is_ocr?: boolean;
|
|
213
|
+
doc_url?: string;
|
|
214
|
+
server_type?: "official" | "self-hosted";
|
|
215
|
+
}, (string | {
|
|
216
|
+
files: any[];
|
|
217
|
+
taskId: string;
|
|
218
|
+
metadata: any;
|
|
219
|
+
})[]>[];
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=mineru-toolset.strategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mineru-toolset.strategy.d.ts","sourceRoot":"","sources":["../../src/lib/mineru-toolset.strategy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,cAAc,EACd,gBAAgB,EAEhB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAiB,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAIzE;;;GAGG;AACH,qBAEa,qBAAsB,YAAW,gBAAgB,CAAC,mBAAmB,CAAC;IA8J/E,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,YAAY;IA/J/B;;OAEG;IACH,IAAI;;;;;;;;;;;;;;;;;;;gBAoBE;;;;;;;;mBAQG;;;;;;;;;;;;;;;;;;;;;;;4BAuBQ,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAwFjC;IAEF;;OAEG;IACH,QAAQ,CAAC,WAAW,yBAMlB;gBAIiB,aAAa,EAAE,aAAa,EAE5B,YAAY,EAAE,yBAAyB;IAG1D;;OAEG;IACH,cAAc,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAY7E;;;OAGG;IACG,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC;IAYrF;;;;OAIG;IACH,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BZ"}
|