@unityclaw/skills 1.1.2 → 1.1.3
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-document-translation/SKILL.md +2 -2
- 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-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
2
|
name: unityclaw-document-translation
|
|
3
3
|
description: Translate documents between multiple languages while preserving formatting
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.3
|
|
5
5
|
metadata:
|
|
6
6
|
openclaw:
|
|
7
7
|
requires:
|
|
@@ -312,7 +312,7 @@ console.log('Downloaded Files:', result.attachments);
|
|
|
312
312
|
## SDK Version Check Rule
|
|
313
313
|
|
|
314
314
|
- Before invoking this skill, check local `@unityclaw/sdk` version.
|
|
315
|
-
- Required minimum SDK version: `1.1.
|
|
315
|
+
- Required minimum SDK version: `1.1.3`
|
|
316
316
|
- If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
|
|
317
317
|
- Suggested command: `npm i @unityclaw/sdk@latest`
|
|
318
318
|
<!-- SDK_VERSION_RULE_END -->
|
|
@@ -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.3
|
|
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.3`
|
|
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.3
|
|
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.3`
|
|
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.3
|
|
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.3`
|
|
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.3
|
|
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.3`
|
|
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.3
|
|
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.3`
|
|
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.3
|
|
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.3`
|
|
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.3
|
|
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.3`
|
|
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.3
|
|
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.3`
|
|
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 -->
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: unityclaw-idp-business-extraction
|
|
3
|
-
description: Extract fields from business documents (business license, business card)
|
|
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 IDP - Business Extraction
|
|
23
|
-
|
|
24
|
-
Use this skill for business document extraction:
|
|
25
|
-
- `business_license`
|
|
26
|
-
- `business_card`
|
|
27
|
-
|
|
28
|
-
## SDK APIs
|
|
29
|
-
|
|
30
|
-
```typescript
|
|
31
|
-
await client.idp.businessLicense({ attachments: [{ path: './files/business-license.jpg' }] });
|
|
32
|
-
await client.idp.businessCard({ attachments: [{ path: './files/business-card.jpg' }] });
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Or generic API:
|
|
36
|
-
|
|
37
|
-
```typescript
|
|
38
|
-
await client.idp.extract('business_license', {
|
|
39
|
-
attachments: [{ path: './files/business-license.jpg' }]
|
|
40
|
-
});
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Input
|
|
44
|
-
|
|
45
|
-
```typescript
|
|
46
|
-
{
|
|
47
|
-
attachments: AttachmentInput[]
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Notes
|
|
52
|
-
|
|
53
|
-
- This skill groups enterprise scenarios to avoid over-generic routing.
|
|
54
|
-
- Output fields vary between license and card extraction.
|
|
55
|
-
|
|
56
|
-
<!-- SDK_VERSION_RULE_START -->
|
|
57
|
-
## SDK Version Check Rule
|
|
58
|
-
|
|
59
|
-
- Before invoking this skill, check local `@unityclaw/sdk` version.
|
|
60
|
-
- Required minimum SDK version: `1.1.2`
|
|
61
|
-
- If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
|
|
62
|
-
- Suggested command: `npm i @unityclaw/sdk@latest`
|
|
63
|
-
<!-- SDK_VERSION_RULE_END -->
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: unityclaw-idp-contract-extraction
|
|
3
|
-
description: Extract structured fields from contract files
|
|
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 IDP - Contract Extraction
|
|
23
|
-
|
|
24
|
-
Use this skill for contract parsing:
|
|
25
|
-
- `contract`
|
|
26
|
-
|
|
27
|
-
## SDK APIs
|
|
28
|
-
|
|
29
|
-
```typescript
|
|
30
|
-
await client.idp.contract({
|
|
31
|
-
attachments: [{ path: './files/contract.pdf' }]
|
|
32
|
-
});
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Or generic API:
|
|
36
|
-
|
|
37
|
-
```typescript
|
|
38
|
-
await client.idp.extract('contract', {
|
|
39
|
-
attachments: [{ path: './files/contract.pdf' }]
|
|
40
|
-
});
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Input
|
|
44
|
-
|
|
45
|
-
```typescript
|
|
46
|
-
{
|
|
47
|
-
attachments: AttachmentInput[]
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Notes
|
|
52
|
-
|
|
53
|
-
- Preferred for long contract OCR + key field extraction scenarios.
|
|
54
|
-
- Read extracted data from `result.response.data`.
|
|
55
|
-
|
|
56
|
-
<!-- SDK_VERSION_RULE_START -->
|
|
57
|
-
## SDK Version Check Rule
|
|
58
|
-
|
|
59
|
-
- Before invoking this skill, check local `@unityclaw/sdk` version.
|
|
60
|
-
- Required minimum SDK version: `1.1.2`
|
|
61
|
-
- If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
|
|
62
|
-
- Suggested command: `npm i @unityclaw/sdk@latest`
|
|
63
|
-
<!-- SDK_VERSION_RULE_END -->
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: unityclaw-idp-invoice-extraction
|
|
3
|
-
description: Extract fields from invoice and ticket documents (VAT, train, taxi)
|
|
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 IDP - Invoice Extraction
|
|
23
|
-
|
|
24
|
-
Use this skill for invoice/ticket extraction:
|
|
25
|
-
- `vat_invoice`
|
|
26
|
-
- `train_invoice`
|
|
27
|
-
- `taxi_invoice`
|
|
28
|
-
|
|
29
|
-
## SDK APIs
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
await client.idp.vatInvoice({ attachments: [{ path: './files/vat-invoice.pdf' }] });
|
|
33
|
-
await client.idp.trainInvoice({ attachments: [{ path: './files/train-ticket.jpg' }] });
|
|
34
|
-
await client.idp.taxiInvoice({ attachments: [{ path: './files/taxi-invoice.jpg' }] });
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Or generic API:
|
|
38
|
-
|
|
39
|
-
```typescript
|
|
40
|
-
await client.idp.extract('vat_invoice', {
|
|
41
|
-
attachments: [{ path: './files/vat-invoice.pdf' }]
|
|
42
|
-
});
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Input
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
{
|
|
49
|
-
attachments: AttachmentInput[]
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Notes
|
|
54
|
-
|
|
55
|
-
- Files can be image/PDF according to each underlying IDP type.
|
|
56
|
-
- Output schema differs by type; parse from `result.response.data`.
|
|
57
|
-
|
|
58
|
-
<!-- SDK_VERSION_RULE_START -->
|
|
59
|
-
## SDK Version Check Rule
|
|
60
|
-
|
|
61
|
-
- Before invoking this skill, check local `@unityclaw/sdk` version.
|
|
62
|
-
- Required minimum SDK version: `1.1.2`
|
|
63
|
-
- If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
|
|
64
|
-
- Suggested command: `npm i @unityclaw/sdk@latest`
|
|
65
|
-
<!-- SDK_VERSION_RULE_END -->
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: unityclaw-idp-personal-documents
|
|
3
|
-
description: Extract structured fields from personal identity documents (ID card, vehicle license, bank card)
|
|
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 IDP - Personal Documents
|
|
23
|
-
|
|
24
|
-
Use this skill for personal document extraction:
|
|
25
|
-
- `id_card`
|
|
26
|
-
- `vehicle_license`
|
|
27
|
-
- `bank_card`
|
|
28
|
-
|
|
29
|
-
## SDK APIs
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
await client.idp.idCard({ attachments: [{ path: './files/id-card.jpg' }] });
|
|
33
|
-
await client.idp.vehicleLicense({ attachments: [{ path: './files/vehicle-license.jpg' }] });
|
|
34
|
-
await client.idp.bankCard({ attachments: [{ path: './files/bank-card.jpg' }] });
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Or generic API:
|
|
38
|
-
|
|
39
|
-
```typescript
|
|
40
|
-
await client.idp.extract('id_card', {
|
|
41
|
-
attachments: [{ path: './files/id-card.jpg' }]
|
|
42
|
-
});
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Input
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
{
|
|
49
|
-
attachments: AttachmentInput[]
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
`AttachmentInput` supports:
|
|
54
|
-
- `tmp_url`
|
|
55
|
-
- local path (`path` / `localPath` / `filePath`), SDK auto-uploads to `/api/upload`
|
|
56
|
-
|
|
57
|
-
## Notes
|
|
58
|
-
|
|
59
|
-
- This category is split from invoice/business/contract to improve skill routing success.
|
|
60
|
-
- Output fields vary by type; read from `result.response.data`.
|
|
61
|
-
|
|
62
|
-
<!-- SDK_VERSION_RULE_START -->
|
|
63
|
-
## SDK Version Check Rule
|
|
64
|
-
|
|
65
|
-
- Before invoking this skill, check local `@unityclaw/sdk` version.
|
|
66
|
-
- Required minimum SDK version: `1.1.2`
|
|
67
|
-
- If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
|
|
68
|
-
- Suggested command: `npm i @unityclaw/sdk@latest`
|
|
69
|
-
<!-- SDK_VERSION_RULE_END -->
|
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: unityclaw-image-compress
|
|
3
|
-
description: Compress images with quality control to reduce file size
|
|
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 Image Compress
|
|
23
|
-
|
|
24
|
-
Compress images to reduce file size while maintaining visual quality.
|
|
25
|
-
|
|
26
|
-
## Installation
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npm install @unityclaw/sdk
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Configuration
|
|
33
|
-
|
|
34
|
-
Set your API key using one of these methods:
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
# Method 1: Use SDK CLI (recommended - persists across sessions)
|
|
38
|
-
npx @unityclaw/sdk config set apiKey your-api-key
|
|
39
|
-
|
|
40
|
-
# Method 2: Environment variable
|
|
41
|
-
export UNITYCLAW_API_KEY=your-api-key
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Response Structure
|
|
45
|
-
|
|
46
|
-
> **IMPORTANT:** The result has a nested structure. Use `result.success` to check overall success, and access data via `result.response.data`.
|
|
47
|
-
|
|
48
|
-
```typescript
|
|
49
|
-
interface UnityClawResult {
|
|
50
|
-
success: boolean; // ✅ Use this to check if SDK call succeeded
|
|
51
|
-
taskId: string; // Task identifier
|
|
52
|
-
taskFolder: string; // Path to task folder with logs
|
|
53
|
-
duration: number; // Request duration in ms
|
|
54
|
-
response: { // API response object
|
|
55
|
-
code: number; // 0 = success
|
|
56
|
-
data: Array<{ // ✅ Result data here
|
|
57
|
-
name: string;
|
|
58
|
-
contentType: string;
|
|
59
|
-
content: string; // URL to compressed image
|
|
60
|
-
}> | null;
|
|
61
|
-
};
|
|
62
|
-
logs: Array<{ timestamp; level; message }>;
|
|
63
|
-
attachments: any[];
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## Quick Start
|
|
68
|
-
|
|
69
|
-
```typescript
|
|
70
|
-
import { UnityClawClient } from '@unityclaw/sdk';
|
|
71
|
-
|
|
72
|
-
const client = new UnityClawClient();
|
|
73
|
-
|
|
74
|
-
const result = await client.image.compress({
|
|
75
|
-
attachment: [
|
|
76
|
-
{ tmp_url: 'https://example.com/large-image.jpg', name: 'image.jpg' }
|
|
77
|
-
],
|
|
78
|
-
quality: 80
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
// ✅ Correct: Check result.success, access data via result.response.data
|
|
82
|
-
if (result.success && result.response?.data) {
|
|
83
|
-
console.log('Compressed images:', result.response.data);
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## API Reference
|
|
88
|
-
|
|
89
|
-
### compress()
|
|
90
|
-
|
|
91
|
-
Compress one or more images with customizable quality.
|
|
92
|
-
|
|
93
|
-
```typescript
|
|
94
|
-
await client.image.compress({
|
|
95
|
-
attachment: AttachmentFieldItem[],
|
|
96
|
-
quality?: number
|
|
97
|
-
}): Promise<APIResponse<AttachmentResult[]>>
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Parameters
|
|
101
|
-
|
|
102
|
-
| Parameter | Type | Required | Description |
|
|
103
|
-
|-----------|------|----------|-------------|
|
|
104
|
-
| `attachment` | `AttachmentFieldItem[]` | Yes | Array of images to compress |
|
|
105
|
-
| `quality` | `number` | No | Compression quality (0-100, default: 80) |
|
|
106
|
-
|
|
107
|
-
### AttachmentFieldItem
|
|
108
|
-
|
|
109
|
-
```typescript
|
|
110
|
-
interface AttachmentFieldItem {
|
|
111
|
-
tmp_url: string; // URL of the image to compress
|
|
112
|
-
name?: string; // File name
|
|
113
|
-
type?: string; // MIME type (e.g., 'image/jpeg')
|
|
114
|
-
}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
## Examples
|
|
118
|
-
|
|
119
|
-
### Single Image Compression
|
|
120
|
-
|
|
121
|
-
```typescript
|
|
122
|
-
const client = new UnityClawClient();
|
|
123
|
-
|
|
124
|
-
const result = await client.image.compress({
|
|
125
|
-
attachment: [
|
|
126
|
-
{ tmp_url: 'https://example.com/photo.jpg', name: 'photo.jpg', type: 'image/jpeg' }
|
|
127
|
-
],
|
|
128
|
-
quality: 75
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
if (result.success && result.response?.data) {
|
|
132
|
-
const compressedImage = result.response.data[0];
|
|
133
|
-
console.log('Compressed URL:', compressedImage.content);
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### Batch Compression
|
|
138
|
-
|
|
139
|
-
```typescript
|
|
140
|
-
const images = [
|
|
141
|
-
{ tmp_url: 'https://example.com/img1.jpg', name: 'img1.jpg' },
|
|
142
|
-
{ tmp_url: 'https://example.com/img2.png', name: 'img2.png' },
|
|
143
|
-
{ tmp_url: 'https://example.com/img3.webp', name: 'img3.webp' }
|
|
144
|
-
];
|
|
145
|
-
|
|
146
|
-
const result = await client.image.compress({
|
|
147
|
-
attachment: images,
|
|
148
|
-
quality: 80
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
if (result.success && result.response?.data) {
|
|
152
|
-
result.response.data.forEach((img, i) => {
|
|
153
|
-
console.log(`Image ${i + 1}: ${img.content}`);
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
### High Quality Compression
|
|
159
|
-
|
|
160
|
-
```typescript
|
|
161
|
-
// Preserve more detail (larger file size)
|
|
162
|
-
const result = await client.image.compress({
|
|
163
|
-
attachment: [{ tmp_url: 'https://...', name: 'photo.jpg' }],
|
|
164
|
-
quality: 90
|
|
165
|
-
});
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### Aggressive Compression
|
|
169
|
-
|
|
170
|
-
```typescript
|
|
171
|
-
// Smaller file size (more quality loss)
|
|
172
|
-
const result = await client.image.compress({
|
|
173
|
-
attachment: [{ tmp_url: 'https://...', name: 'photo.jpg' }],
|
|
174
|
-
quality: 50
|
|
175
|
-
});
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### With Generated Images
|
|
179
|
-
|
|
180
|
-
```typescript
|
|
181
|
-
// Generate then compress
|
|
182
|
-
const generated = await client.image.jimeng({
|
|
183
|
-
prompt: 'A beautiful landscape',
|
|
184
|
-
size: '2048x2048'
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
if (generated.success && generated.response?.data) {
|
|
188
|
-
const compressed = await client.image.compress({
|
|
189
|
-
attachment: generated.response.data.map(img => ({
|
|
190
|
-
tmp_url: img.content,
|
|
191
|
-
name: img.name
|
|
192
|
-
})),
|
|
193
|
-
quality: 75
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
console.log('Compressed generated images:', compressed.response?.data);
|
|
197
|
-
}
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
## Response Format
|
|
201
|
-
|
|
202
|
-
```typescript
|
|
203
|
-
interface AttachmentResult {
|
|
204
|
-
name: string;
|
|
205
|
-
contentType: string;
|
|
206
|
-
content: string; // URL to compressed image
|
|
207
|
-
}
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
## Error Handling
|
|
211
|
-
|
|
212
|
-
```typescript
|
|
213
|
-
const result = await client.image.compress({
|
|
214
|
-
attachment: [{ tmp_url: 'invalid-url', name: 'test.jpg' }],
|
|
215
|
-
quality: 80
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
if (!result.success) {
|
|
219
|
-
console.error('Request failed');
|
|
220
|
-
console.log('Check logs:', result.logs);
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
if (result.response?.code !== 0) {
|
|
225
|
-
console.error('API error:', result.response);
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// Success
|
|
230
|
-
console.log('Success:', result.response.data);
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
## Quality Guidelines
|
|
234
|
-
|
|
235
|
-
| Quality | Use Case | File Size Reduction |
|
|
236
|
-
|---------|----------|---------------------|
|
|
237
|
-
| 90-100 | Print, professional photography | Minimal |
|
|
238
|
-
| 75-89 | Web display, social media | Moderate |
|
|
239
|
-
| 50-74 | Thumbnails, previews | Significant |
|
|
240
|
-
| 0-49 | Aggressive optimization | Maximum |
|
|
241
|
-
|
|
242
|
-
## Supported Formats
|
|
243
|
-
|
|
244
|
-
- JPEG/JPG
|
|
245
|
-
- PNG
|
|
246
|
-
- WebP
|
|
247
|
-
- GIF (static)
|
|
248
|
-
|
|
249
|
-
## Task Folders
|
|
250
|
-
|
|
251
|
-
Each execution creates a task folder with logs and downloaded attachments:
|
|
252
|
-
|
|
253
|
-
```typescript
|
|
254
|
-
const result = await client.image.compress({
|
|
255
|
-
attachment: [{ tmp_url: 'https://...', name: 'image.jpg' }],
|
|
256
|
-
quality: 80
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
console.log('Task ID:', result.taskId);
|
|
260
|
-
console.log('Task Folder:', result.taskFolder);
|
|
261
|
-
console.log('Local Attachments:', result.attachments);
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
## Related Skills
|
|
265
|
-
|
|
266
|
-
- [unityclaw-image-generation](../unityclaw-image-generation/SKILL.md) - Generate images before compression
|
|
267
|
-
|
|
268
|
-
<!-- SDK_VERSION_RULE_START -->
|
|
269
|
-
## SDK Version Check Rule
|
|
270
|
-
|
|
271
|
-
- Before invoking this skill, check local `@unityclaw/sdk` version.
|
|
272
|
-
- Required minimum SDK version: `1.1.2`
|
|
273
|
-
- If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
|
|
274
|
-
- Suggested command: `npm i @unityclaw/sdk@latest`
|
|
275
|
-
<!-- SDK_VERSION_RULE_END -->
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: unityclaw-video-frame-extract
|
|
3
|
-
description: Extract first/last/specified-time frame from video attachments
|
|
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 Video Frame Extract
|
|
23
|
-
|
|
24
|
-
Extract one frame from video at first frame, last frame, or specific `mm:ss`.
|
|
25
|
-
|
|
26
|
-
```typescript
|
|
27
|
-
import { UnityClawClient } from '@unityclaw/sdk';
|
|
28
|
-
|
|
29
|
-
const client = new UnityClawClient();
|
|
30
|
-
const result = await client.media.extractFrame({
|
|
31
|
-
attachment: [{ path: './files/demo.mp4' }],
|
|
32
|
-
frame_option: 'first',
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
if (result.success && result.response?.data?.[0]) {
|
|
36
|
-
console.log(result.response.data[0].content);
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
- API: `/api/video/frame`
|
|
41
|
-
- field-feishu: `video/frame`
|
|
42
|
-
|
|
43
|
-
<!-- SDK_VERSION_RULE_START -->
|
|
44
|
-
## SDK Version Check Rule
|
|
45
|
-
|
|
46
|
-
- Before invoking this skill, check local `@unityclaw/sdk` version.
|
|
47
|
-
- Required minimum SDK version: `1.1.2`
|
|
48
|
-
- If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
|
|
49
|
-
- Suggested command: `npm i @unityclaw/sdk@latest`
|
|
50
|
-
<!-- SDK_VERSION_RULE_END -->
|