🧭 Must-Read Before Use (30 Seconds)
[!WARNING]
⚠️ Important Privacy & Data Flow Notice
- - Service Interaction Required: This skill will send the file you provide to the official Kingsoft Office server (aiwrite.wps.cn) for recognition.
- Data Visibility: Kingsoft Office services will access and process the content of your file.
- This skill supports local file uploads, and will only verify the file type without performing any verification on the path.
✅ Recommended Method: Environment Variables (Permission-Free, Instant Effect, Webchat-Friendly)
CODEBLOCK0
CODEBLOCK1
[!TIP] 🔧 How to obtain the key?
- - Get your API key: https://aiwrite.wps.cn/pdf/parse/accesskey/
✅ Environment Dependency Check
Make sure the required libraries are installed:
CODEBLOCK2
🎯 Skill Execution Guide
1. Applicable Scenarios
Invoke this skill when the user’s intent includes any of the following:
- - Sends a file and asks “What text is this?”, “Extract text”, or “Convert to text”.
- Uploads document screenshots, invoices, business cards, photos, or scanned files with mixed Chinese and English text to be recognized.
- Needs to translate or edit the file content (text extraction is a required first step).
2. Execution Actions
Once it is confirmed that text extraction is required, perform the following operations immediately:
Input Processing:
Obtain the file resource provided by the user (using a download link: url or a local file: path).
Command Execution:
Call the Python script for recognition. If the current environment supports command-line execution, construct the command as follows:
CODEBLOCK3
Execution Flow
1. File Acquisition
The file will be sent to Kingsoft Office Cloud Service, which will download the file provided by the user.
2. File Validation
Verify that the file is in a supported format.
3. Recognize File Content
Identify elements such as text, images, tables, formulas, and other content in the file, and extract the text.
⚠️ Note: Image elements will be returned as placeholders; file elements will not be returned.
4. Return Results to the User
On success: Return all recognized text (concatenated into one string) and detailed detection information.
On failure: Return error messages (e.g., "No text detected in the file", "API call failed", etc.).
OCR API Usage Notes
This skill relies on the WPS-OCR parsing and recognition capabilities hosted on Kingsoft Cloud Service. The current version is a free trial. To ensure stable operation, the cloud service enforces rate limiting. The service will reject requests under high concurrency; please use it appropriately.
To experience the full features, visit the
demo platform.
🧭 使用前必读(30秒)
[!WARNING]
⚠️ 重要隐私与数据流说明
- - 需要服务交互:此技能会将您提供的文件发送至金山办公官方服务器(aiwrite.wps.cn)进行识别。
- 数据可见性:金山办公服务将访问并处理您文件中的内容。
- 此技能支持本地文件上传,仅验证文件类型,不对路径进行任何校验。
✅ 推荐方法:环境变量(无需权限、即时生效、对WebChat友好)
bash
在终端中运行(当前会话立即生效):
export WPS
OCRACCESS
KEY=yourclient
accesskey
bash
将凭证追加到 ~/.openclaw/env 文件中
echo export WPS
OCRACCESS
KEY=yourclient
accesskey >> ~/.openclaw/env
[!TIP] 🔧 如何获取密钥?
- - 获取您的API密钥:https://aiwrite.wps.cn/pdf/parse/accesskey/
✅ 环境依赖检查
确保已安装所需库:
bash
pip install requests
🎯 技能执行指南
1. 适用场景
当用户意图包含以下任一情况时,调用此技能:
- - 发送文件并询问“这是什么文字?”、“提取文字”或“转换为文本”。
- 上传包含中英文混合的文档截图、发票、名片、照片或扫描文件需要识别。
- 需要翻译或编辑文件内容(文本提取是必要的第一步)。
2. 执行操作
确认需要提取文本后,立即执行以下操作:
输入处理:
获取用户提供的文件资源(使用下载链接:url 或本地文件:path)。
命令执行:
调用Python脚本进行识别。如果当前环境支持命令行执行,按如下方式构建命令:
bash
使用文件下载URL:
python3 skills/wps-ocr/scripts/wps_ocr.py --url
使用本地文件:
python3 skills/wps-ocr/scripts/wps_ocr.py --path
执行流程
1. 文件获取
文件将被发送至金山办公云服务,该服务将下载用户提供的文件。
2. 文件验证
验证文件是否为支持的格式。
3. 识别文件内容
识别文件中的文本、图片、表格、公式等元素,并提取文本。
⚠️ 注意:图片元素将以占位符形式返回;文件元素将不会返回。
4. 向用户返回结果
成功时:返回所有识别出的文本(拼接成一个字符串)及详细的检测信息。
失败时:返回错误信息(例如“文件中未检测到文本”、“API调用失败”等)。
OCR API使用说明
此技能依赖于托管在金山办公云服务上的WPS-OCR解析与识别能力。当前版本为免费试用。为确保稳定运行,云服务实施了速率限制。在高并发情况下,服务将拒绝请求,请合理使用。
如需体验完整功能,请访问演示平台。