dsh-image-gen 0.1.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +171 -167
- package/README.md +187 -170
- package/README.zh-CN.md +171 -170
- package/lib/client.js +6 -1
- package/lib/client.js.map +1 -1
- package/lib/index.js +648 -195
- package/lib/types/dashscope.d.ts +12 -3
- package/lib/types/google.d.ts +14 -3
- package/lib/types/index.d.ts +0 -3
- package/lib/types/openai-compatible.d.ts +15 -3
- package/lib/types/reference-image.d.ts +38 -0
- package/lib/types/seedream.d.ts +17 -0
- package/lib/types/shared.d.ts +1 -1
- package/package.json +37 -34
package/README.md
CHANGED
|
@@ -1,170 +1,187 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
<img src="docs/assets/hero-poster.webp" alt="dsh-image-gen 宣传海报" width="100%" style="max-width: 860px; border-radius: 12px;" />
|
|
4
|
-
|
|
5
|
-
<br /><br />
|
|
6
|
-
|
|
7
|
-
# 🎨 dsh-image-gen
|
|
8
|
-
|
|
9
|
-
**让 DeepSeek Harness
|
|
10
|
-
|
|
11
|
-
[](https://www.npmjs.com/package/dsh-image-gen)
|
|
12
|
-
[](https://github.com/deepseek-ai)
|
|
13
|
-
[](https://www.npmjs.com/package/dsh-image-gen)
|
|
14
|
-
[](LICENSE)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
pnpm dsh plugin --profile web add
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
|
-
##
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="docs/assets/hero-poster.webp" alt="dsh-image-gen 宣传海报" width="100%" style="max-width: 860px; border-radius: 12px;" />
|
|
4
|
+
|
|
5
|
+
<br /><br />
|
|
6
|
+
|
|
7
|
+
# 🎨 dsh-image-gen
|
|
8
|
+
|
|
9
|
+
**让 DeepSeek Harness 拥有类似 ChatGPT 的原生对话生图与图片编辑能力,支持文生图、图生图、连续编辑,并兼容多家图像模型提供商。**
|
|
10
|
+
|
|
11
|
+
[](https://www.npmjs.com/package/dsh-image-gen)
|
|
12
|
+
[](https://github.com/deepseek-ai)
|
|
13
|
+
[](https://www.npmjs.com/package/dsh-image-gen)
|
|
14
|
+
[](LICENSE)
|
|
15
|
+
[](https://linux.do/)
|
|
16
|
+
|
|
17
|
+
[English](README.en.md) | **简体中文**
|
|
18
|
+
|
|
19
|
+
<br />
|
|
20
|
+
|
|
21
|
+
<p align="center">💬 <b>直接对你的 DeepSeek Harness Agent 发送以下提示词:</b></p>
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
帮我安装生图插件,执行命令:pnpm dsh plugin --profile web add dsh-image-gen@latest
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
<p align="center"><sub>(也可以手动在终端执行:<code>pnpm dsh plugin --profile web add dsh-image-gen@latest</code>)</sub></p>
|
|
28
|
+
|
|
29
|
+
<br />
|
|
30
|
+
|
|
31
|
+
<p align="center">安装完成后,在 DSH 设置中填入自己的 API Key,就可以直接对 Agent 说:</p>
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
帮我画一张雨夜霓虹街头的赛博朋克猫咪。
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
<p align="center">Agent 会自动完成图片生成,也可以直接基于上一张图片继续修改。</p>
|
|
38
|
+
|
|
39
|
+
<br />
|
|
40
|
+
|
|
41
|
+
<div align="center">
|
|
42
|
+
<img src="docs/assets/generate-example.png" alt="首次生成图片的对话截图" width="48%" style="vertical-align: top;" />
|
|
43
|
+
<img src="docs/assets/edit-example.png" alt="基于上一张图片继续编辑的对话截图" width="48%" style="vertical-align: top;" />
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 💡 它解决什么问题?
|
|
51
|
+
|
|
52
|
+
**`dsh-image-gen` 是专为 DeepSeek Harness (DSH) 打造的开源图像生成与编辑插件。**
|
|
53
|
+
|
|
54
|
+
DeepSeek Harness 已经可以让 Agent 调用不同工具完成任务,本项目为它补上了原生的**图像生成与编辑能力**:
|
|
55
|
+
|
|
56
|
+
```mermaid
|
|
57
|
+
graph LR
|
|
58
|
+
A[用户 Prompt] --> B[DeepSeek Harness Agent]
|
|
59
|
+
B --> C[generate_image / edit_image]
|
|
60
|
+
C --> D[Gemini / OpenAI / Seedream / DashScope]
|
|
61
|
+
D --> E[图片数据]
|
|
62
|
+
E --> F[当前 Conversation 对话流]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 🚀 快速安装与使用
|
|
68
|
+
|
|
69
|
+
### 1. 安装插件
|
|
70
|
+
|
|
71
|
+
在你的 DeepSeek Harness 项目根目录下运行:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# 推荐方式:安装或升级到最新版本
|
|
75
|
+
pnpm dsh plugin --profile web add dsh-image-gen@latest
|
|
76
|
+
|
|
77
|
+
# 若已将 dsh 安装为系统全局命令:
|
|
78
|
+
dsh plugin --profile web add dsh-image-gen@latest
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
<details>
|
|
82
|
+
<summary><b>🛠️ 其他安装方式(Git 仓库直装 / 本地调试)</b></summary>
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# 方式 B:从 GitHub 仓库直接安装最新代码
|
|
86
|
+
pnpm dsh plugin --profile web add git+https://github.com/shanliuling/dsh-image-gen.git
|
|
87
|
+
|
|
88
|
+
# 方式 C:本地克隆源码开发安装
|
|
89
|
+
git clone https://github.com/shanliuling/dsh-image-gen.git
|
|
90
|
+
pnpm dsh plugin --profile web add ./dsh-image-gen
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
</details>
|
|
94
|
+
|
|
95
|
+
### 2. 配置 API Key 与工作区设置
|
|
96
|
+
|
|
97
|
+
打开 DSH Web 页面(默认 `http://localhost:3080`):
|
|
98
|
+
|
|
99
|
+
1. 进入 **Settings → Plugins → Image generation**。
|
|
100
|
+
2. 选择 Provider,填写 API Key。
|
|
101
|
+
3. 可按需开启 **保存到工作区**(默认开启)并自定义子目录,点击 **保存** 即可。
|
|
102
|
+
|
|
103
|
+
<div align="center">
|
|
104
|
+
<img src="docs/assets/settings-preview.png?v=0.1.7" alt="设置面板预览" width="720" />
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
### 3. 开始对话生图
|
|
108
|
+
|
|
109
|
+
现在直接在聊天框输入:
|
|
110
|
+
|
|
111
|
+
```text
|
|
112
|
+
生成一张极简主义的现代建筑客厅插画。
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
当前 Agent 就会自动调用 `generate_image` 工具并在对话流中返回图片。
|
|
116
|
+
|
|
117
|
+
也可以继续基于上一张图进行编辑:
|
|
118
|
+
|
|
119
|
+
```text
|
|
120
|
+
给刚才那张图加上落地窗,并把窗外改成雪山。
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Agent 会调用 `edit_image`,复用当前会话中的图片继续修改。
|
|
124
|
+
|
|
125
|
+
### 4. 查看原生生图画廊
|
|
126
|
+
|
|
127
|
+
点击会话顶栏的 **`[画廊]`** Tab,即可集中查看和搜索所有对话生成的历史图片:
|
|
128
|
+
|
|
129
|
+
<div align="center">
|
|
130
|
+
<img src="docs/assets/gallery-preview.png" alt="原生生图画廊预览" width="820" />
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## ✨ 主要能力
|
|
136
|
+
|
|
137
|
+
- 💬 **对话中直接生图**:不需要切换到其他网站,也不需要手动复制 Prompt,直接告诉 Agent 你想画什么即可。
|
|
138
|
+
- 🖼️ **支持文生图**:直接通过自然语言生成图片。
|
|
139
|
+
- ✏️ **支持图生图 / 图片编辑**:可以基于已有图片继续修改内容、风格或背景。
|
|
140
|
+
- 🔁 **支持连续多轮编辑**:上一张生成或编辑后的图片,可以在后续对话中继续修改。
|
|
141
|
+
- 📎 **复用会话图片**:支持使用当前会话中的上传图片或历史生成图片作为参考图。
|
|
142
|
+
- 🖼️ **历史生图画廊**:顶栏自带「画廊」Tab,自动汇总所有历史生成的图片,支持关键词搜索、厂商筛选、单张删除(带防误触确认与持久化墓碑)与一键复制/下载。
|
|
143
|
+
- 🔍 **交互式图片工具**:支持点击全屏大图预览、一键复制图片到剪贴板、本地下载与新标签页打开。
|
|
144
|
+
- 🎨 **多 Provider 支持**:支持 Google Gemini、OpenAI Images、OpenAI Compatible API、ByteDance Seedream / 火山方舟以及阿里云 DashScope(Qwen Image)。Provider、模型和 Endpoint 均可在设置中自由定制。
|
|
145
|
+
- 🔑 **BYOK (自带 Key)**:插件使用你自己的 API Key。API Key 通过 DeepSeek Harness 的 `credentials` 服务管理,采用写保护隔离,不需要写进项目源码或配置文件,前端不存明文。
|
|
146
|
+
- 🖼️ **图片跟随会话保存**:生成结果会接入 DeepSeek Harness 的 Attachment / Conversation 体系,重新打开历史会话后,仍然可以看到之前生成的图片。
|
|
147
|
+
- 💾 **生成图片自动落盘到工作区**:默认在每次生成后把图片文件保存到当前会话工作区,工具结果会返回文件的绝对路径;可在设置中关闭或修改保存目录。
|
|
148
|
+
- ⚙️ **原生设置界面**:Provider、API Key、模型和 Endpoint 都可以直接在 DSH Web 设置中修改,不需要手动编辑配置文件。
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 📦 支持的 Provider
|
|
153
|
+
|
|
154
|
+
| Provider | 默认模型 | 默认 Endpoint / Base URL |
|
|
155
|
+
| :--- | :--- | :--- |
|
|
156
|
+
| **Google Gemini** | `gemini-3.1-flash-image` | `https://generativelanguage.googleapis.com/v1beta/interactions` |
|
|
157
|
+
| **OpenAI Images** | `gpt-image-2` | `https://api.openai.com/v1` |
|
|
158
|
+
| **OpenAI Compatible** | 自定义 | 自定义 Base URL |
|
|
159
|
+
| **ByteDance Seedream / 火山方舟** | `doubao-seedream-5-0-260128` | `https://ark.cn-beijing.volces.com/api/v3` |
|
|
160
|
+
| **Aliyun DashScope / Qwen Image** | `qwen-image-3.0` | `https://dashscope.aliyuncs.com/api/v1` |
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## 🛠️ 本地开发 (Development)
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# 克隆仓库
|
|
168
|
+
git clone https://github.com/shanliuling/dsh-image-gen.git
|
|
169
|
+
cd dsh-image-gen
|
|
170
|
+
|
|
171
|
+
# 安装依赖与构建
|
|
172
|
+
pnpm install
|
|
173
|
+
pnpm run typecheck
|
|
174
|
+
pnpm run test
|
|
175
|
+
pnpm run build
|
|
176
|
+
|
|
177
|
+
# 检查 npm 打包内容
|
|
178
|
+
pnpm run pack:check
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 📄 开源协议 (License)
|
|
184
|
+
|
|
185
|
+
本项目基于 [MIT License](LICENSE) 开源。
|
|
186
|
+
|
|
187
|
+
如果这个插件对你有用,欢迎点一个 ⭐️ **Star** 支持!
|