image-generation

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Image Generation Skill

图像生成Skill

This skill allows agents to automatically generate high-quality images (defaulting to hand-drawn style) based on user intent.
这个Skill允许Agent根据用户需求自动生成高质量图像(默认为手绘风格)。

Core Features

核心特性

  • Smart Prompt Optimization: Transforms simple user intent into detailed hand-drawn style prompts.
  • Fast Generation: Uses non-streaming interfaces to significantly speed up image generation.
  • Auto-Save: Automatically downloads generated images locally and saves metadata and API responses simultaneously.
  • 智能提示词优化:将简单的用户需求转化为详细的手绘风格提示词。
  • 快速生成:采用非流式接口,大幅提升图像生成速度。
  • 自动保存:自动将生成的图像下载到本地,同时保存元数据和API响应。

Prerequisites

前置条件

Before using this skill, ensure that the
DASHSCOPE_API_KEY
environment variable is set:
bash
export DASHSCOPE_API_KEY="Your API Key"
使用该Skill前,请确保已设置
DASHSCOPE_API_KEY
环境变量:
bash
export DASHSCOPE_API_KEY="Your API Key"

User Guide

用户指南

1. Refine the Prompt

1. 优化提示词

You need to refine the user's original intent into a prompt suitable for image generation. For hand-drawn versions of architecture or flowcharts, it's recommended to include keywords like "hand-drawn", "sketch", "architectural drawing", etc.
你需要将用户的原始需求提炼为适合图像生成的提示词。对于架构图或流程图的手绘版本,建议包含“手绘”、“草图”、“建筑绘图”等关键词。

2. Run the Script

2. 运行脚本

Use the following command to call the generation script:
bash
node skills/image-generate/scripts/generate_image.js "Your detailed prompt"
使用以下命令调用生成脚本:
bash
node skills/image-generate/scripts/generate_image.js "你的详细提示词"

3. View Results

3. 查看结果

After the script completes, it will generate the following files in the current directory:
  • image_YYYY-MM-DDTHH-mm-ss.png
    : The generated image file.
  • metadata_YYYY-MM-DDTHH-mm-ss.json
    : Metadata including prompt, file size, and duration.
  • response_YYYY-MM-DDTHH-mm-ss.json
    : Raw API response data (for debugging).
脚本运行完成后,会在当前目录生成以下文件:
  • image_YYYY-MM-DDTHH-mm-ss.png
    :生成的图像文件。
  • metadata_YYYY-MM-DDTHH-mm-ss.json
    :包含提示词、文件大小和生成时长的元数据。
  • response_YYYY-MM-DDTHH-mm-ss.json
    :原始API响应数据(用于调试)。

Example

示例

User Intent: "Help me draw an architecture diagram of an AI coding assistant."
Recommended Prompt: "A detailed hand-drawn architectural diagram of an AI coding assistant, showing the interaction between the user, the IDE, and the LLM, technical sketch style, clean lines, white background."
Execution Command:
bash
node skills/image-generate/scripts/generate_image.js "A detailed hand-drawn architectural diagram of an AI coding assistant, showing the interaction between the user, the IDE, and the LLM, technical sketch style, clean lines, white background."
用户需求:“帮我绘制一个AI代码助手的架构图。”
推荐提示词:“AI代码助手的详细手绘架构图,展示用户、IDE与LLM之间的交互,技术草图风格,线条简洁,白色背景。”
执行命令
bash
node skills/image-generate/scripts/generate_image.js "AI代码助手的详细手绘架构图,展示用户、IDE与LLM之间的交互,技术草图风格,线条简洁,白色背景。"