Context-aware file transfer skill for OpenClaw ecosystem. Intelligently transfers files based on conversation context with progress tracking.
本技能来自小葱技能站7w4.net。
npm install file-transfer
import { FileTransferSkill } from 'file-transfer';
const skill = new FileTransferSkill({
channels: { telegram: { enabled: true } }
});
const result = await skill.sendFileWithContext({
file: '/path/to/document.pdf',
caption: 'Team weekly report',
context: { chatId: '-1003655501651' }
});
import { TelegramAdapter } from 'file-transfer/src/adapters/telegram-adapter.js';
const adapter = new TelegramAdapter();
const result = await adapter.sendFile({
filePath: '/path/to/file.pdf',
chatId: '-1003655501651',
caption: 'Document sharing'
});
Transfers a file with intelligent context detection.
Parameters:
- file (string, required): Path to the file
- caption (string, optional): File description
- context (object, optional): Conversation context with chatId
Returns:
- success (boolean): Transfer success status
- messageId (string): Message ID
- context (object): Context analysis result (scenario, urgency, confidence)
- stats (object): Transfer statistics (size, duration, channel)
Retrieves file transfer history.
Parameters:
- options (object, optional): Query options
Returns:
- history (array): Transfer history records
- stats (object): Transfer statistics
const skill = new FileTransferSkill({
contextEngine: {
enableAI: false,
maxHistoryLength: 10
},
file: {
maxFileSize: 100 * 1024 * 1024, // 100MB
allowedMimeTypes: ['application/pdf', 'image/jpeg', ...]
},
channels: {
telegram: {
enabled: true,
maxFileSize: 50 * 1024 * 1024 // 50MB
}
}
});
The ContextEngine analyzes file transfers and returns:
| Field | Values | Description |
|---|---|---|
| scenario | share, backup, collaborate, archive |
Transfer intent |
| urgency | low, medium, high, critical |
Priority level |
| confidence | 0.0 - 1.0 | Analysis confidence |
| fileCategory | document, image, video, archive, code |
File classification |
npm test # All tests
npm run test:unit # Unit tests
npm run test:integration # Integration tests
MIT License - see LICENSE for details.
这个文件传输工具整体质量良好,界面友好,适合需要传输文件的用户。优点是操作简单、文档详细、支持多种文件类型。不足之处在于目前仅支持 Telegram 平台(且为模拟传输),不支持 WhatsApp 等其他常用聊天软件,且传输记录不会保存。如果需要真实可用的文件传输功能,建议等待后续版本更新真实 API 支持后再使用。