@qzsy/dsh-image-generation 0.0.0-stage → 0.1.3
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/LICENSE +21 -0
- package/NOTICE +6 -0
- package/README.md +128 -2
- package/cordis.patch.yml +8 -0
- package/dist/client.js +1090 -0
- package/dist/index.js +785 -0
- package/package.json +68 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 whiteS18
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
This package is a fork of dsh-image-generation (https://github.com/whiteS18/dsh-image-generation).
|
|
2
|
+
Original author: whiteS18. Licensed under MIT; see LICENSE.
|
|
3
|
+
|
|
4
|
+
Changes made for @qzsy: package name/scope, module id, Cordis patch name,
|
|
5
|
+
Bun + TypeScript 7 packaging, and build/publish tooling. Runtime behavior
|
|
6
|
+
is preserved from the published upstream build.
|
package/README.md
CHANGED
|
@@ -1,3 +1,129 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @qzsy/dsh-image-generation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Fork of dsh-image-generation by whiteS18 (MIT). See NOTICE for changes; runtime behavior is preserved.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
~~~bash
|
|
8
|
+
dsh plugin add @qzsy/dsh-image-generation
|
|
9
|
+
~~~
|
|
10
|
+
|
|
11
|
+
## Upstream README
|
|
12
|
+
|
|
13
|
+
# dsh-image-generation
|
|
14
|
+
|
|
15
|
+
DeepSeek Harness 生图插件:在设置里配置多个生图供应商 / 模型,对话里通过 `image_generate` 调用当前选中的那一个模型。
|
|
16
|
+
|
|
17
|
+
结合了官方 `@deepseek-ai/dsh-tool-image-generation`(对话生图工具)和 `dsh-plugin-subscriptions`(设置页可配置)的思路,面向 **API Key + Base URL** 的网关,而不是订阅登录。
|
|
18
|
+
|
|
19
|
+
## 功能
|
|
20
|
+
|
|
21
|
+
- **设置 → 生图配置**(左侧导航):添加多个供应商。每个供应商有名称、Base URL、API 格式、API Key,以及一组生图模型。配置存在 profile 的 `image-gen` 插件条目里(DSH ≥ 0.1.6 为 volatile 字段、保存即热生效;≤ 0.1.5 写入 `settings.yaml` 的 `image-gen` 段),密钥走凭据服务,不进设置文件。
|
|
22
|
+
- **设置 → 插件 → 本插件详情 → 图形生成**(≤ 0.1.5 为 设置 → 插件 → 插件配置):从上面配置过的模型里**只选一个**作为对话生图模型,可开关工具、设置默认尺寸 / 质量。
|
|
23
|
+
- **对话工具 `image_generate`**:Agent 需要出图时调用当前选中的模型;图片写到工作区 `generate/image/`,并在对话里内联显示(240px 缩略图 + Lightbox 全屏预览)。
|
|
24
|
+
- **图像编辑**:4 种 API 格式全部支持 `referenceImages`(1–5 张参考图)。OpenAI / xAI 格式自动切换到 `/images/edits` 端点;Gemini / chat 格式把参考图一并放进请求。
|
|
25
|
+
- **中英双语界面**,无构建步骤,要求 Node >= 22.19。
|
|
26
|
+
|
|
27
|
+
## API 格式
|
|
28
|
+
|
|
29
|
+
按模型 / 网关选择,不要用聊天用的 Anthropic Messages:
|
|
30
|
+
|
|
31
|
+
| 格式 | 适用 | 请求 |
|
|
32
|
+
|------|------|------|
|
|
33
|
+
| **OpenAI Images** (`/v1/images/generations`) | `gpt-image-2`、`gpt-image-1`、DALL·E,以及兼容 OpenAI Images 的网关 | `POST {base}/images/generations`(编辑走 `/images/edits`),`response_format: b64_json`;网关拒绝该参数时自动去掉重试一次 |
|
|
34
|
+
| **xAI Images** (`/v1/images/generations`) | `grok-imagine-image-2.0` | 同上路径,但用 `aspect_ratio`;`quality` 按 xAI 能力映射(`high`→`medium`,`auto` 不下发) |
|
|
35
|
+
| **Gemini / Imagen** | `gemini-*-image`、`imagen-*` | 按模型名自动分流:`imagen-*` 走 `:predict`,其余走 `:generateContent`;官方 host 自动换 `x-goog-api-key` 头 |
|
|
36
|
+
| **OpenAI Chat Completions** | 在 chat 响应里返回图片的聚合网关 | `POST {base}/chat/completions` |
|
|
37
|
+
|
|
38
|
+
Base URL 填到 `/v1`(或 Gemini 的 `/v1beta`)这一层,插件会补上后面的路径。例如:
|
|
39
|
+
|
|
40
|
+
- OpenAI:`https://api.openai.com/v1`
|
|
41
|
+
- xAI:`https://api.x.ai/v1`
|
|
42
|
+
- Gemini 官方:`https://generativelanguage.googleapis.com/v1beta`
|
|
43
|
+
- 本地网关:`http://127.0.0.1:8317/v1`
|
|
44
|
+
|
|
45
|
+
API Key 通过凭据服务存储,环境变量名按 `IMAGE_GEN_<供应商ID大写>_API_KEY` 规则引用,不会写进设置文件。
|
|
46
|
+
|
|
47
|
+
## 安装
|
|
48
|
+
|
|
49
|
+
npm:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
dsh plugin --profile <name> add dsh-image-generation
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
> [!WARNING]
|
|
56
|
+
> `0.1.0` 的 `__ModuleLoader__` id 仍是 `dsh-image-gen`,DSH 会按包名 `dsh-image-generation` 校验并拒绝启动。请安装 `0.1.1` 或更新版本(当前 `0.1.2`)。已装 `0.1.0` 的 profile:
|
|
57
|
+
>
|
|
58
|
+
> ```sh
|
|
59
|
+
> dsh plugin --profile <name> add dsh-image-generation@0.1.1
|
|
60
|
+
> ```
|
|
61
|
+
>
|
|
62
|
+
> 然后完全退出并重新打开 DSH。
|
|
63
|
+
|
|
64
|
+
GitHub:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
dsh plugin --profile <name> add github:whiteS18/dsh-image-generation
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
本地检出:
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
dsh plugin --profile <name> add /绝对路径/dsh-image-generation
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
> [!IMPORTANT]
|
|
77
|
+
> DSH 在进程**启动时**组合插件。先启动再安装时,必须完全退出并重新打开 DSH(不是刷新页面)。
|
|
78
|
+
|
|
79
|
+
装完后可用:
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
dsh --profile <name> --dump-config | grep image-gen
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 使用
|
|
86
|
+
|
|
87
|
+
1. 打开 **设置 → 生图配置**,添加供应商和模型,填 Base URL / API 格式 / API Key,点保存。
|
|
88
|
+
2. 打开 **设置 → 插件 → 插件配置**,展开 **图形生成**,选择刚才配置的某一个模型并保存。
|
|
89
|
+
3. 在对话里让 Agent 生图,它会调用 `image_generate`。
|
|
90
|
+
|
|
91
|
+
可选参数:`prompt`(必填)、`size`(`1024x1024` / `1024x1536` / `1536x1024` / `auto`)、`quality`(`low` / `medium` / `high` / `auto`)、`referenceImages`(1–5 张已有图片引用,用于编辑;本地文件先 `read_image`)。
|
|
92
|
+
|
|
93
|
+
## 配置项默认值
|
|
94
|
+
|
|
95
|
+
| 配置项 | 默认值 | 说明 |
|
|
96
|
+
|--------|--------|------|
|
|
97
|
+
| `enabled` | `true` | 是否启用 `image_generate` 工具(关闭时工具仍注册,调用会被拒绝) |
|
|
98
|
+
| `providerId` / `modelId` | 空 | 当前选中的生图供应商与模型 |
|
|
99
|
+
| `defaultSize` | `1024x1024` | 工具未显式传 `size` 时的默认尺寸 |
|
|
100
|
+
| `defaultQuality` | `auto` | 工具未显式传 `quality` 时的默认质量 |
|
|
101
|
+
| `apiFormat`(供应商级) | `openai-images` | 新建供应商时的默认 API 格式 |
|
|
102
|
+
|
|
103
|
+
## 与现有插件的关系
|
|
104
|
+
|
|
105
|
+
- 官方 `@deepseek-ai/dsh-tool-image-generation` 只有工具、没有设置页;本插件自带设置页,一般不必再装官方包。
|
|
106
|
+
- npm 上另有同名风格的 `dsh-image-gen`(其他作者)。本包发布名为 `dsh-image-generation`,避免抢名。
|
|
107
|
+
- `dsh-plugin-subscriptions` 走的是 ChatGPT / Grok **订阅登录**,也会注册名为 `image_generate` 的工具。两边同时安装可能抢同一个工具名。需要 API 网关生图时用本插件;需要订阅生图时用 subscriptions。
|
|
108
|
+
|
|
109
|
+
## 卸载
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
dsh plugin --profile <name> remove dsh-image-generation
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## English
|
|
118
|
+
|
|
119
|
+
Image-generation plugin for DeepSeek Harness. Configure providers and models under **Settings → Image generation**, pick exactly one model on the plugin detail page (**Settings → Plugins → this plugin → Image generation**; on DSH ≤ 0.1.5: Settings → Plugins → Plugin configuration), then conversations call `image_generate` with that model.
|
|
120
|
+
|
|
121
|
+
All four API formats (OpenAI Images, xAI Images, Gemini/Imagen, OpenAI chat-completions gateways) support image editing via `referenceImages` (1–5 images). API keys are stored through the credentials service. Generated files land in `generate/image/` of the session workspace and are shown inline in the conversation. Chinese and English UI. Requires Node >= 22.19.
|
|
122
|
+
|
|
123
|
+
Install:
|
|
124
|
+
|
|
125
|
+
```sh
|
|
126
|
+
dsh plugin --profile <name> add dsh-image-generation
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`0.1.0` registered the client as `dsh-image-gen` and DSH refused to boot. Use `0.1.1` or later (`dsh plugin --profile <name> add dsh-image-generation@0.1.1`), then fully quit and reopen DSH.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Bundle self-activation patch: when this package is installed into a profile
|
|
2
|
+
# via `dsh plugin --profile <name> add @qzsy/dsh-image-generation`, this patch mounts the
|
|
3
|
+
# plugin's node half. The client half (Settings > 生图配置, Plugins card, and
|
|
4
|
+
# the image_generate toolview) is discovered from the `dsh.client` declaration
|
|
5
|
+
# in package.json.
|
|
6
|
+
- insert:
|
|
7
|
+
- id: image-gen
|
|
8
|
+
name: @qzsy/dsh-image-generation
|