SuperAPI AI Directory

kaipai-image-repair

Design & creation

View repository

Updated 10-16 00:23

About this skill

Image Quality Restoration

Capabilities and Preparation

Use image-repair to intelligently restore blurry and low-resolution images, enhance image clarity and detail, and output the restored image. Process directly when the material and quality improvement goal are clear.

Call the server-side processing capability through the parameters supported by the current CLI; for specific parameters, query help or contracts. Depends on meitu-kaipai-cli, verified target version 0.1.8, compatible with >=0.1.8 <0.2.0。

On first execution, readPlatform Access, parse the CLI entry point and check the version and tool image-repair --help. When JSON fields or media restrictions are unclear, query the entry for the current tool in kaipai contracts according to the platform instructions; when encountering output parsing, server-side inquiries, or execution exceptions, readRunning and Recovery。

Collect Input

  1. Obtain one real image file or URL from the current request and attachments; do not ask repeatedly when the information is clear. When there are multiple candidates and the target is unclear, ask; do not automatically choose on the user's behalf; when the user has explicitly authorized processing them one by one, call separately and record the tasks.
  2. For local materials, use a real readable path; for remote materials, first followPlatform Accessto download the original resource, then upload it as a local file. When there is only a media ID, first query the Task or history of the session it belongs to to obtain the real URL, then download; if that fails, ask the user to download it themselves and provide the local original file.
  3. When continuing an existing task, add -r '<session_id>'; for a new task, omit the session. Apply defaults, prepare login, and handle missing input according to the platform instructions; query the current help for optional parameters, and omit them when unspecified.
  4. Preserve the original source, real local path, and session as recovery inputs. After the user supplements with the downloaded file, continue with the original goal; do not treat failed results as source material.

Upload and Submit

Using the parsed CLI entry point, pass the prepared local file as an independent parameter:

kaipai tool image-repair --image-file '<本地图片路径>'

After the CLI validates the file, obtain a proprietary CDN URL through the built-in Meitu upload pipeline, then submit the task and by default wait for this execution to finish. Do not first call create-room / add-media, and do not construct media placeholder text. Parameter files and independent prechecks are used only as needed; see the platform instructions for safe parameter passing and cleanup rules.

Follow-up and Delivery

  • Save the original input,session_id / room_url and all real Task IDs; continuously read the stdout and stderr of the original command separately, and do not open another polling process at the same time.
  • TASK_STATE_COMPLETED and only deliver the processing result after obtaining the usable artifact URL for this run. HTTP 200, stream end, exit code 0, or end.reason=result do not individually prove completion, and an unknown task status cannot be regarded as success.
  • Use a native preview/attachment available to the host or a complete clickable URL, preserve query parameters, and deliver all available Parts one by one; for partial success, deliver the successful parts first. When there is an actual room_url , attach the session entry for starting it; do not construct a link from the ID.
  • When disconnected, timed out, or acceptance is unknown, first query the original session and task; do not automatically resubmit. Only initiate a new attempt after the failure cause has been fixed and the user has authorized a retry; if downloading the output artifact fails, only resume the download. For specific inquiry, recovery, and local save steps, see the running instructions.