@unityclaw/skills 1.1.2 → 1.1.4
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 +10 -19
- package/package.json +1 -1
- package/{unityclaw-image-generation → unityclaw-image-generation-jimeng}/SKILL.md +3 -3
- package/unityclaw-media-analysis/SKILL.md +2 -2
- package/unityclaw-media-download-xhs/SKILL.md +2 -2
- package/unityclaw-media-stats/SKILL.md +2 -2
- package/unityclaw-media-user-info/SKILL.md +2 -2
- package/unityclaw-video-generation-jimeng-doubao/SKILL.md +2 -2
- package/unityclaw-video-generation-kling/SKILL.md +2 -2
- package/unityclaw-video-generation-wan-minimax/SKILL.md +2 -2
- package/unityclaw-document-convert/SKILL.md +0 -424
- package/unityclaw-document-translation/SKILL.md +0 -318
- package/unityclaw-idp-business-extraction/SKILL.md +0 -63
- package/unityclaw-idp-contract-extraction/SKILL.md +0 -63
- package/unityclaw-idp-invoice-extraction/SKILL.md +0 -65
- package/unityclaw-idp-personal-documents/SKILL.md +0 -69
- package/unityclaw-image-compress/SKILL.md +0 -275
- package/unityclaw-video-frame-extract/SKILL.md +0 -50
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ export UNITYCLAW_API_KEY=your-api-key
|
|
|
35
35
|
npx @unityclaw/skills install
|
|
36
36
|
|
|
37
37
|
# Install specific skills
|
|
38
|
-
npx @unityclaw/skills install unityclaw-image-generation unityclaw-video-generation-kling
|
|
38
|
+
npx @unityclaw/skills install unityclaw-image-generation-jimeng unityclaw-video-generation-kling
|
|
39
39
|
|
|
40
40
|
# Install to OpenClaw
|
|
41
41
|
npx @unityclaw/skills install --target openclaw
|
|
@@ -57,10 +57,8 @@ This list is aligned with `~/moox/field-feishu` shortcuts and `server` `Paramete
|
|
|
57
57
|
|
|
58
58
|
### Image
|
|
59
59
|
|
|
60
|
-
- [unityclaw-image-generation](./unityclaw-image-generation/SKILL.md)
|
|
60
|
+
- [unityclaw-image-generation-jimeng](./unityclaw-image-generation-jimeng/SKILL.md)
|
|
61
61
|
: Covers `jimeng/image` (primary) + `jimeng/image/v3` (compat)
|
|
62
|
-
- [unityclaw-image-compress](./unityclaw-image-compress/SKILL.md)
|
|
63
|
-
: Covers `image/compress`
|
|
64
62
|
|
|
65
63
|
### Video
|
|
66
64
|
|
|
@@ -75,8 +73,6 @@ This list is aligned with `~/moox/field-feishu` shortcuts and `server` `Paramete
|
|
|
75
73
|
|
|
76
74
|
- [unityclaw-document-translation](./unityclaw-document-translation/SKILL.md)
|
|
77
75
|
: Covers `doc/translate`
|
|
78
|
-
- [unityclaw-document-convert](./unityclaw-document-convert/SKILL.md)
|
|
79
|
-
: Covers generic `doc_convert/image` + `doc_convert/pdf`
|
|
80
76
|
|
|
81
77
|
### Media
|
|
82
78
|
|
|
@@ -88,21 +84,16 @@ This list is aligned with `~/moox/field-feishu` shortcuts and `server` `Paramete
|
|
|
88
84
|
: Covers `media_user_info`
|
|
89
85
|
- [unityclaw-media-download-xhs](./unityclaw-media-download-xhs/SKILL.md)
|
|
90
86
|
: Covers `xiaohongshu/download`
|
|
91
|
-
- [unityclaw-video-frame-extract](./unityclaw-video-frame-extract/SKILL.md)
|
|
92
|
-
: Covers `video/frame`
|
|
93
87
|
|
|
94
|
-
|
|
88
|
+
## Temporarily Removed Skills
|
|
95
89
|
|
|
96
|
-
-
|
|
97
|
-
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
-
|
|
101
|
-
|
|
102
|
-
-
|
|
103
|
-
: Covers `idp/contract`
|
|
104
|
-
|
|
105
|
-
IDP is intentionally split by scenario (personal/invoice/business/contract), instead of one generic skill, to improve skill routing accuracy and parameter selection success.
|
|
90
|
+
- `unityclaw-document-convert`
|
|
91
|
+
- `unityclaw-image-compress`
|
|
92
|
+
- `unityclaw-video-frame-extract`
|
|
93
|
+
- `unityclaw-idp-personal-documents`
|
|
94
|
+
- `unityclaw-idp-invoice-extraction`
|
|
95
|
+
- `unityclaw-idp-business-extraction`
|
|
96
|
+
- `unityclaw-idp-contract-extraction`
|
|
106
97
|
|
|
107
98
|
## Local File Input Support
|
|
108
99
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: unityclaw-image-generation
|
|
2
|
+
name: unityclaw-image-generation-jimeng
|
|
3
3
|
description: Generate high-quality images using JiMeng (Doubao) models
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.4
|
|
5
5
|
metadata:
|
|
6
6
|
openclaw:
|
|
7
7
|
requires:
|
|
@@ -72,7 +72,7 @@ if (result.success && result.response?.data) {
|
|
|
72
72
|
## SDK Version Check Rule
|
|
73
73
|
|
|
74
74
|
- Before invoking this skill, check local `@unityclaw/sdk` version.
|
|
75
|
-
- Required minimum SDK version: `1.1.
|
|
75
|
+
- Required minimum SDK version: `1.1.4`
|
|
76
76
|
- If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
|
|
77
77
|
- Suggested command: `npm i @unityclaw/sdk@latest`
|
|
78
78
|
<!-- SDK_VERSION_RULE_END -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: unityclaw-media-analysis
|
|
3
3
|
description: Analyze video and audio content to extract subtitles, summaries, and insights
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.4
|
|
5
5
|
metadata:
|
|
6
6
|
openclaw:
|
|
7
7
|
requires:
|
|
@@ -352,7 +352,7 @@ console.log('Task Folder:', result.taskFolder);
|
|
|
352
352
|
## SDK Version Check Rule
|
|
353
353
|
|
|
354
354
|
- Before invoking this skill, check local `@unityclaw/sdk` version.
|
|
355
|
-
- Required minimum SDK version: `1.1.
|
|
355
|
+
- Required minimum SDK version: `1.1.4`
|
|
356
356
|
- If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
|
|
357
357
|
- Suggested command: `npm i @unityclaw/sdk@latest`
|
|
358
358
|
<!-- SDK_VERSION_RULE_END -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: unityclaw-media-download-xhs
|
|
3
3
|
description: Download Xiaohongshu media and return cover/video URLs
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.4
|
|
5
5
|
metadata:
|
|
6
6
|
openclaw:
|
|
7
7
|
requires:
|
|
@@ -43,7 +43,7 @@ if (result.success && result.response?.data) {
|
|
|
43
43
|
## SDK Version Check Rule
|
|
44
44
|
|
|
45
45
|
- Before invoking this skill, check local `@unityclaw/sdk` version.
|
|
46
|
-
- Required minimum SDK version: `1.1.
|
|
46
|
+
- Required minimum SDK version: `1.1.4`
|
|
47
47
|
- If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
|
|
48
48
|
- Suggested command: `npm i @unityclaw/sdk@latest`
|
|
49
49
|
<!-- SDK_VERSION_RULE_END -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: unityclaw-media-stats
|
|
3
3
|
description: Extract social media post metrics (play, like, comment, share, etc.) from links
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.4
|
|
5
5
|
metadata:
|
|
6
6
|
openclaw:
|
|
7
7
|
requires:
|
|
@@ -43,7 +43,7 @@ if (result.success && result.response?.data) {
|
|
|
43
43
|
## SDK Version Check Rule
|
|
44
44
|
|
|
45
45
|
- Before invoking this skill, check local `@unityclaw/sdk` version.
|
|
46
|
-
- Required minimum SDK version: `1.1.
|
|
46
|
+
- Required minimum SDK version: `1.1.4`
|
|
47
47
|
- If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
|
|
48
48
|
- Suggested command: `npm i @unityclaw/sdk@latest`
|
|
49
49
|
<!-- SDK_VERSION_RULE_END -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: unityclaw-media-user-info
|
|
3
3
|
description: Extract social media user profile metrics from homepage links
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.4
|
|
5
5
|
metadata:
|
|
6
6
|
openclaw:
|
|
7
7
|
requires:
|
|
@@ -43,7 +43,7 @@ if (result.success && result.response?.data) {
|
|
|
43
43
|
## SDK Version Check Rule
|
|
44
44
|
|
|
45
45
|
- Before invoking this skill, check local `@unityclaw/sdk` version.
|
|
46
|
-
- Required minimum SDK version: `1.1.
|
|
46
|
+
- Required minimum SDK version: `1.1.4`
|
|
47
47
|
- If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
|
|
48
48
|
- Suggested command: `npm i @unityclaw/sdk@latest`
|
|
49
49
|
<!-- SDK_VERSION_RULE_END -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: unityclaw-video-generation-jimeng-doubao
|
|
3
3
|
description: Generate videos with JiMeng or Doubao models (text-to-video and image-to-video)
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.4
|
|
5
5
|
metadata:
|
|
6
6
|
openclaw:
|
|
7
7
|
requires:
|
|
@@ -76,7 +76,7 @@ SDK will auto-upload local files and fill `tmp_url`.
|
|
|
76
76
|
## SDK Version Check Rule
|
|
77
77
|
|
|
78
78
|
- Before invoking this skill, check local `@unityclaw/sdk` version.
|
|
79
|
-
- Required minimum SDK version: `1.1.
|
|
79
|
+
- Required minimum SDK version: `1.1.4`
|
|
80
80
|
- If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
|
|
81
81
|
- Suggested command: `npm i @unityclaw/sdk@latest`
|
|
82
82
|
<!-- SDK_VERSION_RULE_END -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: unityclaw-video-generation-kling
|
|
3
3
|
description: Generate AI videos using Kling model with multi-version support
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.4
|
|
5
5
|
metadata:
|
|
6
6
|
openclaw:
|
|
7
7
|
requires:
|
|
@@ -277,7 +277,7 @@ console.log('Downloaded Videos:', result.attachments);
|
|
|
277
277
|
## SDK Version Check Rule
|
|
278
278
|
|
|
279
279
|
- Before invoking this skill, check local `@unityclaw/sdk` version.
|
|
280
|
-
- Required minimum SDK version: `1.1.
|
|
280
|
+
- Required minimum SDK version: `1.1.4`
|
|
281
281
|
- If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
|
|
282
282
|
- Suggested command: `npm i @unityclaw/sdk@latest`
|
|
283
283
|
<!-- SDK_VERSION_RULE_END -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: unityclaw-video-generation-wan-minimax
|
|
3
3
|
description: Generate videos with Wan and MiniMax models for cinematic or controllable workflows
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.4
|
|
5
5
|
metadata:
|
|
6
6
|
openclaw:
|
|
7
7
|
requires:
|
|
@@ -73,7 +73,7 @@ SDK will auto-upload local files and fill `tmp_url`.
|
|
|
73
73
|
## SDK Version Check Rule
|
|
74
74
|
|
|
75
75
|
- Before invoking this skill, check local `@unityclaw/sdk` version.
|
|
76
|
-
- Required minimum SDK version: `1.1.
|
|
76
|
+
- Required minimum SDK version: `1.1.4`
|
|
77
77
|
- If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
|
|
78
78
|
- Suggested command: `npm i @unityclaw/sdk@latest`
|
|
79
79
|
<!-- SDK_VERSION_RULE_END -->
|
|
@@ -1,424 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: unityclaw-document-convert
|
|
3
|
-
description: Convert documents between formats (PDF, Word, PPT, Excel, Image)
|
|
4
|
-
version: 1.1.2
|
|
5
|
-
metadata:
|
|
6
|
-
openclaw:
|
|
7
|
-
requires:
|
|
8
|
-
env:
|
|
9
|
-
- UNITYCLAW_API_KEY
|
|
10
|
-
bins:
|
|
11
|
-
- node
|
|
12
|
-
- npm
|
|
13
|
-
primaryEnv: UNITYCLAW_API_KEY
|
|
14
|
-
emoji: "📄"
|
|
15
|
-
homepage: https://unityclaw.com
|
|
16
|
-
install:
|
|
17
|
-
- kind: node
|
|
18
|
-
package: "@unityclaw/sdk"
|
|
19
|
-
bins: []
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
# UnityClaw Document Convert
|
|
23
|
-
|
|
24
|
-
Convert documents between various formats including PDF, Word, PowerPoint, Excel, and images.
|
|
25
|
-
Recommended API is unified `client.document.convertDocument(...)`.
|
|
26
|
-
|
|
27
|
-
## Installation
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
npm install @unityclaw/sdk
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Configuration
|
|
34
|
-
|
|
35
|
-
Set your API key using one of these methods:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
# Method 1: Use SDK CLI (recommended - persists across sessions)
|
|
39
|
-
npx @unityclaw/sdk config set apiKey your-api-key
|
|
40
|
-
|
|
41
|
-
# Method 2: Environment variable
|
|
42
|
-
export UNITYCLAW_API_KEY=your-api-key
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Response Structure
|
|
46
|
-
|
|
47
|
-
> **IMPORTANT:** The result has a nested structure. Use `result.success` to check overall success, and access data via `result.response.data`.
|
|
48
|
-
|
|
49
|
-
```typescript
|
|
50
|
-
interface UnityClawResult {
|
|
51
|
-
success: boolean; // ✅ Use this to check if SDK call succeeded
|
|
52
|
-
taskId: string; // Task identifier
|
|
53
|
-
taskFolder: string; // Path to task folder with logs
|
|
54
|
-
duration: number; // Request duration in ms
|
|
55
|
-
response: { // API response object
|
|
56
|
-
code: number; // 0 = success
|
|
57
|
-
data: Array<{ // ✅ Result data here
|
|
58
|
-
name: string;
|
|
59
|
-
contentType: string;
|
|
60
|
-
content: string; // URL to converted document
|
|
61
|
-
}> | null;
|
|
62
|
-
};
|
|
63
|
-
logs: Array<{ timestamp; level; message }>;
|
|
64
|
-
attachments: any[];
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Quick Start
|
|
69
|
-
|
|
70
|
-
```typescript
|
|
71
|
-
import { UnityClawClient } from '@unityclaw/sdk';
|
|
72
|
-
|
|
73
|
-
const client = new UnityClawClient();
|
|
74
|
-
|
|
75
|
-
// Convert PDF to Word (unified API)
|
|
76
|
-
const result = await client.document.convertDocument({
|
|
77
|
-
attachment: [
|
|
78
|
-
{ path: './files/document.pdf' }
|
|
79
|
-
],
|
|
80
|
-
input_format: 'pdf',
|
|
81
|
-
output_format: 'docx'
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// ✅ Correct: Check result.success, access data via result.response.data
|
|
85
|
-
if (result.success && result.response?.data) {
|
|
86
|
-
console.log('Converted document:', result.response.data);
|
|
87
|
-
}
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Available APIs
|
|
91
|
-
|
|
92
|
-
### Image Conversions
|
|
93
|
-
|
|
94
|
-
| Method | Description |
|
|
95
|
-
|--------|-------------|
|
|
96
|
-
| `image2Word()` | Convert image to Word document |
|
|
97
|
-
| `image2Ppt()` | Convert image to PowerPoint |
|
|
98
|
-
| `image2Excel()` | Convert image to Excel |
|
|
99
|
-
| `image2Pdf()` | Convert image to PDF |
|
|
100
|
-
|
|
101
|
-
### PDF Conversions
|
|
102
|
-
|
|
103
|
-
| Method | Description |
|
|
104
|
-
|--------|-------------|
|
|
105
|
-
| `pdf2Word()` | Convert PDF to Word document |
|
|
106
|
-
| `pdf2Ppt()` | Convert PDF to PowerPoint |
|
|
107
|
-
| `pdf2Excel()` | Convert PDF to Excel |
|
|
108
|
-
| `pdf2Image()` | Convert PDF to images |
|
|
109
|
-
|
|
110
|
-
### Generic Conversion
|
|
111
|
-
|
|
112
|
-
| Method | Description |
|
|
113
|
-
|--------|-------------|
|
|
114
|
-
| `convertDocument()` | Recommended unified conversion API |
|
|
115
|
-
| `convert()` | Generic conversion with format specification |
|
|
116
|
-
|
|
117
|
-
## API Reference
|
|
118
|
-
|
|
119
|
-
### Image to Word
|
|
120
|
-
|
|
121
|
-
```typescript
|
|
122
|
-
await client.document.image2Word({
|
|
123
|
-
attachment: AttachmentFieldItem[]
|
|
124
|
-
}): Promise<APIResponse<AttachmentResult[]>>
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
### Image to PowerPoint
|
|
128
|
-
|
|
129
|
-
```typescript
|
|
130
|
-
await client.document.image2Ppt({
|
|
131
|
-
attachment: AttachmentFieldItem[]
|
|
132
|
-
}): Promise<APIResponse<AttachmentResult[]>>
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Image to Excel
|
|
136
|
-
|
|
137
|
-
```typescript
|
|
138
|
-
await client.document.image2Excel({
|
|
139
|
-
attachment: AttachmentFieldItem[]
|
|
140
|
-
}): Promise<APIResponse<AttachmentResult[]>>
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### Image to PDF
|
|
144
|
-
|
|
145
|
-
```typescript
|
|
146
|
-
await client.document.image2Pdf({
|
|
147
|
-
attachment: AttachmentFieldItem[]
|
|
148
|
-
}): Promise<APIResponse<AttachmentResult[]>>
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### PDF to Word
|
|
152
|
-
|
|
153
|
-
```typescript
|
|
154
|
-
await client.document.pdf2Word({
|
|
155
|
-
attachment: AttachmentFieldItem[]
|
|
156
|
-
}): Promise<APIResponse<AttachmentResult[]>>
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### PDF to PowerPoint
|
|
160
|
-
|
|
161
|
-
```typescript
|
|
162
|
-
await client.document.pdf2Ppt({
|
|
163
|
-
attachment: AttachmentFieldItem[]
|
|
164
|
-
}): Promise<APIResponse<AttachmentResult[]>>
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### PDF to Excel
|
|
168
|
-
|
|
169
|
-
```typescript
|
|
170
|
-
await client.document.pdf2Excel({
|
|
171
|
-
attachment: AttachmentFieldItem[]
|
|
172
|
-
}): Promise<APIResponse<AttachmentResult[]>>
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
### PDF to Image
|
|
176
|
-
|
|
177
|
-
```typescript
|
|
178
|
-
await client.document.pdf2Image({
|
|
179
|
-
attachment: AttachmentFieldItem[]
|
|
180
|
-
}): Promise<APIResponse<AttachmentResult[]>>
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
### Generic Convert
|
|
184
|
-
|
|
185
|
-
```typescript
|
|
186
|
-
await client.document.convert({
|
|
187
|
-
attachment: AttachmentFieldItem[];
|
|
188
|
-
input_format?: string;
|
|
189
|
-
output_format: string;
|
|
190
|
-
}): Promise<APIResponse<AttachmentResult[]>>
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
## Examples
|
|
194
|
-
|
|
195
|
-
### PDF to Word
|
|
196
|
-
|
|
197
|
-
```typescript
|
|
198
|
-
const client = new UnityClawClient();
|
|
199
|
-
|
|
200
|
-
const result = await client.document.pdf2Word({
|
|
201
|
-
attachment: [
|
|
202
|
-
{ tmp_url: 'https://example.com/report.pdf', name: 'report.pdf' }
|
|
203
|
-
]
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
if (result.success && result.response?.data) {
|
|
207
|
-
console.log('Word document:', result.response.data[0].content);
|
|
208
|
-
}
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
### PDF to PowerPoint
|
|
212
|
-
|
|
213
|
-
```typescript
|
|
214
|
-
const result = await client.document.pdf2Ppt({
|
|
215
|
-
attachment: [
|
|
216
|
-
{ tmp_url: 'https://example.com/slides.pdf', name: 'slides.pdf' }
|
|
217
|
-
]
|
|
218
|
-
});
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
### PDF to Excel
|
|
222
|
-
|
|
223
|
-
```typescript
|
|
224
|
-
const result = await client.document.pdf2Excel({
|
|
225
|
-
attachment: [
|
|
226
|
-
{ tmp_url: 'https://example.com/data.pdf', name: 'data.pdf' }
|
|
227
|
-
]
|
|
228
|
-
});
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
### PDF to Image
|
|
232
|
-
|
|
233
|
-
```typescript
|
|
234
|
-
const result = await client.document.pdf2Image({
|
|
235
|
-
attachment: [
|
|
236
|
-
{ tmp_url: 'https://example.com/document.pdf', name: 'document.pdf' }
|
|
237
|
-
]
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
// Returns array of images (one per page)
|
|
241
|
-
if (result.success && result.response?.data) {
|
|
242
|
-
result.response.data.forEach((img, i) => {
|
|
243
|
-
console.log(`Page ${i + 1}: ${img.content}`);
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
### Image to Word (OCR)
|
|
249
|
-
|
|
250
|
-
```typescript
|
|
251
|
-
const result = await client.document.image2Word({
|
|
252
|
-
attachment: [
|
|
253
|
-
{ tmp_url: 'https://example.com/scanned-doc.jpg', name: 'scanned.jpg' }
|
|
254
|
-
]
|
|
255
|
-
});
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
### Image to PowerPoint
|
|
259
|
-
|
|
260
|
-
```typescript
|
|
261
|
-
const result = await client.document.image2Ppt({
|
|
262
|
-
attachment: [
|
|
263
|
-
{ tmp_url: 'https://example.com/diagram.png', name: 'diagram.png' }
|
|
264
|
-
]
|
|
265
|
-
});
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
### Image to Excel
|
|
269
|
-
|
|
270
|
-
```typescript
|
|
271
|
-
const result = await client.document.image2Excel({
|
|
272
|
-
attachment: [
|
|
273
|
-
{ tmp_url: 'https://example.com/spreadsheet.png', name: 'spreadsheet.png' }
|
|
274
|
-
]
|
|
275
|
-
});
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
### Image to PDF
|
|
279
|
-
|
|
280
|
-
```typescript
|
|
281
|
-
const result = await client.document.image2Pdf({
|
|
282
|
-
attachment: [
|
|
283
|
-
{ tmp_url: 'https://example.com/page1.jpg', name: 'page1.jpg' },
|
|
284
|
-
{ tmp_url: 'https://example.com/page2.jpg', name: 'page2.jpg' }
|
|
285
|
-
]
|
|
286
|
-
});
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
### Generic Convert
|
|
290
|
-
|
|
291
|
-
```typescript
|
|
292
|
-
// Image to PDF
|
|
293
|
-
const result = await client.document.convert({
|
|
294
|
-
attachment: [{ tmp_url: 'https://...', name: 'image.jpg' }],
|
|
295
|
-
input_format: 'image',
|
|
296
|
-
output_format: 'pdf'
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
// PDF to Word
|
|
300
|
-
const result = await client.document.convert({
|
|
301
|
-
attachment: [{ tmp_url: 'https://...', name: 'doc.pdf' }],
|
|
302
|
-
input_format: 'pdf',
|
|
303
|
-
output_format: 'word'
|
|
304
|
-
});
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
### Batch Conversion
|
|
308
|
-
|
|
309
|
-
```typescript
|
|
310
|
-
const pdfFiles = [
|
|
311
|
-
{ tmp_url: 'https://example.com/doc1.pdf', name: 'doc1.pdf' },
|
|
312
|
-
{ tmp_url: 'https://example.com/doc2.pdf', name: 'doc2.pdf' },
|
|
313
|
-
{ tmp_url: 'https://example.com/doc3.pdf', name: 'doc3.pdf' }
|
|
314
|
-
];
|
|
315
|
-
|
|
316
|
-
const results = await Promise.all(
|
|
317
|
-
pdfFiles.map(file => client.document.pdf2Word({ attachment: [file] }))
|
|
318
|
-
);
|
|
319
|
-
|
|
320
|
-
results.forEach((result, i) => {
|
|
321
|
-
if (result.success && result.response?.data) {
|
|
322
|
-
console.log(`File ${i + 1} converted: ${result.response.data?.[0]?.content}`);
|
|
323
|
-
}
|
|
324
|
-
});
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
### Convert Then Translate
|
|
328
|
-
|
|
329
|
-
```typescript
|
|
330
|
-
// Convert image to Word, then translate
|
|
331
|
-
const converted = await client.document.image2Word({
|
|
332
|
-
attachment: [{ tmp_url: 'https://...', name: 'image.jpg' }]
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
if (converted.success && converted.response?.data) {
|
|
336
|
-
const translated = await client.document.translate({
|
|
337
|
-
attachment: converted.response.data,
|
|
338
|
-
source_language: 'en',
|
|
339
|
-
target_language: 'zh'
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
console.log('Translated document:', translated.response?.data);
|
|
343
|
-
}
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
## Response Format
|
|
347
|
-
|
|
348
|
-
```typescript
|
|
349
|
-
interface AttachmentResult {
|
|
350
|
-
name: string;
|
|
351
|
-
contentType: 'attachment/url';
|
|
352
|
-
content: string; // URL to converted document
|
|
353
|
-
}
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
## Error Handling
|
|
357
|
-
|
|
358
|
-
```typescript
|
|
359
|
-
const result = await client.document.pdf2Word({
|
|
360
|
-
attachment: [{ tmp_url: 'https://...', name: 'doc.pdf' }]
|
|
361
|
-
});
|
|
362
|
-
|
|
363
|
-
if (!result.success) {
|
|
364
|
-
console.error('Request failed');
|
|
365
|
-
console.log('Check logs:', result.logs);
|
|
366
|
-
return;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
if (result.response?.code !== 0) {
|
|
370
|
-
console.error('API error:', result.response);
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
// Success
|
|
375
|
-
console.log('Success:', result.response.data);
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
## Task Folders
|
|
379
|
-
|
|
380
|
-
Each execution creates a task folder:
|
|
381
|
-
|
|
382
|
-
```typescript
|
|
383
|
-
const result = await client.document.pdf2Word({
|
|
384
|
-
attachment: [{ tmp_url: 'https://...', name: 'doc.pdf' }]
|
|
385
|
-
});
|
|
386
|
-
|
|
387
|
-
console.log('Task ID:', result.taskId);
|
|
388
|
-
console.log('Task Folder:', result.taskFolder);
|
|
389
|
-
console.log('Downloaded Files:', result.attachments);
|
|
390
|
-
```
|
|
391
|
-
|
|
392
|
-
## Conversion Matrix
|
|
393
|
-
|
|
394
|
-
| From | To | Method |
|
|
395
|
-
|------|-----|--------|
|
|
396
|
-
| PDF | Word | `pdf2Word()` |
|
|
397
|
-
| PDF | PowerPoint | `pdf2Ppt()` |
|
|
398
|
-
| PDF | Excel | `pdf2Excel()` |
|
|
399
|
-
| PDF | Image | `pdf2Image()` |
|
|
400
|
-
| Image | Word | `image2Word()` |
|
|
401
|
-
| Image | PowerPoint | `image2Ppt()` |
|
|
402
|
-
| Image | Excel | `image2Excel()` |
|
|
403
|
-
| Image | PDF | `image2Pdf()` |
|
|
404
|
-
|
|
405
|
-
## Best Practices
|
|
406
|
-
|
|
407
|
-
1. **File Size**: Large files may take longer to process
|
|
408
|
-
2. **Format Fidelity**: Complex formatting may have minor differences
|
|
409
|
-
3. **Batch Processing**: Use Promise.all for multiple files
|
|
410
|
-
4. **Error Recovery**: Always check result.code before proceeding
|
|
411
|
-
|
|
412
|
-
## Related Skills
|
|
413
|
-
|
|
414
|
-
- [unityclaw-document-translation](../unityclaw-document-translation/SKILL.md) - Translate documents
|
|
415
|
-
- [unityclaw-image-compress](../unityclaw-image-compress/SKILL.md) - Compress images before conversion
|
|
416
|
-
|
|
417
|
-
<!-- SDK_VERSION_RULE_START -->
|
|
418
|
-
## SDK Version Check Rule
|
|
419
|
-
|
|
420
|
-
- Before invoking this skill, check local `@unityclaw/sdk` version.
|
|
421
|
-
- Required minimum SDK version: `1.1.2`
|
|
422
|
-
- If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
|
|
423
|
-
- Suggested command: `npm i @unityclaw/sdk@latest`
|
|
424
|
-
<!-- SDK_VERSION_RULE_END -->
|