Skip to content
dsh.fish
Bundle

dsh-emu-workbench

Emu 影像工作台 for DeepSeek Harness — 多供应商生图/改图/模型可用性探测 + Emu 独家 opencode 许愿 Agent

Source
tinchak0207
License
MIT
Updated
Updated 5 days ago

Readme

# Emu Workbench(Emu 影像工作台)

> Emu 平台的 DSH 插件:免费提示词优化 + 生图/改图/批量大级联 + 模型可用性探测 + 许愿 Agent + GitHub 一键授权。
> 密钥在 eimu.dev「API 密钥」页(`/settings/api-keys`,每人上限 3 把)自助签发,无需人工开通。

## 安装

在 DSH 设置 > 插件市场(Plugin Market / 商店)搜索「Emu Workbench」一键安装;
或使用 npm 包 `dsh-emu-workbench`,通过 DSH 官方推荐的插件安装流程添加。
装完重启 `dsh web`,在设置 > 插件 > Emu Workbench 里填写凭据即可使用。

DSH 生态的影像生产层:多供应商生图/改图/批量大级联 + 模型可用性探测 + Emu 独家
opencode 许愿 Agent,确认卡交互与会话续聊。注册后提供八个工具:

- `emu_optimize_prompt` —— 免费提示词优化(免登录、免 API 密钥、无需授权)
- `emu_model_status` —— 探测各图像模型可用性
- `emu_generate_image` —— 文生图(gpt-image-2 等多供应商)
- `emu_edit_image` —— 参考图改图(图生图)
- `emu_wish` —— 许愿 Agent:自主拆解复杂影像任务直到出图,返回 session_id 可续聊
- `emu_wish_reply` —— 回答许愿 Agent 的问题,继续消费事件流
- `emu_auth_login` —— GitHub 一键授权:自动签发密钥并写入 DSH 凭据
- `emu_auth_status` —— 查询授权状态(凭据是否已配置)

## 安装后你会看到什么(30 秒上手)

装好并重启后,DSH 会多出三处:

1. **打开任意会话,顶部 tab 行多一个「Emu」标签**(在 chat 旁边)——点开是完整的 Emu 界面(画布/图库/Agent),不用离开 DSH
2. **设置 > 插件 > Emu Workbench**——配置卡:baseUrl/默认模型/尺寸 + 凭据状态(是否已配 EMU_API_KEY)
3. **对话里**:让 Agent 生图(如「帮我画一张…」),结果以图卡形式直接出现在对话流,可复制/下载/**在 Emu 画布中打开**继续编辑

快速上手:
1. **免费优化提示词**:直接用 emu_optimize_prompt——免登录、免 API 密钥、无需授权,输入粗糙/简短的 prompt 即返回改良后的结构化 prompt
2. **生图**:装好后在对话里让 Agent 生图;凭据缺失时它会引导运行 emu_auth_login(GitHub 一键授权:自动签发密钥并写入 DSH 凭据,无需复制任何密钥)
3. 对话里说「帮我画一张……」——Agent 会自动调用 emu_generate_image

想批量/复杂愿望?说「用许愿 Agent 帮我做一组 4 张夏日饮品海报」——emu_wish 会把任务交给 Emu 的 opencode Agent 自主拆解迭代。
## 获取密钥

在 eimu.dev 注册登录后,进入「API 密钥」页(`https://www.eimu.dev/settings/api-keys`,导航栏用户菜单 → API 密钥)自助签发 `sk-biz-...` 密钥(每人上限 3 把,可随时吊销)。B 端 OpenAI 兼容端点 `https://image.tinchak0207.xyz/v1/*`。明文只在签发时显示一次,妥善保管。

更简单:在 DSH 里运行 emu_auth_login 一键授权(GitHub 登录自动签发密钥并写入凭据,无需复制/粘贴)。

## 配置方式(两步)

1. **凭据**:在 DSH 凭据里写入环境变量引用 `EMU_API_KEY`,值填 `sk-biz-...`。
   默认读取 `EMU_API_KEY`;可用插件设置 `apiKeyEnv` 换成其他变量名。
2. **插件设置**(可选,均有默认值):

| 设置项 | 默认值 | 说明 |
| --- | --- | --- |
| baseUrl | `https://image.tinchak0207.xyz` | 平台基址 |
| apiKeyEnv | `EMU_API_KEY` | 读取密钥的环境变量名 |
| defaultModel | `gpt-image-2` | 默认模型 id |
| defaultSize | `1024x1024` | 默认尺寸 |
| wishTimeoutMs | `240000` | 许愿单轮最大时长(毫秒) |
| wishIdleMs | `60000` | 许愿事件流空闲判定(毫秒) |

## 工具与调用示例

### emu_model_status

查询当前可用/不可用的图像生成模型,返回 `available` / `unavailable` / `raw`。

| 参数 | 必填 | 说明 |
| --- | --- | --- |
| (无) | | |

### emu_generate_image

| 参数 | 必填 | 说明 |
| --- | --- | --- |
| prompt | 是 | 完整画面描述(主体/构图/风格/光线) |
| model | 否 | 模型 id,默认 gpt-image-2 |
| size | 否 | 尺寸如 1024x1024 |
| n | 否 | 张数 1-4 |

示例:`emu_generate_image(prompt="一只戴草帽的橘猫坐在海边看日落,电影感布光", size="1024x1024")`
成功后图片已附加到对话。

> 平台生图是异步任务:提交后 20~60 秒内完成(模型排队),插件自动轮询直到出图,无需手动等待。

### emu_edit_image

| 参数 | 必填 | 说明 |
| --- | --- | --- |
| imageUrl | 是 | 参考图公网 URL(必须可访问,平台会下载原图) |
| prompt | 是 | 改图要求 |
| model | 否 | 模型 id,默认 gpt-image-2 |
| size | 否 | 尺寸如 1024x1024 |

### emu_wish

| 参数 | 必填 | 说明 |
| --- | --- | --- |
| wish | 是 | 完整愿望描述 |
| model | 否 | 首选模型 id |
| size | 否 | 尺寸如 1024x1024 |

返回 `session_id` / `status` / `image_urls` / `pending_question` / `text_summary`。
`status` 为 `completed` | `timeout` | `aborted` | `pending_question`。

### emu_wish_reply

| 参数 | 必填 | 说明 |
| --- | --- | --- |
| session_id | 是 | 许愿会话 id(emu_wish 返回) |
| reply | 是 | 对 Agent 问题的回答 |

### emu_optimize_prompt

| 参数 | 必填 | 说明 |
| --- | --- | --- |
| prompt | 是 | 粗糙的原始 prompt |

免费层:免登录、免 API 密钥、无需授权。返回 `ok` / `prompt`(优化后的结构化 prompt)/ `usedAgent`(Agent 优化或规则层优化)。

### emu_auth_login

GitHub 一键授权:自动打开浏览器到站点授权页,完成授权后密钥自动写入 DSH 凭据(无需复制)。返回 `configured` / `message`。

### emu_auth_status

查询授权状态,返回 `configured` / `source` / `message`。生图前可用它确认凭据已配置。

## 常见错误

| 现象 | 含义 | 处理 |
| --- | --- | --- |
| HTTP 401 | 密钥无效或未配置 | 检查 EMU_API_KEY 凭据;未配置时工具会给出明确提示 |
| HTTP 502 / 500 | 上游瞬时不可用 | 稍后重试,或换 model-status 里 available 的模型 |
| timeout | 许愿超时 | 调大 `wishTimeoutMs` 后重试;也可用 emu_wish_reply 续聊 |

## License

MIT

Install

dsh plugin --profile web add github:tinchak0207/dsh-emu-workbench

Profile: web

  • This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source