--- name: img-query description: "Use this skill whenever you (the current model) lack vision/image-understanding capability and need to know the content of an image, screenshot, photo, diagram, chart, scan, or UI mockup. Triggers include: the user attaches or references an image file (.png/.jpg/.jpeg/.webp/.bmp) and asks about its content, asks you to read text in an image (OCR), describe what an image shows, extract data from a chart or screenshot, transcribe a scanned document, or answer questions about a picture, diagram, flow chart, or UI screenshot. If the image is inside a PDF/DOCX/PPTX, first extract the image with the pdf/docx/pptx/markitdown skill, then use this skill. Do NOT use for generating images (use minimax-image), audio (minimax-speech/music), or video (minimax-video)." --- # Image Query (识图) 当当前模型没有识图(视觉理解)能力时,通过调用具备视觉能力的远端 LLM API 来查询图像内容。 ## 何时使用 - 用户提供了图片(截图、照片、图表、流程图、扫描件、UI 图)并询问其内容。 - 需要读取图片中的文字(OCR)。 - 需要描述图片内容、从图表/表格图片中提取数据、理解流程或架构图。 - 需要就某张图片回答具体问题。 ## 前提 - Python 3 环境,已安装依赖:`requests`、`Pillow`。 - 可访问 API(`https://api.1808366.xyz`)。 只有当当前模型自身缺乏识图能力时才使用本技能。若模型本身具备视觉能力,应直接读取图像,不要调用本技能。 ## 用法 ```bash python scripts/img_query.py <图片路径> <问题> [输出文件] ``` - `<图片路径>`:本地图片文件(png/jpg/jpeg/webp/bmp 等,内部自动转 JPEG,一次压缩:固定高质量 85,仅当最长边超过 1280px 时一次性缩到该尺寸以控制体积)。 - `<问题>`:针对图片提出的问题(建议用引号包裹)。 - `[输出文件]`:可选;提供后结果写入该文件,否则输出到标准输出。 ### 示例 ```bash python scripts/img_query.py screenshot.png "这张截图里显示了什么信息?" python scripts/img_query.py chart.jpg "请读取并列出图表中的所有数据点" result.txt ``` ## 工作流 1. 确认用户给出或引用了图片路径;若图片在 PDF/DOCX/PPTX 内,先用 `pdf`/`docx`/`pptx`/`markitdown` 技能提取出图片文件。 2. 运行脚本,传入图片路径与用户的问题(或根据任务构造清晰的问题,例如要求 OCR、描述、提取数据等)。 3. 把脚本返回的结果直接作为对用户问题的回答;若脚本失败,向用户说明并请其检查图片路径与网络。 ## 依赖 ```bash pip install requests Pillow ```