mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-06-06 08:10:48 +08:00
feat(skills): 新增 dashscope-image-gen 和 xiaomi-tts 全局内置技能
- dashscope-image-gen: 阿里云通义万相文生图技能(wan2.7-image 系列) - xiaomi-tts: 小米 MiMo 语音合成技能(mimo-v2.5-tts 系列) - 更新 builtin-skills.json 清单
This commit is contained in:
204
skills/dashscope-image-gen/SKILL.md
Normal file
204
skills/dashscope-image-gen/SKILL.md
Normal file
@@ -0,0 +1,204 @@
|
||||
---
|
||||
name: 阿里云 文生图
|
||||
description: >-
|
||||
Use this skill when the user wants to generate images using Alibaba Cloud
|
||||
DashScope's Wan (通义万相) series models. Supports text-to-image with multiple
|
||||
model tiers (wan2.7-image-pro, wan2.7-image). Uses OpenAI-compatible
|
||||
chat/completions API for synchronous image generation.
|
||||
Use when 用户提到 生成图片、画图、文生图、创建图片、AI 绘画、
|
||||
生成插图、画一张、帮我画、设计图片、通义万相、万相、阿里云画图、dashscope 画图。
|
||||
license: Complete terms in LICENSE.txt
|
||||
version: 1.1.0
|
||||
type: procedural
|
||||
risk_level: low
|
||||
status: enabled
|
||||
disable-model-invocation: false
|
||||
provider: dashscope
|
||||
tags:
|
||||
- media
|
||||
- image
|
||||
- generation
|
||||
- dashscope
|
||||
- alibaba
|
||||
requires:
|
||||
tools:
|
||||
- Bash
|
||||
metadata:
|
||||
author: desirecore
|
||||
updated_at: '2026-05-08'
|
||||
market:
|
||||
icon: >-
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0
|
||||
24 24" fill="none"><rect x="3" y="3" width="18" height="18" rx="3"
|
||||
stroke="#34C759" stroke-width="1.5" fill="#34C759"
|
||||
fill-opacity="0.1"/><path d="M7 14l3-4 2.5 3 3.5-5 4 6H7z" fill="#34C759"
|
||||
fill-opacity="0.4" stroke="#34C759" stroke-width="1.2"
|
||||
stroke-linejoin="round"/><circle cx="15.5" cy="8.5" r="1.5" fill="#34C759"
|
||||
fill-opacity="0.6"/></svg>
|
||||
short_desc: 基于阿里云通义万相的文本生成图片技能
|
||||
category: media
|
||||
maintainer:
|
||||
name: DesireCore Official
|
||||
verified: true
|
||||
channel: latest
|
||||
---
|
||||
|
||||
# dashscope-image-gen 技能
|
||||
|
||||
## 强制规则(违反将导致功能失败)
|
||||
|
||||
1. **必须用 HTTPS 访问 agent-service** — `https://127.0.0.1:${PORT}` 加 `-k` 跳过证书验证
|
||||
2. **必须通过 `/api/media/upload` 上传到 media-store** — 禁止保存到本地路径
|
||||
3. **必须使用 `dc-media://` 协议展示图片** — 唯一能让前端正确渲染的方式
|
||||
4. **全程使用 Bash curl** — 不要使用 HttpRequest 工具或 Python
|
||||
5. **使用 compatible-mode(/chat/completions)** — 同步调用,响应直接包含图片 URL
|
||||
|
||||
## 模型选择指南
|
||||
|
||||
| 模型 | 特点 | 适用场景 |
|
||||
|------|------|---------|
|
||||
| wan2.7-image-pro | 旗舰,4K 分辨率,thinking_mode | 用户要求最高画质、4K、细节丰富 |
|
||||
| wan2.7-image | 标准高画质,thinking_mode | **默认首选**,无特殊要求时使用 |
|
||||
|
||||
**默认规则**:用户未指定模型时,使用 `wan2.7-image`。
|
||||
|
||||
## 完整执行流程(严格按此两步执行)
|
||||
|
||||
### 前置条件
|
||||
|
||||
- 用户已在资源管理器-算力中配置阿里云 DashScope Provider 并填写 API Key
|
||||
- agent-service 正在运行
|
||||
|
||||
### 第一步:调用文生图 API(同步)
|
||||
|
||||
通过 media-proxy 的 compatible-mode 端点生成图片,响应直接包含图片 URL:
|
||||
|
||||
```bash
|
||||
PORT=$(cat ~/.desirecore/agent-service.port)
|
||||
curl -sk -X POST "https://127.0.0.1:${PORT}/api/media-proxy" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"provider": "dashscope",
|
||||
"serviceType": "image_gen",
|
||||
"endpoint": "/chat/completions",
|
||||
"body": {
|
||||
"model": "wan2.7-image",
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "text", "text": "这里替换为图片描述(建议英文效果更好)"}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"responseType": "json"
|
||||
}'
|
||||
```
|
||||
|
||||
**响应示例**:
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"request_id": "...",
|
||||
"output": {
|
||||
"choices": [
|
||||
{
|
||||
"message": {
|
||||
"role": "assistant",
|
||||
"content": [
|
||||
{
|
||||
"type": "image",
|
||||
"image": "https://dashscope-result.oss.aliyuncs.com/..."
|
||||
}
|
||||
]
|
||||
},
|
||||
"finish_reason": "stop"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"statusCode": 200
|
||||
}
|
||||
```
|
||||
|
||||
从 `data.output.choices[0].message.content` 中找到 `type: "image"` 的项,提取其 `image` URL。
|
||||
|
||||
### 第二步:下载并上传到 media-store
|
||||
|
||||
图片 URL 有时效,必须立即下载并保存到本地 media-store:
|
||||
|
||||
```bash
|
||||
PORT=$(cat ~/.desirecore/agent-service.port)
|
||||
IMAGE_URL="第一步响应中的 image URL"
|
||||
curl -sL "$IMAGE_URL" -o /tmp/dashscope-gen.png && \
|
||||
curl -sk -X POST "https://127.0.0.1:${PORT}/api/media/upload" \
|
||||
-F "file=@/tmp/dashscope-gen.png;type=image/png"
|
||||
```
|
||||
|
||||
从 JSON 响应中提取 `mediaId` 字段(格式如 `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.png`)。
|
||||
|
||||
### 第三步:用 dc-media 协议展示图片
|
||||
|
||||
在你的回复文本中直接写 Markdown 图片语法:
|
||||
|
||||
```
|
||||

|
||||
```
|
||||
|
||||
例如:``
|
||||
|
||||
前端会自动将 `dc-media://` 转为可访问的图片 URL 并渲染出来。
|
||||
|
||||
## 参数映射
|
||||
|
||||
### 尺寸选择
|
||||
|
||||
通义万相通过 compatible-mode 调用时,尺寸通过 `size` 参数传入(放在请求体顶层):
|
||||
|
||||
```json
|
||||
{
|
||||
"model": "wan2.7-image",
|
||||
"size": "1024x1024",
|
||||
"messages": [...]
|
||||
}
|
||||
```
|
||||
|
||||
| 用户意图 | size 参数 |
|
||||
|---------|-----------|
|
||||
| 正方形/头像/默认 | "1024x1024" |
|
||||
| 横版/风景/壁纸 | "1792x1024" |
|
||||
| 竖版/手机/海报 | "1024x1792" |
|
||||
|
||||
### 可选参数(加入请求体顶层)
|
||||
|
||||
| 参数 | 说明 |
|
||||
|------|------|
|
||||
| `n` | 生成数量 1-4,默认 1 |
|
||||
| `size` | 图片尺寸,如 "1024x1024" |
|
||||
|
||||
## 多图生成
|
||||
|
||||
当 `n > 1` 时,`choices` 数组会有多个元素,每个 `message.content` 中都有一张图片。需要为每张图片执行下载+上传,然后逐一展示:
|
||||
|
||||
```
|
||||

|
||||

|
||||
```
|
||||
|
||||
## 错误处理
|
||||
|
||||
- `success: false` + `error: "未找到匹配的供应商"`:未配置 DashScope Provider 或未启用
|
||||
- `success: false` + `error: "未配置 API Key"`:未填写 API Key
|
||||
- `statusCode: 401`:API Key 无效或已过期
|
||||
- `statusCode: 429`:频率限制,稍后重试
|
||||
- `statusCode: 400` + `InvalidParameter`:参数错误(如尺寸不支持)
|
||||
- `statusCode: 403` + `AccessDenied.Unpurchased`:模型未开通,需要在阿里云控制台开通
|
||||
|
||||
## 注意事项
|
||||
|
||||
- 通过 compatible-mode 调用是同步的,通常 10-60 秒返回(wan2.7-image-pro 可能更长)
|
||||
- 结果图片 URL 有时效,必须及时下载
|
||||
- 提示词建议用英文以获得最佳效果,中文也支持
|
||||
- 如果用户未明确要求模型/尺寸,默认使用 `wan2.7-image` + `1024x1024`
|
||||
Reference in New Issue
Block a user