mcpField
S
sn-image-resume

sn-image-resume

github.com/opensensenova设计与 UI6.0k149 次安装2 天前更新
代码仓库

关于 sn-image-resume

sn-image-resume 将简历文本转换为纵向设计图片,适用于制作作品集风格简历的人。它通过 sn-text-optimize 编写图像提示词,再由 sn-image-generate 生成图片,并支持指定风格和宽高比。

主要功能

  1. 01接收对话中的简历文本
  2. 02接受可选的视觉风格要求
  3. 03将文本整理为图像提示词
  4. 04生成设计型简历图片
  5. 05设置宽高比和图像尺寸

适用场景

  1. 01制作作品集风格的简历图片
  2. 02将简历文本转换为视觉页面
  3. 03应用指定配色或职业美学

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/opensensenova/sensenova-skills --skill sn-image-resume

安装后在 Claude Code 中输入/sn-image-resume确认已加载。

附带文件prompts/resume.md

详细介绍

sn-image-resume

简历图像生成场景技能(第 1 层),依赖 sn-image-base(第 0 层)提供的 sn-text-optimize 和 sn-image-generate 工具。

功能:

  • 直接接受对话文本中的简历内容
  • 支持用户可选提供风格方向
  • 应用 prompts/resume.md 中固定的作品集简历版式规则
  • 通过 sn-image-generate 生成竖版设计简历图像

非目标

  • 编辑或润色纯文本简历文档,但不生成图像
  • 将上传的简历文件解析为主要输入格式
  • 创建传统的单栏 ATS 简历
  • 当图像版式需要压缩内容时,保证每个长段落都能完整保留

输入规范

参数类型默认值描述
resume_content字符串必填用户在对话中提供的简历文本,包括姓名、个人简介、教育经历、工作经历、技能、项目、联系方式等。
style字符串可选用户指定的视觉风格、基调、配色、职业美学或参考氛围。也可以包含在 resume_content 中。
aspect_ratio字符串9:16输出宽高比。允许的值:2:3、3:2、3:4、4:3、4:5、5:4、1:1、16:9、9:16、21:9、9:21。默认值为 9:16(竖版),因为模板是纵向堆叠的作品集简历页面。
image_size字符串2k图像尺寸预设:1k 或 2k。
output_mode字符串friendly输出模式:friendly 或 verbose。

API 配置

此技能中的所有 API 调用均通过 sn-image-base 技能的 sn_agent_runner.py 执行,身份验证参数使用默认值(CLI > 环境变量 > 内置默认值),因此通常无需显式传入。

调用类型工具身份验证参数描述
大模型sn-text-optimize默认读取 SN_TEXT_API_KEY -> SN_CHAT_API_KEY -> SN_API_KEY使用 prompts/resume.md 作为系统提示词,将用户的简历文本转换为详细的图像生成提示词
图像生成sn-image-generate默认读取 SN_IMAGE_GEN_API_KEY -> SN_API_KEY生成最终简历图像

如果所有功能都使用同一个网关,只需配置:

SN_BASE_URL="https://your-api-endpoint.com/v1"
SN_API_KEY="your-api-key"

遇到 MissingApiKeyError 或需要指定模型时:通过 CLI 显式传入参数。参见 $SN_IMAGE_BASE/references/api_spec.md。

$SN_IMAGE_BASE 路径说明:$SN_IMAGE_BASE 是 sn-image-base 技能的安装目录(其中存在 SKILL.md)。Agent 可以通过技能名称 sn-image-base 查找此路径。

架构:主 Agent + Worker Agent

此技能采用两层 Agent 架构:

角色职责
主 Agent接收用户请求、规范化参数、发送预检信息、启动 Worker、收集结果,并向用户发送最终文本/图像
Worker Agent执行提示词生成和图像生成,然后返回结构化 JSON

职责边界:

  • Worker Agent 不会直接向用户发送任何消息,只返回结构化 JSON
  • 主 Agent 负责所有用户可见消息
  • Worker Agent 的最后一条消息必须且只能是返回约定中定义的 JSON 字符串
  • Worker Agent 的底层 API 调用通过 sn-image-base 直接执行,不会启动嵌套子 Agent

工作流

主 Agent 工作流
  1. 从用户请求中提取 resume_content、可选的 style、aspect_ratio(默认值为 9:16)、image_size(默认值为 2k)和 output_mode(默认值为 friendly)
  2. 验证 resume_content 非空,且包含足够的简历信息以生成有意义的页面
  3. 验证 aspect_ratio 是否为允许的值之一:2:3、3:2、3:4、4:3、4:5、5:4、1:1、16:9、9:16、21:9、9:21。如果用户提供的值不在此列表中,请告知用户,并回退到默认值 9:16
  4. 发送统一的预检消息:"Using sn-image-resume skill to generate a resume image, please wait..."
  5. 启动 Worker Agent,并传入完整参数和工作目录
  6. Worker Agent 返回后:
    • status=ok:发送简短摘要和生成的图片
    • status=error:向用户报告实际的 error 字段内容
Worker Agent 工作流

Worker Agent 接收 resume_content、style、aspect_ratio、image_size、output_mode 以及此技能的工作目录(SKILL_DIR)。

第 0 步 — 初始化
  1. 使用时间戳格式 YYYYMMDD_HHMMSS 生成 task_id
  2. 创建临时目录:/tmp/openclaw/sn-image-resume/<task_id>/,作为 TEMP_DIR
  3. 持久化规范化后的输入:
echo "$RESUME_CONTENT" > "$TEMP_DIR/resume-content.txt"
echo "$STYLE" > "$TEMP_DIR/style.txt"
第 1 步 — 简历提示词生成

使用 prompts/resume.md 作为系统提示词,并调用 sn-text-optimize 将用户的简历内容转换为详细的图像生成提示词。

USER_PROMPT=$(cat << EOF
Resume content:
$RESUME_CONTENT

Optional style instruction:
${STYLE:-No explicit style instruction. Infer an appropriate professional visual style from the resume content.}

Task:
Convert the resume content into a complete text-to-image prompt for a tall portfolio-resume image.
Follow the fixed layout, language, content mapping, typography, panel, and style translation rules in the system prompt.
Return only the final image generation prompt. Do not include explanations, markdown fences, or alternative options.
EOF
)

python "$SN_IMAGE_BASE/scripts/sn_agent_runner.py" sn-text-optimize \
  --system-prompt-path "$SKILL_DIR/prompts/resume.md" \
  --user-prompt "$USER_PROMPT" \
  --output-format json

解析 JSON 标准输出,并提取 result 作为 generation_prompt。如果进程以非零状态退出、返回无效 JSON,或 result 为空,则返回 status=error,并附上实际错误。

持久化输出:

echo "$GENERATION_PROMPT" > "$TEMP_DIR/generation-prompt.txt"
第 2 步 — 简历图片生成

使用 sn-image-base 的 sn-image-generate 工具生成最终图片。

python "$SN_IMAGE_BASE/scripts/sn_agent_runner.py" sn-image-generate \
  --prompt "$GENERATION_PROMPT" \
  --image-size "$IMAGE_SIZE" \
  --aspect-ratio "$ASPECT_RATIO" \
  --save-path "$TEMP_DIR/resume.png" \
  --output-format json

解析 JSON 标准输出。如果生成失败,则返回 status=error,并附上实际错误。生成的图片路径为 $TEMP_DIR/resume.png。

错误处理规则
  • 如果缺少必要的简历内容,请在开始生成前要求用户提供简历文本
  • 如果 sn-text-optimize 失败或返回空结果,请停止并报告实际错误
  • 如果 sn-image-generate 失败,请停止并报告实际错误
  • 如果用户内容不完整或提示词生成失败,不要悄悄替换为通用简历提示词
  • 不要编造用户未提供的简历事实;只能重新组织、精简和以视觉方式呈现已提供的信息
返回约定

Worker Agent 完成后,其最后一条消息必须且只能是以下 JSON 字符串(裸 JSON,不含代码围栏,也不含前置或后置文本)。

正常流程:

{
  "status": "ok",
  "need_main_agent_send": true,
  "output_mode": "friendly|verbose",
  "image": "$TEMP_DIR/resume.png",
  "generation_prompt": "<included only when output_mode=verbose>",
  "timing": {
    "total_elapsed_seconds": 25.12,
    "prompt_generation": { "elapsed_seconds": 5.23, "model": "sensenova-6.8-flash-lite" },
    "image_generation": { "elapsed_seconds": 19.89, "model": "sn_image_model" }
  }
}

错误流程:

{
  "status": "error",
  "error": "<Actual error information>"
}

规则:

  • status=ok 必须包含 need_main_agent_send: true
  • 当 output_mode=verbose 时,generation_prompt 必须包含该字段;在 friendly 模式下省略该字段
  • timing.prompt_generation.elapsed_seconds 和 timing.prompt_generation.model 从 sn-text-optimize 的 JSON 输出中读取
  • timing.image_generation.elapsed_seconds 从 sn-image-generate 的 JSON 输出中读取
  • timing.image_generation.model 固定为 "sn_image_model",因为 sn-image-generate 不会返回模型字段

输出格式

friendly 模式(默认)

**文本摘要:**用一句话说明简历图片已生成,不超过 50 个单词。

**图片:**发送生成的单张简历图片。

verbose 模式
Resume image generated
---
Aspect ratio: <aspect_ratio>
Image size: <image_size>
---
Generation prompt:
<generation_prompt>
---
Time statistics: Total <total>s | Prompt generation <t>s | Image generation <t>s
---
Image:
<image path>

调用关系

  • 底层依赖:sn-image-base → sn-text-optimize、sn-image-generate
  • 系统提示词:prompts/resume.md

参考资料

  • prompts/resume.md - 固定的作品集简历版式及语言/内容映射规则
  • ../sn-image-base/SKILL.md - 基础层图像/文本工具行为
  • ../sn-image-base/references/api_spec.md - CLI 参数详情

评论

支持 Markdown