All script paths are relative to this Skill directory.
Prerequisites: Requires being logged in, having selected a scan book, and having started a batch (refer to the deepscan-login, deepscan-task, and deepscan-session Skills).
Pre-check
Before executing, first confirm the batch exists:
python ../deepscan-session/scripts/session.py current
- Exit code is 1 → First execute the deepscan-task Skill to select a scan book and start a batch, then continue.
- Success → Continue adding.
Scenario 1: The user sends text
python scripts/record.py add-text "{用户文本内容}"
Example successful return:
{
"record_id": "019caedb-69bd-...",
"scan_result": "用户输入的文本",
"scan_type": "text",
"seq_number": "R1",
"task_title": "默认扫码本"
}
Inform the user: The content "{scan_result}" has been added to the scan book "{task_title}" ({seq_number}).
Scenario 2: The user uploads an image
Use the Read tool to get the image's local path, then execute:
python scripts/record.py add-image "{图片本地路径}"
The script automatically completes:
- Use
zxing-cppto decode the QR code/barcode in the image - Upload the image to OSS to obtain a URL
- Add a scan record (scanned content + image URL)
Example successful return:
{
"record_id": "019caedb-69bd-...",
"scan_result": "https://cli.im",
"scan_type": "qrcode",
"image_url": "https://...",
"seq_number": "R1",
"task_title": "默认扫码本"
}
Inform the user: Scan record {seq_number} has been added, with content "{scan_result}".
Error Handling
- No QR code in the image: Inform the user that no QR code was recognized in the image, and they can manually enter the content and add it using the text method instead.
- No scan book selected / No batch: Guide the user to execute the deepscan-task Skill.
- Missing dependencies: Prompt the user to execute
pip install zxing-cpp Pillow。
Dependency Installation
pip install zxing-cpp Pillow