dsh-plugin-image-workbench 0.0.0-stage → 1.1.6
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/README.en.md +258 -0
- package/README.md +260 -2
- package/client.js +241 -0
- package/cordis.patch.yml +14 -0
- package/host.js +692 -0
- package/install.mjs +333 -0
- package/package.json +58 -4
- package/scripts/fetch-style-images.mjs +104 -0
- package/scripts/vendor-snapshot.py +154 -0
- package/server/access.py +26 -0
- package/server/app.py +1329 -0
- package/server/catalog.json +1 -0
- package/server/catalog.py +147 -0
- package/server/composer.py +391 -0
- package/server/drafts.py +158 -0
- package/server/history.py +575 -0
- package/server/imaging.py +172 -0
- package/server/pool.py +1335 -0
- package/server/pool_admin.py +921 -0
- package/server/pool_service.py +1073 -0
- package/server/requirements.txt +6 -0
- package/server/smoke_check.py +402 -0
- package/server/static/access.html +202 -0
- package/server/static/index.html +4725 -0
- package/vendor/chatgpt2api/README.md +13 -0
- package/vendor/chatgpt2api/SOURCE.json +11 -0
- package/vendor/chatgpt2api/runtime/uv.exe +0 -0
- package/vendor/chatgpt2api/source/.env.example +82 -0
- package/vendor/chatgpt2api/source/.python-version +1 -0
- package/vendor/chatgpt2api/source/LICENSE +21 -0
- package/vendor/chatgpt2api/source/README.md +391 -0
- package/vendor/chatgpt2api/source/VERSION +1 -0
- package/vendor/chatgpt2api/source/api/__init__.py +2 -0
- package/vendor/chatgpt2api/source/api/accounts.py +537 -0
- package/vendor/chatgpt2api/source/api/ai.py +217 -0
- package/vendor/chatgpt2api/source/api/app.py +62 -0
- package/vendor/chatgpt2api/source/api/errors.py +46 -0
- package/vendor/chatgpt2api/source/api/image_inputs.py +309 -0
- package/vendor/chatgpt2api/source/api/image_tasks.py +120 -0
- package/vendor/chatgpt2api/source/api/support.py +134 -0
- package/vendor/chatgpt2api/source/api/system.py +365 -0
- package/vendor/chatgpt2api/source/assets/atlascloud.svg +1 -0
- package/vendor/chatgpt2api/source/assets/ipwo.png +0 -0
- package/vendor/chatgpt2api/source/assets/kunrouai.svg +50 -0
- package/vendor/chatgpt2api/source/config.default.json +108 -0
- package/vendor/chatgpt2api/source/main.py +9 -0
- package/vendor/chatgpt2api/source/pyproject.toml +27 -0
- package/vendor/chatgpt2api/source/scripts/init_proxy_config.py +186 -0
- package/vendor/chatgpt2api/source/scripts/migrate_storage.py +163 -0
- package/vendor/chatgpt2api/source/scripts/privoxy-warp.conf +13 -0
- package/vendor/chatgpt2api/source/scripts/test_outlook_token_mailbox.py +385 -0
- package/vendor/chatgpt2api/source/scripts/test_storage.py +129 -0
- package/vendor/chatgpt2api/source/scripts/verify_oauth_refresh.py +92 -0
- package/vendor/chatgpt2api/source/services/__init__.py +0 -0
- package/vendor/chatgpt2api/source/services/account_service.py +1757 -0
- package/vendor/chatgpt2api/source/services/auth_service.py +253 -0
- package/vendor/chatgpt2api/source/services/backup_service.py +671 -0
- package/vendor/chatgpt2api/source/services/config.py +667 -0
- package/vendor/chatgpt2api/source/services/content_filter.py +242 -0
- package/vendor/chatgpt2api/source/services/cpa_service.py +315 -0
- package/vendor/chatgpt2api/source/services/editable_file_task_service.py +260 -0
- package/vendor/chatgpt2api/source/services/image_service.py +376 -0
- package/vendor/chatgpt2api/source/services/image_storage_service.py +405 -0
- package/vendor/chatgpt2api/source/services/image_tags_service.py +76 -0
- package/vendor/chatgpt2api/source/services/image_task_service.py +550 -0
- package/vendor/chatgpt2api/source/services/log_service.py +337 -0
- package/vendor/chatgpt2api/source/services/model_service.py +182 -0
- package/vendor/chatgpt2api/source/services/oauth_login_service.py +267 -0
- package/vendor/chatgpt2api/source/services/openai_backend_api.py +2763 -0
- package/vendor/chatgpt2api/source/services/openai_oauth.py +32 -0
- package/vendor/chatgpt2api/source/services/protocol/__init__.py +2 -0
- package/vendor/chatgpt2api/source/services/protocol/anthropic_v1_messages.py +307 -0
- package/vendor/chatgpt2api/source/services/protocol/chat_completion_cache.py +238 -0
- package/vendor/chatgpt2api/source/services/protocol/conversation.py +1644 -0
- package/vendor/chatgpt2api/source/services/protocol/error_response.py +124 -0
- package/vendor/chatgpt2api/source/services/protocol/openai_search.py +19 -0
- package/vendor/chatgpt2api/source/services/protocol/openai_v1_chat_complete.py +316 -0
- package/vendor/chatgpt2api/source/services/protocol/openai_v1_image_edit.py +86 -0
- package/vendor/chatgpt2api/source/services/protocol/openai_v1_image_generations.py +42 -0
- package/vendor/chatgpt2api/source/services/protocol/openai_v1_models.py +53 -0
- package/vendor/chatgpt2api/source/services/protocol/openai_v1_response.py +453 -0
- package/vendor/chatgpt2api/source/services/protocol/web_search_tool.py +160 -0
- package/vendor/chatgpt2api/source/services/proxy_service.py +648 -0
- package/vendor/chatgpt2api/source/services/storage/__init__.py +5 -0
- package/vendor/chatgpt2api/source/services/storage/base.py +38 -0
- package/vendor/chatgpt2api/source/services/storage/database_storage.py +194 -0
- package/vendor/chatgpt2api/source/services/storage/factory.py +104 -0
- package/vendor/chatgpt2api/source/services/storage/git_storage.py +183 -0
- package/vendor/chatgpt2api/source/services/storage/json_storage.py +95 -0
- package/vendor/chatgpt2api/source/services/sub2api_service.py +531 -0
- package/vendor/chatgpt2api/source/utils/__init__.py +0 -0
- package/vendor/chatgpt2api/source/utils/helper.py +469 -0
- package/vendor/chatgpt2api/source/utils/image_tokens.py +346 -0
- package/vendor/chatgpt2api/source/utils/log.py +110 -0
- package/vendor/chatgpt2api/source/utils/pkce.py +19 -0
- package/vendor/chatgpt2api/source/utils/pow.py +207 -0
- package/vendor/chatgpt2api/source/utils/sentinel.py +159 -0
- package/vendor/chatgpt2api/source/utils/turnstile.py +184 -0
- package/vendor/chatgpt2api/source/uv.lock +904 -0
- package/vendor/chatgpt2api/source/web/bun.lock +1501 -0
- package/vendor/chatgpt2api/source/web/components.json +24 -0
- package/vendor/chatgpt2api/source/web/eslint.config.mjs +17 -0
- package/vendor/chatgpt2api/source/web/next.config.ts +40 -0
- package/vendor/chatgpt2api/source/web/package.json +58 -0
- package/vendor/chatgpt2api/source/web/postcss.config.mjs +5 -0
- package/vendor/chatgpt2api/source/web/public/github.svg +1 -0
- package/vendor/chatgpt2api/source/web/public/next.svg +1 -0
- package/vendor/chatgpt2api/source/web/public/openai.svg +1 -0
- package/vendor/chatgpt2api/source/web/public/vercel.svg +1 -0
- package/vendor/chatgpt2api/source/web/src/app/accounts/components/account-import-dialog.tsx +925 -0
- package/vendor/chatgpt2api/source/web/src/app/accounts/page.tsx +1307 -0
- package/vendor/chatgpt2api/source/web/src/app/debug/components/chat-panel.tsx +224 -0
- package/vendor/chatgpt2api/source/web/src/app/debug/components/editable-file-panel.tsx +444 -0
- package/vendor/chatgpt2api/source/web/src/app/debug/components/ppt-panel.tsx +9 -0
- package/vendor/chatgpt2api/source/web/src/app/debug/components/psd-panel.tsx +9 -0
- package/vendor/chatgpt2api/source/web/src/app/debug/components/search-panel.tsx +172 -0
- package/vendor/chatgpt2api/source/web/src/app/debug/components/skill-panel.tsx +169 -0
- package/vendor/chatgpt2api/source/web/src/app/debug/components/types.ts +39 -0
- package/vendor/chatgpt2api/source/web/src/app/debug/page.tsx +59 -0
- package/vendor/chatgpt2api/source/web/src/app/favicon.ico +0 -0
- package/vendor/chatgpt2api/source/web/src/app/globals.css +231 -0
- package/vendor/chatgpt2api/source/web/src/app/image/components/image-composer.tsx +542 -0
- package/vendor/chatgpt2api/source/web/src/app/image/components/image-results.tsx +554 -0
- package/vendor/chatgpt2api/source/web/src/app/image/components/image-sidebar.tsx +176 -0
- package/vendor/chatgpt2api/source/web/src/app/image/page.tsx +1799 -0
- package/vendor/chatgpt2api/source/web/src/app/image-manager/page.tsx +732 -0
- package/vendor/chatgpt2api/source/web/src/app/layout.tsx +50 -0
- package/vendor/chatgpt2api/source/web/src/app/login/page.tsx +101 -0
- package/vendor/chatgpt2api/source/web/src/app/logs/page.tsx +356 -0
- package/vendor/chatgpt2api/source/web/src/app/page.tsx +30 -0
- package/vendor/chatgpt2api/source/web/src/app/settings/components/api-docs-card.tsx +341 -0
- package/vendor/chatgpt2api/source/web/src/app/settings/components/backup-settings-card.tsx +447 -0
- package/vendor/chatgpt2api/source/web/src/app/settings/components/base-url-card.tsx +71 -0
- package/vendor/chatgpt2api/source/web/src/app/settings/components/config-card.tsx +491 -0
- package/vendor/chatgpt2api/source/web/src/app/settings/components/cpa-pool-dialog.tsx +108 -0
- package/vendor/chatgpt2api/source/web/src/app/settings/components/cpa-pools-card.tsx +169 -0
- package/vendor/chatgpt2api/source/web/src/app/settings/components/import-browser-dialog.tsx +185 -0
- package/vendor/chatgpt2api/source/web/src/app/settings/components/proxy-runtime-card.tsx +379 -0
- package/vendor/chatgpt2api/source/web/src/app/settings/components/proxy-settings-card.tsx +127 -0
- package/vendor/chatgpt2api/source/web/src/app/settings/components/proxy-settings.tsx +200 -0
- package/vendor/chatgpt2api/source/web/src/app/settings/components/settings-header.tsx +12 -0
- package/vendor/chatgpt2api/source/web/src/app/settings/components/sub2api-connections.tsx +886 -0
- package/vendor/chatgpt2api/source/web/src/app/settings/components/third-party-apps-card.tsx +81 -0
- package/vendor/chatgpt2api/source/web/src/app/settings/components/user-keys-card.tsx +422 -0
- package/vendor/chatgpt2api/source/web/src/app/settings/page.tsx +135 -0
- package/vendor/chatgpt2api/source/web/src/app/settings/store.ts +1069 -0
- package/vendor/chatgpt2api/source/web/src/components/date-range-filter.tsx +49 -0
- package/vendor/chatgpt2api/source/web/src/components/header-actions.tsx +24 -0
- package/vendor/chatgpt2api/source/web/src/components/image-lightbox.tsx +434 -0
- package/vendor/chatgpt2api/source/web/src/components/image-thumbnail.tsx +46 -0
- package/vendor/chatgpt2api/source/web/src/components/theme-script.tsx +18 -0
- package/vendor/chatgpt2api/source/web/src/components/theme-toggle.tsx +14 -0
- package/vendor/chatgpt2api/source/web/src/components/top-nav.tsx +263 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/animated-theme-toggler.tsx +256 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/badge.tsx +41 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/button.tsx +59 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/calendar.tsx +46 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/card.tsx +61 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/checkbox.tsx +27 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/dia-text-reveal.tsx +267 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/dialog.tsx +132 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/field.tsx +13 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/input.tsx +19 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/label.tsx +24 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/morphing-text.tsx +149 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/popover.tsx +38 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/select.tsx +175 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/sheet.tsx +143 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/table.tsx +29 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/tabs.tsx +91 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/text-3d-flip.tsx +269 -0
- package/vendor/chatgpt2api/source/web/src/components/ui/textarea.tsx +18 -0
- package/vendor/chatgpt2api/source/web/src/components/version-release-dialog.tsx +127 -0
- package/vendor/chatgpt2api/source/web/src/constants/common-env.ts +6 -0
- package/vendor/chatgpt2api/source/web/src/hooks/use-version-check.ts +85 -0
- package/vendor/chatgpt2api/source/web/src/lib/api.ts +926 -0
- package/vendor/chatgpt2api/source/web/src/lib/auth-session.ts +26 -0
- package/vendor/chatgpt2api/source/web/src/lib/release.ts +25 -0
- package/vendor/chatgpt2api/source/web/src/lib/request.ts +93 -0
- package/vendor/chatgpt2api/source/web/src/lib/use-auth-guard.ts +89 -0
- package/vendor/chatgpt2api/source/web/src/lib/utils.ts +6 -0
- package/vendor/chatgpt2api/source/web/src/store/auth.ts +112 -0
- package/vendor/chatgpt2api/source/web/src/store/editable-file-history.ts +33 -0
- package/vendor/chatgpt2api/source/web/src/store/image-conversations.ts +318 -0
- package/vendor/chatgpt2api/source/web/tsconfig.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 guohwa
|
|
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/README.en.md
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# Bluxe Image Workbench
|
|
2
|
+
|
|
3
|
+
[简体中文](./README.md) · English · [MIT License](./LICENSE)
|
|
4
|
+
|
|
5
|
+
An image generation workbench plugin for the DeepSeek Harness (DSH) desktop application. A single distributable package provides the web workbench, a FastAPI backend, and an account-pool runtime, exposing illustration and photography prompt pipelines in the DSH sidebar. The generation endpoint points to the bundled local account pool by default and can be reconfigured to any OpenAI-compatible service.
|
|
6
|
+
|
|
7
|
+
The backend also operates without DSH. By default, open `http://127.0.0.1:8092/` in a browser.
|
|
8
|
+
|
|
9
|
+
> This repository contains source code and the built-in format, style, layout and palette catalogs only. Generated images, history, drafts, account credentials, API keys and proxy settings are excluded from version control.
|
|
10
|
+
|
|
11
|
+
## Contents
|
|
12
|
+
|
|
13
|
+
- [Capabilities](#capabilities)
|
|
14
|
+
- [Architecture](#architecture)
|
|
15
|
+
- [Requirements](#requirements)
|
|
16
|
+
- [Installation](#installation)
|
|
17
|
+
- [First launch](#first-launch)
|
|
18
|
+
- [Endpoint setup and account management](#endpoint-setup-and-account-management)
|
|
19
|
+
- [Standalone operation](#standalone-operation)
|
|
20
|
+
- [Configuration](#configuration)
|
|
21
|
+
- [HTTP API](#http-api)
|
|
22
|
+
- [Data and privacy](#data-and-privacy)
|
|
23
|
+
- [Troubleshooting](#troubleshooting)
|
|
24
|
+
- [Maintenance and uninstallation](#maintenance-and-uninstallation)
|
|
25
|
+
- [License and third-party code](#license-and-third-party-code)
|
|
26
|
+
|
|
27
|
+
## Capabilities
|
|
28
|
+
|
|
29
|
+
| Capability | Details |
|
|
30
|
+
| --- | --- |
|
|
31
|
+
| Two prompt modes | Illustration and photography pipelines with selectable format, style, palette and layout. `server/catalog.json` ships 368 styles, 170 layouts and 36 palettes |
|
|
32
|
+
| Reference images | Upload or drop a reference image, submitted through `/v1/images/edits`; the capability can be disabled when the endpoint does not support edits |
|
|
33
|
+
| Batch generation | Import storyboard rows in bulk and queue them. A failed image is retried with another account (up to 3 rounds) without aborting the task |
|
|
34
|
+
| Aspect ratios | `1:1`, `3:4`, `2:3`, `9:16`, `4:3`, `3:2`, `16:9`, plus `2.35:1` for WeChat cover images. When no native upstream size exists, the image is generated at the widest supported size and center-cropped locally |
|
|
35
|
+
| Result management | Generation history, drafts, single-image redo, ZIP download, thumbnail and preview derivatives, completion notifications |
|
|
36
|
+
| Monitoring | Total, available and quota figures for accounts, per-account failure ledger and queue state; one-click stop for running and queued jobs |
|
|
37
|
+
| Endpoint and account pool | Copy the endpoint URL and local API key; start, stop and restart the pool with configurable auto-restart; import accounts (manually removed ones are skipped), disable and delete accounts, rotate keys |
|
|
38
|
+
| Customization | Workbench title, output directory, endpoint name, model, response format and monitoring mode |
|
|
39
|
+
|
|
40
|
+
## Architecture
|
|
41
|
+
|
|
42
|
+
```mermaid
|
|
43
|
+
flowchart LR
|
|
44
|
+
U["DSH sidebar / browser"] --> W["Workbench backend FastAPI (default :8092)"]
|
|
45
|
+
H["DSH host process host.js"] -. starts and guards .-> W
|
|
46
|
+
V["vendor/chatgpt2api source and runtime"] -. first-run bootstrap .-> P
|
|
47
|
+
W --> P["Built-in account pool (default :38651)"]
|
|
48
|
+
P --> UP["Upstream image service"]
|
|
49
|
+
W -. optional .-> API["Third-party OpenAI-compatible endpoint"]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
| Component | Responsibility |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| `host.js` / `client.js` | DSH host entry point: starts and guards port 8092, renders the sidebar panel and status indicator |
|
|
55
|
+
| `install.mjs` | Idempotent installer: registers the profile, syncs backend code, cleans up registration on uninstall |
|
|
56
|
+
| `cordis.patch.yml` | DSH loader configuration: service ports, watchdog toggle and probe interval |
|
|
57
|
+
| `server/` | Backend code, static interface and format/style catalogs |
|
|
58
|
+
| `vendor/chatgpt2api/` | Account-pool server source snapshot, `uv` runtime, sanitized default configuration and upstream license |
|
|
59
|
+
| `scripts/vendor-snapshot.py` | Rebuilds the vendored source snapshot |
|
|
60
|
+
|
|
61
|
+
The account-pool process lifecycle is managed by `server/pool_service.py`; the DSH host process manages only the workbench backend on port 8092. The pool runtime ships with the plugin and requires no external account-pool plugin.
|
|
62
|
+
|
|
63
|
+
## Requirements
|
|
64
|
+
|
|
65
|
+
| Item | Requirement |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| DSH desktop | Verified against the `desktop` profile. DSH is optional; see [Standalone operation](#standalone-operation) |
|
|
68
|
+
| Node.js | 20 or newer, to run `install.mjs` and `host.js` |
|
|
69
|
+
| Python | 3.13. The bundled `uv` provisions the runtime and dependencies on first launch; alternatively install a system Python and `server/requirements.txt` manually |
|
|
70
|
+
| Operating system | Verified on Windows 10 / 11. `vendor/chatgpt2api/runtime/uv.exe` is a Windows binary; Linux and macOS require a local `uv` or a prepared Python 3.13 environment |
|
|
71
|
+
| Network | First-run bootstrap downloads the Python runtime and dependency packages. The pool usually requires an outbound proxy to reach its upstream |
|
|
72
|
+
|
|
73
|
+
## Installation
|
|
74
|
+
|
|
75
|
+
### Install from DSH (recommended)
|
|
76
|
+
|
|
77
|
+
Open "Plugins -> Add Plugin" and use any one of these:
|
|
78
|
+
|
|
79
|
+
| Method | Enter | Notes |
|
|
80
|
+
| --- | --- | --- |
|
|
81
|
+
| npm package (preferred) | `dsh-plugin-image-workbench` | Served from a CDN, fast and interruption-free; the plugin manager probes npmjs and npmmirror in parallel and takes whichever answers first |
|
|
82
|
+
| Gitee mirror | `https://gitee.com/guohwa/dsh-plugin-image-workbench.git` | Reachable directly from mainland China, shallow clone takes about 9 seconds |
|
|
83
|
+
| GitHub upstream | `https://github.com/guohwa/dsh-plugin-image-workbench.git` | Source of truth; cloning often stalls on the 31 MB uv runtime |
|
|
84
|
+
|
|
85
|
+
> Git URLs **must end with `.git`**. The plugin manager installs through pnpm; without the suffix pnpm treats the URL as a tarball link, fetches the HTML page and fails with `ERR_PNPM_FETCH_403` plus "No authorization header was set" — that is about URL form, not permissions.
|
|
86
|
+
|
|
87
|
+
All three carry the same content: every push and tag on GitHub is mirrored to Gitee, and tags also trigger an npm release. The plugin ships a roughly 31 MB uv runtime, which is exactly the part that stalls or times out when cloning from GitHub — so prefer the package name or the Gitee URL in mainland China.
|
|
88
|
+
|
|
89
|
+
### Install from source
|
|
90
|
+
|
|
91
|
+
For development, restricted networks, or migration from an older version:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
git clone https://gitee.com/guohwa/dsh-plugin-image-workbench.git
|
|
95
|
+
cd dsh-plugin-image-workbench
|
|
96
|
+
node install.mjs
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Upstream lives on GitHub (`https://github.com/guohwa/dsh-plugin-image-workbench.git`); the Gitee URL above is the same content and much faster from mainland China.
|
|
100
|
+
|
|
101
|
+
The installer creates the profile directory junction, registers the bundle, syncs backend code and removes the legacy standalone pool plugin from the load list. It is idempotent. DSH usually picks up the new bundle directly; if no sidebar entry appears, quit DSH completely and start it again.
|
|
102
|
+
|
|
103
|
+
> Do not move or delete the installation directory. The profile stores a junction pointing at it, and DSH cannot resolve the plugin once the directory moves. To relocate, run `node install.mjs --uninstall` in the old directory first, then install from the new one. Re-running the installer also repairs a junction that still points at an old path.
|
|
104
|
+
|
|
105
|
+
Open "Bluxe手绘工坊 · 生图工作台" from the sidebar, or navigate directly to `http://127.0.0.1:8092/`.
|
|
106
|
+
|
|
107
|
+
## First launch
|
|
108
|
+
|
|
109
|
+
The first launch prepares the backend and account-pool runtime automatically and is usually ready within a minute, with no manual steps required. The pool then starts on its own, and can also be started from "Endpoint & Pool -> Local Pool".
|
|
110
|
+
|
|
111
|
+
## Endpoint setup and account management
|
|
112
|
+
|
|
113
|
+
A fresh pool contains no accounts. Complete one of the following configurations before the first generation.
|
|
114
|
+
|
|
115
|
+
### Option A: Use the built-in account pool
|
|
116
|
+
|
|
117
|
+
Import accounts under "Endpoint & Pool -> Local Pool". Click the file selector or drop `.txt`, `.json`, `.csv`, `.tsv` or `.log` files into it (multi-select supported), or paste the content directly, then click the import button.
|
|
118
|
+
|
|
119
|
+
| Format | Details |
|
|
120
|
+
| --- | --- |
|
|
121
|
+
| JSON export | `{"accounts":[...]}`, an array, or a single object. Retains email, password and related account material for automatic re-login after token expiry; recommended |
|
|
122
|
+
| Five-field bulk format | `email----password----client_id----mail_refresh_token----access_token`. The mailbox client ID and mailbox refresh token are stored with the account as reference data and are never used as the pool's OpenAI `refresh_token` |
|
|
123
|
+
| Plain-text tokens | One `access_token` per line (`eyJ`-prefixed strings) |
|
|
124
|
+
| Legacy export lines | `email,password,token` or `email----password----token` |
|
|
125
|
+
|
|
126
|
+
Entries containing only an email, password and 2FA secret without an `access_token` are not supported; this pool version does not perform login-to-token exchange. After import, configure an outbound proxy for the network environment and confirm that the panel reports the pool as online.
|
|
127
|
+
|
|
128
|
+
### Outbound proxy
|
|
129
|
+
|
|
130
|
+
The built-in pool must reach OpenAI / ChatGPT. Leave it empty for a direct connection on an unrestricted network; on a restricted network configure it as below. The address shown in the panel is always what was detected on this machine, never a hardcoded sample.
|
|
131
|
+
|
|
132
|
+
- **Auto-detected display**: "Endpoint & Pool -> Local Pool -> Pool outbound proxy" shows the proxy this machine is actually using. Environment variables such as `HTTPS_PROXY` are read first (temporary loopback proxies injected by host tools are ignored), then common local ports are probed: 1080 (both SOCKS5 and HTTP), 7890, 7891, 8118, 1087. Change machine or proxy port and the value follows.
|
|
133
|
+
- **Auto-calibration**: the pool calibrates once at startup. A saved address that still connects locally is kept; one that no longer connects (new machine, closed port, exited client) is re-detected and replaced; nothing found means a direct connection.
|
|
134
|
+
- **Manual entry / one-click switch**: you can also type your own address and click "Save proxy" to run an immediate connectivity check; failures name the address that could not be reached, and account quotas are recalculated once it passes. If the saved address is unreachable on this machine, the panel marks it and offers a "switch to <address>" button.
|
|
135
|
+
- Environment variable: set `CHATGPT2API_PROXY_RUNTIME_PROXY_URL` (e.g. `socks5://127.0.0.1:1080`) before launch; the pool reads it during bootstrap.
|
|
136
|
+
|
|
137
|
+
With a proxy configured, the pool reaches its upstream through that egress and generation succeeds. Without one on a restricted network, the panel shows online but generation fails with connection timeouts in the log, and account quotas stay at 0 (displayed as "used up").
|
|
138
|
+
|
|
139
|
+
### Option B: Use a third-party endpoint
|
|
140
|
+
|
|
141
|
+
Under "Endpoint & Pool -> Generation Endpoint", enter the Base URL, API key and model name, save, and run the connectivity test. This path does not require the built-in account pool.
|
|
142
|
+
|
|
143
|
+
## Standalone operation
|
|
144
|
+
|
|
145
|
+
The backend starts and guards the account pool itself, so only the backend needs to run:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
cd server
|
|
149
|
+
python -m venv .venv
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Windows
|
|
154
|
+
.venv/Scripts/pip install -r requirements.txt
|
|
155
|
+
.venv/Scripts/python -m uvicorn app:app --host 127.0.0.1 --port 8092
|
|
156
|
+
|
|
157
|
+
# Linux / macOS
|
|
158
|
+
# .venv/bin/pip install -r requirements.txt
|
|
159
|
+
# .venv/bin/python -m uvicorn app:app --host 127.0.0.1 --port 8092
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`pool_service.py` still unpacks the pool runtime from the plugin's `vendor/` directory. On Linux and macOS, prepare a Python 3.13 environment for the pool if no `uv` is available. Then open `http://127.0.0.1:8092/`.
|
|
163
|
+
|
|
164
|
+
## Configuration
|
|
165
|
+
|
|
166
|
+
Most settings are available under "Endpoint & Pool -> Generation Endpoint" and are written to `server/config.local.json`, which is not committed. The table below lists factory defaults; both service ports can be changed through `cordis.patch.yml` or environment variables. When changing the pool port, update the generation endpoint Base URL accordingly. The account management panel is verified against the default port 38651, so retaining the default is recommended.
|
|
167
|
+
|
|
168
|
+
| Setting | Default | How to change |
|
|
169
|
+
| --- | --- | --- |
|
|
170
|
+
| Workbench port | `8092` | `port` in `cordis.patch.yml`, or `DSH_IMAGE_PORT` |
|
|
171
|
+
| Pool port | `38651` | `poolPort` in `cordis.patch.yml`, or `DSH_IMAGE_POOL_PORT` |
|
|
172
|
+
| Base URL | `http://127.0.0.1:38651/v1` | Generation Endpoint tab |
|
|
173
|
+
| Image model | `gpt-image-2` | Generation Endpoint tab |
|
|
174
|
+
| Output directory | `server/images/` | Generation Endpoint tab; absolute paths accepted |
|
|
175
|
+
| Workbench title | `Bluxe手绘工坊 · 生图工作台` | Generation Endpoint tab |
|
|
176
|
+
| Pool data directory | `~/.dsh/chatgpt2api-image/` | Holds `admin-key`, `user-api-keys.json`, `source/config.json` and the account database |
|
|
177
|
+
| Watchdog interval | `15000` ms | `watchdogIntervalMs` in `cordis.patch.yml`; `watchdog: false` disables the host-side watchdog |
|
|
178
|
+
| Logs | `~/.dsh/image-workbench/backend.log`, `~/.dsh/image-workbench/venv.log`, `pool-service.log` in the pool directory | Inspect in this order when troubleshooting |
|
|
179
|
+
|
|
180
|
+
## HTTP API
|
|
181
|
+
|
|
182
|
+
Principal backend routes are listed below. The complete definitions are in `server/app.py`.
|
|
183
|
+
|
|
184
|
+
| Route | Method | Purpose |
|
|
185
|
+
| --- | --- | --- |
|
|
186
|
+
| `/health` | GET | Backend liveness probe |
|
|
187
|
+
| `/api/catalog` | GET | Format, style, layout and palette definitions |
|
|
188
|
+
| `/api/config`, `/api/config/test` | GET / POST | Read and update configuration; connectivity test |
|
|
189
|
+
| `/api/compose` | POST | Prompt composition |
|
|
190
|
+
| `/api/generate` | POST | Submit an image generation task |
|
|
191
|
+
| `/api/generate/stop` | POST | Cancel in-flight requests, clear the queue and stop account retries |
|
|
192
|
+
| `/api/tasks/{task_id}` | GET | Query task status |
|
|
193
|
+
| `/api/history`, `/api/drafts` | GET / POST / DELETE | Generation history and drafts |
|
|
194
|
+
| `/api/monitor` | GET | Runtime monitoring data |
|
|
195
|
+
| `/api/pool/panel` | GET | Account and key overview |
|
|
196
|
+
| `/api/pool/proxy`, `/proxy/test` | GET / POST | Read, save and test the pool's outbound proxy (required on restricted networks; direct by default) |
|
|
197
|
+
| `/api/pool/accounts/import`, `/delete`, `/status` | POST | Import, delete and enable/disable accounts |
|
|
198
|
+
| `/api/pool/key/ensure` | POST | Reissue a user API key |
|
|
199
|
+
| `/api/pool/service` | GET | Pool process status |
|
|
200
|
+
| `/api/pool/service/start`, `/stop`, `/restart`, `/auto` | POST | Process control and auto-restart toggle |
|
|
201
|
+
|
|
202
|
+
## Data and privacy
|
|
203
|
+
|
|
204
|
+
- `.gitignore` excludes `images/`, `refs/`, `thumbs/`, `workbench/`, `*.db`, `history.json`, `drafts.json`, `config.local.json`, `user-api-keys.json`, `admin-key`, `*.log` and all `*.bak_*` backup files.
|
|
205
|
+
- Runtime artifacts stay on the local machine: images, history and drafts under `server/`; accounts and keys in the pool data directory.
|
|
206
|
+
- Both services bind to `127.0.0.1` only, and the backend authentication layer is a no-op in this local build. **Do not expose 8092 or 38651 to a public or shared network.** Configure a reverse proxy with authentication if remote access is required.
|
|
207
|
+
- The pool stores imported account credentials. Its data directory must not be synced to any public location.
|
|
208
|
+
|
|
209
|
+
## Troubleshooting
|
|
210
|
+
|
|
211
|
+
| Symptom | Resolution |
|
|
212
|
+
| --- | --- |
|
|
213
|
+
| No sidebar entry | Bundles load only at DSH startup; quit DSH completely and start it again |
|
|
214
|
+
| Plugin manager reports a GitHub connection timeout | Switch to the Gitee URL `https://gitee.com/guohwa/dsh-plugin-image-workbench.git` (**with `.git`**), reachable directly from mainland China |
|
|
215
|
+
| Install fails with `ERR_PNPM_EPERM ... rename '...dsh-plugin-image-workbench_tmp_...'` | The previous version is still running and the backend process holds the plugin directory, so Windows refuses the rename. Quit DSH completely (tray menu -> Quit), end any leftover `python.exe` in Task Manager, delete `node_modules\dsh-plugin-image-workbench`, then install again. From 1.1.4 on, installs under `node_modules` relocate their runtime to `~/.dsh/image-workbench`, so this no longer happens |
|
|
216
|
+
| Code stops taking effect after moving the installation directory | Re-run `node install.mjs`; the directory junction is rebuilt to the current path |
|
|
217
|
+
| "Built-in pool not ready" | Start the pool under "Endpoint & Pool -> Local Pool"; allow time for first-run environment initialization |
|
|
218
|
+
| Dependency install reports `fastapi was not found in the package registry` or an index returns 403 | The proxy is blocking the mirror. Sources are tried in order automatically (mirrors direct -> official PyPI via proxy -> official PyPI direct); if all fail, point `DSH_IMAGE_PYPI_INDEX` at a reachable index |
|
|
219
|
+
| Repeats `No module named uvicorn` | An empty environment left behind by a failed install. 1.1.2 detects and repairs it automatically; on older versions delete `server/.venv` and restart DSH |
|
|
220
|
+
| Account quotas stay at 0 and show "used up" | The outbound proxy is not in effect or the port is wrong. Re-enter the address under "Local Pool -> Pool outbound proxy" and save; the connectivity check runs on save and quotas are recalculated once it passes |
|
|
221
|
+
| Generation returns 401 | Reissue the API key in the panel, or verify the third-party endpoint key |
|
|
222
|
+
| Pool online but generation fails | Usually a missing outbound proxy or exhausted quota; check the proxy in `source/config.json` and read `pool-service.log` |
|
|
223
|
+
| Changed host-side code or profile configuration | Restart DSH; static interface resource changes require a browser cache refresh |
|
|
224
|
+
| Legacy pool entry still visible in the sidebar | The installer removed its load-list registration; it disappears after restarting DSH |
|
|
225
|
+
|
|
226
|
+
## Maintenance and uninstallation
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# Rebuild the vendor snapshot after editing local pool source; no accounts or keys are copied
|
|
230
|
+
python scripts/vendor-snapshot.py
|
|
231
|
+
|
|
232
|
+
# Backend smoke test; run with dependencies installed
|
|
233
|
+
cd server && python smoke_check.py --quick
|
|
234
|
+
|
|
235
|
+
# Update: overwrite the source in place (or git pull), then re-run the installer
|
|
236
|
+
node install.mjs
|
|
237
|
+
|
|
238
|
+
# Remove the plugin from the profile and drop the directory junction; restart DSH
|
|
239
|
+
node install.mjs --uninstall
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Uninstalling removes only the profile registration and the directory junction. The plugin source directory, the account data under `~/.dsh/chatgpt2api-image` and generated images are all preserved; delete them yourself once you are sure they are no longer needed.
|
|
243
|
+
|
|
244
|
+
The pool uses strict round-robin account selection and excludes rate-limited accounts. A failed account is recorded in monitoring without aborting the batch. Start, stop, restart and auto-restart controls affect only the local pool addressed by the current Base URL and are hidden when a third-party endpoint is configured.
|
|
245
|
+
|
|
246
|
+
## License and third-party code
|
|
247
|
+
|
|
248
|
+
Original code in this repository is distributed under the [MIT License](./LICENSE). The bundled account-pool server comes from these upstream projects:
|
|
249
|
+
|
|
250
|
+
| Layer | Project |
|
|
251
|
+
| --- | --- |
|
|
252
|
+
| Upstream backend | [basketikun/chatgpt2api](https://github.com/basketikun/chatgpt2api) (`VERSION` = 1.8.0) |
|
|
253
|
+
| DSH plugin wrapper | [yang0/chatgpt2api-dsh](https://github.com/yang0/chatgpt2api-dsh) |
|
|
254
|
+
| This repository | `vendor/chatgpt2api/`, backend source snapshot only |
|
|
255
|
+
|
|
256
|
+
The snapshot is distributed under MIT, Copyright (c) 2026 kunkun; see `vendor/chatgpt2api/source/LICENSE`. It includes two patches (persistent round-robin cursor, exclusion of rate-limited accounts) and contains no accounts, keys or proxy settings.
|
|
257
|
+
|
|
258
|
+
The upstream project states additional restrictions on use; read them there. This repository ships no accounts.
|
package/README.md
CHANGED
|
@@ -1,3 +1,261 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Bluxe手绘工坊 · 生图工作台
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](./README.en.md) · 简体中文 · [MIT License](./LICENSE)
|
|
4
|
+
|
|
5
|
+
面向 DeepSeek Harness(DSH)桌面端的图像生成工作台插件。插件以单一分发包提供 Web 工作台、FastAPI 后端服务与账号池运行时,在 DSH 侧栏中承载图文与摄影两类提示词生成流程。图像接口默认指向插件内置的本地账号池,亦可配置为任意 OpenAI 兼容服务。
|
|
6
|
+
|
|
7
|
+
后端服务可脱离 DSH 独立运行,默认通过浏览器访问 `http://127.0.0.1:8092/`。
|
|
8
|
+
|
|
9
|
+
> 本仓库仅包含源代码及内置的图型、风格、版式与配色定义。生成的图片、历史记录、草稿、账号凭据、API Key 与代理配置等运行时数据均不纳入版本管理。
|
|
10
|
+
|
|
11
|
+
## 目录
|
|
12
|
+
|
|
13
|
+
- [功能特性](#功能特性)
|
|
14
|
+
- [系统架构](#系统架构)
|
|
15
|
+
- [运行环境](#运行环境)
|
|
16
|
+
- [安装](#安装)
|
|
17
|
+
- [首次启动](#首次启动)
|
|
18
|
+
- [接口接入与账号管理](#接口接入与账号管理)
|
|
19
|
+
- [独立运行](#独立运行)
|
|
20
|
+
- [HTTP 接口](#http-接口)
|
|
21
|
+
- [数据与隐私](#数据与隐私)
|
|
22
|
+
- [故障排查](#故障排查)
|
|
23
|
+
- [维护与卸载](#维护与卸载)
|
|
24
|
+
- [许可与第三方代码](#许可与第三方代码)
|
|
25
|
+
|
|
26
|
+
## 功能特性
|
|
27
|
+
|
|
28
|
+
| 能力 | 说明 |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| 双模式提示词 | 图文与摄影两条生成路径,可组合图型、风格、配色与版式;内置 `server/catalog.json`,含 368 项风格、170 项版式、36 项配色 |
|
|
31
|
+
| 参考图输入 | 支持上传或拖入参考图,经 `/v1/images/edits` 提交;接口不支持时可关闭该能力 |
|
|
32
|
+
| 批量生成 | 批量导入分镜并排队执行。单张失败后自动切换账号重试(最多 3 轮),任务不因局部失败而中断 |
|
|
33
|
+
| 画幅比例 | `1:1`、`3:4`、`2:3`、`9:16`、`4:3`、`3:2`、`16:9`,以及 `2.35:1` 公众号封面。上游无对应原生尺寸时,先按最宽尺寸出图,再在本地居中裁剪 |
|
|
34
|
+
| 结果管理 | 生成历史、草稿箱、单张重做、ZIP 打包下载、缩略图与预览派生图、任务完成提醒 |
|
|
35
|
+
| 运行监控 | 账号总数、可用数、配额、按账号统计的失败记录与任务队列状态;可一键停止当前生图任务 |
|
|
36
|
+
| 接口与账号池 | 复制接口地址与本地 API Key;启动、停止、重启账号池并配置掉线自动拉起;导入账号(自动跳过人工剔除过的)、停用与删除账号、轮换密钥 |
|
|
37
|
+
| 自定义项 | 工作台名称、图片保存目录、接口名称、模型名、返回格式与监控模式 |
|
|
38
|
+
|
|
39
|
+
## 系统架构
|
|
40
|
+
|
|
41
|
+
```mermaid
|
|
42
|
+
flowchart LR
|
|
43
|
+
U["DSH 侧栏 / 浏览器"] --> W["工作台后端 FastAPI(默认 :8092)"]
|
|
44
|
+
H["DSH 宿主进程 host.js"] -. 启动与守护 .-> W
|
|
45
|
+
V["vendor/chatgpt2api 源码与运行时"] -. 首次初始化 .-> P
|
|
46
|
+
W --> P["内置账号池(默认 :38651)"]
|
|
47
|
+
P --> UP["上游图像服务"]
|
|
48
|
+
W -. 可选配置 .-> API["第三方 OpenAI 兼容接口"]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
| 组件 | 职责 |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| `host.js` / `client.js` | DSH 宿主侧入口:启动并守护 8092 端口、渲染侧栏面板、提供状态指示 |
|
|
54
|
+
| `install.mjs` | 幂等安装器:注册 profile、同步后端代码、卸载时清理注册项 |
|
|
55
|
+
| `cordis.patch.yml` | DSH loader 配置:服务端口、守护开关与探测间隔 |
|
|
56
|
+
| `server/` | 工作台后端代码、静态界面与图型风格定义 |
|
|
57
|
+
| `vendor/chatgpt2api/` | 账号池服务端源码快照、`uv` 运行时、清洗后的默认配置及原始许可证 |
|
|
58
|
+
| `scripts/vendor-snapshot.py` | 重新生成 `vendor/` 源码快照 |
|
|
59
|
+
|
|
60
|
+
账号池的进程生命周期由 `server/pool_service.py` 统一管理,DSH 宿主进程仅负责 8092 端口的工作台后端。账号池运行时随插件分发,不依赖外部账号池插件。
|
|
61
|
+
|
|
62
|
+
## 运行环境
|
|
63
|
+
|
|
64
|
+
| 项目 | 要求 |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| DSH 桌面端 | 已在 `desktop` profile 验证;DSH 为可选依赖,参见[独立运行](#独立运行) |
|
|
67
|
+
| Node.js | 20 及以上,用于执行 `install.mjs` 与 `host.js` |
|
|
68
|
+
| Python | 3.13。插件内置 `uv`,首次启动时自动准备运行时与依赖;亦可预装系统 Python 并手动安装 `server/requirements.txt` |
|
|
69
|
+
| 操作系统 | Windows 10 / 11 已完成验证。`vendor/chatgpt2api/runtime/uv.exe` 为 Windows 二进制;Linux 与 macOS 需自备 `uv` 或 Python 3.13 运行环境 |
|
|
70
|
+
| 网络 | 首次初始化需下载 Python 运行时与依赖包;账号池访问上游服务通常需要配置出网代理 |
|
|
71
|
+
|
|
72
|
+
## 安装
|
|
73
|
+
|
|
74
|
+
### 在 DSH 中安装(推荐)
|
|
75
|
+
|
|
76
|
+
打开「插件 → 添加插件」,三种填法任选一种:
|
|
77
|
+
|
|
78
|
+
| 方式 | 填什么 | 说明 |
|
|
79
|
+
| --- | --- | --- |
|
|
80
|
+
| npm 包名(首选) | `dsh-plugin-image-workbench` | 走 CDN,装得快且不会中途断;插件管理器会同时探测 npmjs 与 npmmirror,取先响应的那个 |
|
|
81
|
+
| Gitee 镜像 | `https://gitee.com/guohwa/dsh-plugin-image-workbench.git` | 国内直连,浅克隆实测 9 秒左右 |
|
|
82
|
+
| GitHub 原仓库 | `https://github.com/guohwa/dsh-plugin-image-workbench.git` | 内容源头,国内常卡在 31 MB 的 uv 运行时传输上 |
|
|
83
|
+
|
|
84
|
+
> 填 Git 地址时**结尾必须带 `.git`**。插件管理器调用 pnpm,不带后缀时 pnpm 会把它当作 tarball 链接去抓页面,报 `ERR_PNPM_FETCH_403` 并附一句「No authorization header was set」——那跟权限无关,只是地址形式不对。
|
|
85
|
+
|
|
86
|
+
三处是同源内容:GitHub 上每次 push 和打 tag 会自动镜像到 Gitee,npm 也由 tag 触发发布。插件里带一个约 31 MB 的 uv 运行时,这正是从 GitHub 克隆时最容易超时的那一块,所以国内优先用包名或 Gitee 地址。
|
|
87
|
+
|
|
88
|
+
### 交给 AI Agent 安装(最省事)
|
|
89
|
+
|
|
90
|
+
如果你正在使用支持插件安装指令的 AI 助手(如 WorkBuddy),直接把仓库地址丢给它,说一句就行,不用自己敲命令:
|
|
91
|
+
|
|
92
|
+
> 帮我安装 dsh-plugin-image-workbench 这个 DSH 插件
|
|
93
|
+
|
|
94
|
+
Agent 会自动执行克隆、运行 `node install.mjs` 并完成 profile 注册,装完提示你重启 DSH。整个过程与下方的[从源码安装](#从源码安装)完全一致,只是由 Agent 代为操作;首次初始化、账号导入与代理配置的步骤仍需你按界面提示完成。
|
|
95
|
+
|
|
96
|
+
### 从源码安装
|
|
97
|
+
|
|
98
|
+
适用于开发环境、网络受限或从旧版本迁移:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
git clone https://gitee.com/guohwa/dsh-plugin-image-workbench.git
|
|
102
|
+
cd dsh-plugin-image-workbench
|
|
103
|
+
node install.mjs
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
上游在 GitHub(`https://github.com/guohwa/dsh-plugin-image-workbench.git`),国内直连更推荐上面这条 Gitee 地址,内容与 GitHub 一致。
|
|
107
|
+
|
|
108
|
+
安装器会建立 profile 目录联接、注册 bundle、同步后端代码并清理旧版独立号池插件的加载项,可重复执行;安装完成后多数情况下 DSH 会直接加载新 bundle,侧栏未出现入口时完全退出 DSH 再启动一次。
|
|
109
|
+
|
|
110
|
+
> 安装目录不要移动或删除。profile 中保存的是指向该目录的目录联接,移动后 DSH 将无法解析到插件。需要换位置时,先在原目录执行 `node install.mjs --uninstall`,再在新位置重新安装;安装器也会在重装时自动修正指向旧路径的联接。
|
|
111
|
+
|
|
112
|
+
侧栏入口为「Bluxe手绘工坊 · 生图工作台」,亦可直接访问 `http://127.0.0.1:8092/`。
|
|
113
|
+
|
|
114
|
+
## 首次启动
|
|
115
|
+
|
|
116
|
+
首次启动会自动准备后端与账号池的运行环境,通常 1 分钟内完成,无需手动操作;环境就绪后账号池会自动拉起,也可在「接口与号池 → 本地号池」手动启动。
|
|
117
|
+
|
|
118
|
+
首次启动还会在后台补齐风格、版式与配色的预览样图(共 574 张,约 33 MB,从 CDN 拉取,失败自动换源)。下载完成前,风格库与配色库里显示的是渐变占位块,刷新页面即可看到真图;进度写在 `~/.dsh/image-workbench/samples.log`。样图不进 npm 包,也不参与升级同步,所以只在第一次装好后下一遍。
|
|
119
|
+
|
|
120
|
+
插件以 `node_modules` 形式安装时,后端代码会同步到 `~/.dsh/image-workbench/server`,号池源码快照同步到同级的 `vendor/`,Python 环境、生成图片、账号与历史数据都留在这个目录里。插件包本身保持只读,升级插件不会冲掉环境和图片。用 `link:` 指向源码目录(开发场景)时不复制,直接用源码目录。
|
|
121
|
+
|
|
122
|
+
## 接口接入与账号管理
|
|
123
|
+
|
|
124
|
+
工作台支持两类接入方式:使用你已有的号池或任意第三方 OpenAI 兼容接口(方式 A)、使用本插件内置账号池(方式 B)。首次生成前需完成以下任一配置。
|
|
125
|
+
|
|
126
|
+
### 方式 A:使用自有号池或者第三方接口
|
|
127
|
+
|
|
128
|
+
如果你已经在 DSH 中运行着自己的「ChatGPT2API · 号池」(如默认端口 `38650`),或想接入任意 OpenAI 兼容服务,工作台完全兼容,无需启用本插件内置的 `38651` 号池:
|
|
129
|
+
|
|
130
|
+
1. 在「接口与号池 → 出图接口」中,将 Base URL 填写为你已有号池的 `/v1` 地址(例如 `http://127.0.0.1:38650/v1`),并填入该号池的用户 API Key(在其 `user-api-keys.json` 中可查)。
|
|
131
|
+
2. 出图与参考图重写均通过标准 OpenAI 兼容协议(`/v1/images/generations`、`/v1/images/edits`)提交,你的号池原生支持。
|
|
132
|
+
|
|
133
|
+
> 未配置任何号池就点击「出图」时,工作台会明确提示「尚未配置生图号池」,并指引前往「接口与号池」面板填写地址与 Key,而非笼统报错。
|
|
134
|
+
|
|
135
|
+
### 方式 B:使用内置账号池
|
|
136
|
+
|
|
137
|
+
在「接口与号池 → 本地号池」中导入账号。点击文件选择框或拖入 `.txt`、`.json`、`.csv`、`.tsv`、`.log` 等文本文件(可多选),亦可直接粘贴文本内容,然后点击「导入并授权入池」。
|
|
138
|
+
|
|
139
|
+
| 格式 | 说明 |
|
|
140
|
+
| --- | --- |
|
|
141
|
+
| JSON 导出 | `{"accounts":[...]}`、数组或单个对象。保留邮箱、密码等账号资料,便于 token 失效后重新登录,推荐使用该格式 |
|
|
142
|
+
| 五段式发料 | `email----password----client_id----mail_refresh_token----access_token`。邮箱 Client ID 与邮箱刷新令牌随账号留档,不会被当作号池的 `refresh_token` 使用 |
|
|
143
|
+
| 纯文本 token | 每行一个 `access_token`(`eyJ` 开头的长字符串) |
|
|
144
|
+
| 传统导出行 | `email,password,token` 或 `email----password----token` |
|
|
145
|
+
|
|
146
|
+
仅包含邮箱、密码与 2FA 密钥而不含 `access_token` 的条目不在支持范围内,本版本号池不执行登录换取 token 的操作。导入完成后,按网络环境配置出网代理,并确认面板显示在线状态。
|
|
147
|
+
|
|
148
|
+
> 接口不在内置号池时(例如改指了 `38650`),「本地号池」页会出现「↩ 切回内置池」按钮,一次完成改地址、对齐密钥与启动;外部号池的账号和进程都不受影响。
|
|
149
|
+
|
|
150
|
+
### 出网代理配置
|
|
151
|
+
|
|
152
|
+
内置账号池需要访问上游图像服务(OpenAI / ChatGPT)。不受限网络可以留空直连;受限网络按下述方式配置。面板里显示的地址永远是本机实际探测结果,不是写死的示例。
|
|
153
|
+
|
|
154
|
+
- **自动反显**:「接口与号池 → 本地号池 → 号池出口代理」显示的是本机当前在用的代理。检测顺序为先读 `HTTPS_PROXY` 等环境变量(宿主和工具链注入的临时回环代理会被忽略),再扫本机常见端口:1080(SOCKS5 / HTTP 都试)、7890、7891、8118、1087。换电脑、换代理端口,显示会跟着变。
|
|
155
|
+
- **自动校准**:号池启动时校准一次。已保存的地址在本机还能连通就保留;已经连不上(换了机器、端口关了、客户端退出)则重新探测并覆盖;没探测到就回退直连。
|
|
156
|
+
- **手动填写 / 一键切换**:也可以直接在输入框里填自己的地址,点「保存代理」立即做连通性校验,不通会指出是哪个地址连不上,通过后自动重拉账号额度。已保存的地址在本机不可用时,面板标出「本机连不上」并给出「改用 <地址>」按钮。
|
|
157
|
+
- **环境变量**:启动前设置 `CHATGPT2API_PROXY_RUNTIME_PROXY_URL`(如 `socks5://127.0.0.1:1080`),号池初始化时优先采用。
|
|
158
|
+
|
|
159
|
+
配置代理后,号池经该出口访问上游,生成任务方可成功;未配置且网络受限时,表现为面板在线但生成失败、日志提示连接超时,账号额度会一直停在 0(界面显示为「已用完」)。
|
|
160
|
+
|
|
161
|
+
## 独立运行
|
|
162
|
+
|
|
163
|
+
后端服务可自行启动并守护账号池,因此无需 DSH 亦可运行:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
cd server
|
|
167
|
+
python -m venv .venv
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Windows
|
|
172
|
+
.venv/Scripts/pip install -r requirements.txt
|
|
173
|
+
.venv/Scripts/python -m uvicorn app:app --host 127.0.0.1 --port 8092
|
|
174
|
+
|
|
175
|
+
# Linux / macOS
|
|
176
|
+
# .venv/bin/pip install -r requirements.txt
|
|
177
|
+
# .venv/bin/python -m uvicorn app:app --host 127.0.0.1 --port 8092
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
账号池运行时仍由 `pool_service.py` 从插件的 `vendor/` 目录释放。Linux 与 macOS 环境若无可用 `uv`,需预先准备账号池的 Python 3.13 运行环境。启动后访问 `http://127.0.0.1:8092/`。
|
|
181
|
+
|
|
182
|
+
## HTTP 接口
|
|
183
|
+
|
|
184
|
+
后端主要路由如下,完整定义见 `server/app.py`。
|
|
185
|
+
|
|
186
|
+
| 路由 | 方法 | 用途 |
|
|
187
|
+
| --- | --- | --- |
|
|
188
|
+
| `/health` | GET | 后端存活探测 |
|
|
189
|
+
| `/api/catalog` | GET | 图型、风格、版式与配色定义 |
|
|
190
|
+
| `/api/config`、`/api/config/test` | GET / POST | 配置读取、更新与连通性测试 |
|
|
191
|
+
| `/api/compose` | POST | 提示词合成 |
|
|
192
|
+
| `/api/generate` | POST | 提交图像生成任务 |
|
|
193
|
+
| `/api/generate/stop` | POST | 中断在途请求、清空排队并停止换号重试 |
|
|
194
|
+
| `/api/tasks/{task_id}` | GET | 查询任务状态 |
|
|
195
|
+
| `/api/history`、`/api/drafts` | GET / POST / DELETE | 生成历史与草稿 |
|
|
196
|
+
| `/api/monitor` | GET | 运行监控数据 |
|
|
197
|
+
| `/api/pool/panel` | GET | 账号与密钥概览 |
|
|
198
|
+
| `/api/pool/proxy`、`/proxy/test` | GET / POST | 读取、保存与测试号池出口代理(受限网络必填,默认直连) |
|
|
199
|
+
| `/api/pool/accounts/import`、`/delete`、`/status` | POST | 账号导入、删除与启停 |
|
|
200
|
+
| `/api/pool/key/ensure` | POST | 重新签发用户 API Key |
|
|
201
|
+
| `/api/pool/service` | GET | 账号池进程状态 |
|
|
202
|
+
| `/api/pool/service/start`、`/stop`、`/restart`、`/auto` | POST | 进程控制与自动拉起开关 |
|
|
203
|
+
|
|
204
|
+
## 数据与隐私
|
|
205
|
+
|
|
206
|
+
- `.gitignore` 明确排除 `images/`、`refs/`、`thumbs/`、`workbench/`、`*.db`、`history.json`、`drafts.json`、`config.local.json`、`user-api-keys.json`、`admin-key`、`*.log` 及全部 `*.bak_*` 备份文件。
|
|
207
|
+
- 运行时产物均保留在本机:图片、历史与草稿位于 `server/` 下,账号与密钥位于账号池数据目录。
|
|
208
|
+
- 两个服务默认仅监听 `127.0.0.1`,后端鉴权层为本地版空实现。**请勿将 8092 或 38651 直接暴露至公网或共享网络**;如需远程访问,应自行配置反向代理与身份认证。
|
|
209
|
+
- 账号池会持有导入的账号凭据,不应同步其数据目录至任何公开位置。
|
|
210
|
+
|
|
211
|
+
## 故障排查
|
|
212
|
+
|
|
213
|
+
| 现象 | 处理方式 |
|
|
214
|
+
| --- | --- |
|
|
215
|
+
| 侧栏未出现入口 | bundle 仅在 DSH 启动时加载,完全退出 DSH 再启动 |
|
|
216
|
+
| 插件管理器提示连接 GitHub 超时 | 换成 Gitee 地址 `https://gitee.com/guohwa/dsh-plugin-image-workbench.git`(**带 `.git`**),国内直连 |
|
|
217
|
+
| 安装报 `ERR_PNPM_EPERM ... rename '...dsh-plugin-image-workbench_tmp_...'` | 上一个版本还在运行,后端进程把插件目录锁住了,Windows 不允许重命名。完全退出 DSH(托盘菜单 → 退出),在任务管理器结束残留的 `python.exe`,删掉 `node_modules\dsh-plugin-image-workbench` 后重装。1.1.4 起装在 `node_modules` 里时运行时会自动搬到 `~/.dsh/image-workbench`,不再出现 |
|
|
218
|
+
| 移动过插件目录后代码不再生效 | 重跑 `node install.mjs`,安装器会把目录联接重建到当前路径 |
|
|
219
|
+
| 提示「工作台后端未运行」 | 面板会直接显示原因:多为本机没有 Python 3.10+ 且自动下载失败。装一个 Python 3.13 后点「立即启动并重试」;有代理时插件会自动识别并使用 |
|
|
220
|
+
| 装依赖时报 `fastapi was not found in the package registry`,或提示镜像返回 403 | 代理把镜像站拦了。插件会自动换源(镜像直连 → 官方 PyPI 走代理 → 官方直连);仍失败时可用 `DSH_IMAGE_PYPI_INDEX` 指定一个能直连的源 |
|
|
221
|
+
| 反复提示 `No module named uvicorn` | 上一轮装依赖失败留下的空环境。1.1.2 起会自动识别并补装;旧版本可手动删掉 `server/.venv` 后重启 DSH |
|
|
222
|
+
| 提示内置账号池未就绪 | 在「接口与号池 → 本地号池」执行启动;首次运行需等待环境初始化完成 |
|
|
223
|
+
| 账号额度一直是 0、显示「已用完」 | 出口代理没生效或端口填错。到「本地号池 → 号池出口代理」重新填写并保存,保存时会校验连通性;校验通过后额度会自动重算 |
|
|
224
|
+
| 生成请求返回 401 | 在面板中重新签发 API Key,或核对第三方接口的密钥 |
|
|
225
|
+
| 账号池在线但生成失败 | 通常为出网代理未配置或账号额度耗尽;检查 `source/config.json` 中的代理设置与 `pool-service.log` |
|
|
226
|
+
| 修改宿主侧代码或 profile 配置 | 需重启 DSH;仅修改静态界面资源时刷新浏览器缓存即可 |
|
|
227
|
+
| 侧栏仍显示旧版账号池入口 | 安装器已清理其加载清单注册项,重启 DSH 后移除 |
|
|
228
|
+
|
|
229
|
+
## 维护与卸载
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
# 修改本机账号池源码后重新生成 vendor 快照,不包含账号与密钥
|
|
233
|
+
python scripts/vendor-snapshot.py
|
|
234
|
+
|
|
235
|
+
# 后端接口冒烟测试,使用已安装依赖的 Python 执行
|
|
236
|
+
cd server && python smoke_check.py --quick
|
|
237
|
+
|
|
238
|
+
# 更新:把新版本源码覆盖到原目录(或用 Git 拉取),再重跑安装器
|
|
239
|
+
node install.mjs
|
|
240
|
+
|
|
241
|
+
# 从 profile 摘除插件并断开目录联接,重启 DSH 生效
|
|
242
|
+
node install.mjs --uninstall
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
卸载只移除 profile 注册项与目录联接,插件源码目录、`~/.dsh/chatgpt2api-image` 中的账号数据与生成结果均保留,确认不再需要时可自行删除。
|
|
246
|
+
|
|
247
|
+
账号池采用严格轮询选号,并排除处于限流状态的账号;单账号失败会在监控中记录,不会中断批量任务。进程启动、停止、重启与自动拉起控件仅作用于当前 Base URL 指向的本机账号池,配置第三方接口时隐藏。
|
|
248
|
+
|
|
249
|
+
## 许可与第三方代码
|
|
250
|
+
|
|
251
|
+
本仓库自研代码采用 [MIT License](./LICENSE)。内置账号池的服务端代码来自以下上游项目:
|
|
252
|
+
|
|
253
|
+
| 层级 | 项目 |
|
|
254
|
+
| --- | --- |
|
|
255
|
+
| 后端上游 | [basketikun/chatgpt2api](https://github.com/basketikun/chatgpt2api)(`VERSION` = 1.8.0) |
|
|
256
|
+
| DSH 插件封装 | [yang0/chatgpt2api-dsh](https://github.com/yang0/chatgpt2api-dsh) |
|
|
257
|
+
| 本仓库 | `vendor/chatgpt2api/`,仅后端源码快照 |
|
|
258
|
+
|
|
259
|
+
快照依 MIT 分发,Copyright (c) 2026 kunkun,许可证原文见 `vendor/chatgpt2api/source/LICENSE`;含轮询游标持久化与限流账号排除两处补丁,不含账号、密钥与代理配置。
|
|
260
|
+
|
|
261
|
+
上游项目对其使用范围另有声明,请自行阅读。本仓库不提供账号。
|