@dickpy/dsh-imagegen 1.0.6 → 1.0.9
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.md +9 -5
- package/lib/client.js +748 -105
- package/lib/client.js.map +1 -1
- package/lib/index.js +359 -5
- package/package.json +13 -12
- package/src/client/ImageGenPanel.tsx +25 -0
- package/src/client/TemplateLibrary.tsx +336 -0
- package/src/client/api.ts +21 -1
- package/src/client/index.ts +126 -127
- package/src/client/locales.ts +56 -0
- package/src/client/panel.module.css +36 -1
- package/src/client/templates.module.css +453 -0
- package/src/index.ts +2 -1
- package/src/protocol.ts +59 -1
- package/src/routes.ts +73 -1
- package/src/templates/cases.json +10196 -0
- package/src/templates-store.ts +278 -0
package/src/client/locales.ts
CHANGED
|
@@ -122,6 +122,34 @@ export const zh = {
|
|
|
122
122
|
'settings.overridden': '已覆盖',
|
|
123
123
|
'settings.reset': '重置',
|
|
124
124
|
'settings.invalidNumber': '请输入有效数字',
|
|
125
|
+
// template library
|
|
126
|
+
'templates.open': '模板库',
|
|
127
|
+
'templates.title': '提示词模板库',
|
|
128
|
+
'templates.meta': '共 {count} 个模板 · {origin}',
|
|
129
|
+
'templates.origin.bundled': '内置快照',
|
|
130
|
+
'templates.origin.refreshed': '在线刷新',
|
|
131
|
+
'templates.search': '搜索模板标题或提示词…',
|
|
132
|
+
'templates.all': '全部',
|
|
133
|
+
'templates.close': '关闭',
|
|
134
|
+
'templates.back': '返回列表',
|
|
135
|
+
'templates.use': '使用此提示词',
|
|
136
|
+
'templates.copy': '复制提示词',
|
|
137
|
+
'templates.copied': '已复制',
|
|
138
|
+
'templates.refresh': '刷新模板库',
|
|
139
|
+
'templates.refreshing': '刷新中…',
|
|
140
|
+
'templates.refreshed': '已刷新,共 {count} 个模板',
|
|
141
|
+
'templates.refreshFailed': '刷新失败:{error}',
|
|
142
|
+
'templates.cacheAll': '缓存全部图片',
|
|
143
|
+
'templates.cacheAllHint': '通过本机代理把全部参考图缓存到本地磁盘,之后离线也能浏览',
|
|
144
|
+
'templates.caching': '缓存中 {done}/{total}…',
|
|
145
|
+
'templates.cached': '图片已全部缓存',
|
|
146
|
+
'templates.empty': '没有匹配的模板',
|
|
147
|
+
'templates.loading': '正在加载模板库…',
|
|
148
|
+
'templates.loadFailed': '模板库加载失败:{error}',
|
|
149
|
+
'templates.retry': '重试',
|
|
150
|
+
'templates.attribution': '模板与图片来自 awesome-gpt-image-2 项目,作者链接见各模板详情',
|
|
151
|
+
'templates.source': '来源:vibeui.top',
|
|
152
|
+
'templates.featured': '精选',
|
|
125
153
|
} as const
|
|
126
154
|
|
|
127
155
|
export const en: Record<keyof typeof zh, string> = {
|
|
@@ -233,6 +261,34 @@ export const en: Record<keyof typeof zh, string> = {
|
|
|
233
261
|
'settings.overridden': 'Overridden',
|
|
234
262
|
'settings.reset': 'Reset',
|
|
235
263
|
'settings.invalidNumber': 'Enter a valid number',
|
|
264
|
+
// template library
|
|
265
|
+
'templates.open': 'Templates',
|
|
266
|
+
'templates.title': 'Prompt Template Library',
|
|
267
|
+
'templates.meta': '{count} templates · {origin}',
|
|
268
|
+
'templates.origin.bundled': 'bundled snapshot',
|
|
269
|
+
'templates.origin.refreshed': 'refreshed online',
|
|
270
|
+
'templates.search': 'Search template titles or prompts…',
|
|
271
|
+
'templates.all': 'All',
|
|
272
|
+
'templates.close': 'Close',
|
|
273
|
+
'templates.back': 'Back to list',
|
|
274
|
+
'templates.use': 'Use this prompt',
|
|
275
|
+
'templates.copy': 'Copy prompt',
|
|
276
|
+
'templates.copied': 'Copied',
|
|
277
|
+
'templates.refresh': 'Refresh library',
|
|
278
|
+
'templates.refreshing': 'Refreshing…',
|
|
279
|
+
'templates.refreshed': 'Refreshed — {count} templates',
|
|
280
|
+
'templates.refreshFailed': 'Refresh failed: {error}',
|
|
281
|
+
'templates.cacheAll': 'Cache all images',
|
|
282
|
+
'templates.cacheAllHint': 'Mirror every reference image to local disk through the host proxy, for offline browsing',
|
|
283
|
+
'templates.caching': 'Caching {done}/{total}…',
|
|
284
|
+
'templates.cached': 'All images cached',
|
|
285
|
+
'templates.empty': 'No matching templates',
|
|
286
|
+
'templates.loading': 'Loading the template library…',
|
|
287
|
+
'templates.loadFailed': 'Failed to load the library: {error}',
|
|
288
|
+
'templates.retry': 'Retry',
|
|
289
|
+
'templates.attribution': 'Templates and images come from the awesome-gpt-image-2 project; author links are on each template',
|
|
290
|
+
'templates.source': 'Source: vibeui.top',
|
|
291
|
+
'templates.featured': 'Featured',
|
|
236
292
|
}
|
|
237
293
|
|
|
238
294
|
/** Locale key union. */
|
|
@@ -606,10 +606,45 @@ html[data-dsh-imagegen-active]:not([data-dsh-taskboard-active]):not([data-dsh-ss
|
|
|
606
606
|
|
|
607
607
|
.promptFooter {
|
|
608
608
|
display: flex;
|
|
609
|
-
|
|
609
|
+
align-items: center;
|
|
610
|
+
justify-content: space-between;
|
|
611
|
+
gap: 8px;
|
|
610
612
|
margin-top: -6px;
|
|
611
613
|
}
|
|
612
614
|
|
|
615
|
+
.templatesButton {
|
|
616
|
+
display: inline-flex;
|
|
617
|
+
align-items: center;
|
|
618
|
+
gap: 6px;
|
|
619
|
+
height: 26px;
|
|
620
|
+
padding: 0 12px;
|
|
621
|
+
border: 1px solid var(--dsw-alias-brand-primary);
|
|
622
|
+
border-radius: 999px;
|
|
623
|
+
background: linear-gradient(135deg, color-mix(in srgb, var(--dsw-alias-brand-primary) 14%, transparent), color-mix(in srgb, var(--dsw-alias-brand-primary) 5%, transparent));
|
|
624
|
+
color: var(--dsw-alias-brand-primary);
|
|
625
|
+
font-size: 12px;
|
|
626
|
+
font-weight: 600;
|
|
627
|
+
font-family: inherit;
|
|
628
|
+
cursor: pointer;
|
|
629
|
+
box-shadow: 0 1px 0 color-mix(in srgb, var(--dsw-alias-brand-primary) 22%, transparent);
|
|
630
|
+
transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
.templatesButton svg {
|
|
634
|
+
flex: none;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
.templatesButton:hover {
|
|
638
|
+
background: linear-gradient(135deg, color-mix(in srgb, var(--dsw-alias-brand-primary) 24%, transparent), color-mix(in srgb, var(--dsw-alias-brand-primary) 8%, transparent));
|
|
639
|
+
color: var(--dsw-alias-brand-primary);
|
|
640
|
+
transform: translateY(-1px);
|
|
641
|
+
box-shadow: 0 2px 6px color-mix(in srgb, var(--dsw-alias-brand-primary) 30%, transparent);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
.templatesButton:active {
|
|
645
|
+
transform: translateY(0);
|
|
646
|
+
}
|
|
647
|
+
|
|
613
648
|
.promptCount {
|
|
614
649
|
font-size: 11px;
|
|
615
650
|
color: var(--dsw-alias-label-tertiary);
|
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt-template library styles. Same conventions as panel.module.css:
|
|
3
|
+
* scoped box-sizing, dsh --dsw-* tokens, no leakage outside the overlay
|
|
4
|
+
* subtree.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
.overlay,
|
|
8
|
+
.overlay *,
|
|
9
|
+
.overlay *::before,
|
|
10
|
+
.overlay *::after {
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.overlay {
|
|
15
|
+
position: fixed;
|
|
16
|
+
inset: 0;
|
|
17
|
+
z-index: 130;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
padding: 28px;
|
|
22
|
+
background: var(--dsw-alias-bg-mask-1);
|
|
23
|
+
color: var(--dsw-alias-label-primary);
|
|
24
|
+
font-family: var(--dsw-font-family);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.shell {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
width: min(1180px, 100%);
|
|
31
|
+
height: 100%;
|
|
32
|
+
max-height: 100%;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
border: 1px solid var(--dsw-alias-border-l1);
|
|
35
|
+
border-radius: 14px;
|
|
36
|
+
background: var(--dsw-alias-bg-base);
|
|
37
|
+
box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* --- header ------------------------------------------------------------ */
|
|
41
|
+
|
|
42
|
+
.header {
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: space-between;
|
|
46
|
+
gap: 12px;
|
|
47
|
+
padding: 14px 18px 10px;
|
|
48
|
+
flex: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.heading {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: baseline;
|
|
54
|
+
gap: 10px;
|
|
55
|
+
min-width: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.title {
|
|
59
|
+
margin: 0;
|
|
60
|
+
font-size: 15px;
|
|
61
|
+
font-weight: 650;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.meta {
|
|
65
|
+
font-size: 12px;
|
|
66
|
+
color: var(--dsw-alias-label-tertiary);
|
|
67
|
+
white-space: nowrap;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.headerActions {
|
|
71
|
+
display: inline-flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
gap: 8px;
|
|
74
|
+
flex: none;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.close {
|
|
78
|
+
display: inline-flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
width: 28px;
|
|
82
|
+
height: 28px;
|
|
83
|
+
border: none;
|
|
84
|
+
border-radius: 8px;
|
|
85
|
+
background: transparent;
|
|
86
|
+
color: var(--dsw-alias-label-secondary);
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.close:hover {
|
|
91
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
92
|
+
color: var(--dsw-alias-label-primary);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* --- toolbar ----------------------------------------------------------- */
|
|
96
|
+
|
|
97
|
+
.toolbar {
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
gap: 10px;
|
|
101
|
+
padding: 0 18px 12px;
|
|
102
|
+
flex: none;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.search {
|
|
106
|
+
width: 100%;
|
|
107
|
+
height: 34px;
|
|
108
|
+
padding: 0 12px;
|
|
109
|
+
border: 1px solid var(--dsw-alias-border-l1);
|
|
110
|
+
border-radius: 9px;
|
|
111
|
+
background: var(--dsw-alias-bg-layer-1);
|
|
112
|
+
color: var(--dsw-alias-label-primary);
|
|
113
|
+
font-size: 13px;
|
|
114
|
+
font-family: inherit;
|
|
115
|
+
outline: none;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.search:focus {
|
|
119
|
+
border-color: var(--dsw-alias-brand-primary);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.search::placeholder {
|
|
123
|
+
color: var(--dsw-alias-label-dimmed);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.categoryRow {
|
|
127
|
+
display: flex;
|
|
128
|
+
flex-wrap: wrap;
|
|
129
|
+
gap: 6px;
|
|
130
|
+
max-height: 64px;
|
|
131
|
+
overflow-y: auto;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.categoryPill {
|
|
135
|
+
height: 26px;
|
|
136
|
+
padding: 0 11px;
|
|
137
|
+
border: 1px solid var(--dsw-alias-border-l1);
|
|
138
|
+
border-radius: 999px;
|
|
139
|
+
background: var(--dsw-alias-bg-layer-1);
|
|
140
|
+
color: var(--dsw-alias-label-secondary);
|
|
141
|
+
font-size: 12px;
|
|
142
|
+
font-family: inherit;
|
|
143
|
+
cursor: pointer;
|
|
144
|
+
white-space: nowrap;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.categoryPill:hover {
|
|
148
|
+
color: var(--dsw-alias-label-primary);
|
|
149
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.categoryPill[data-active] {
|
|
153
|
+
border-color: var(--dsw-alias-brand-primary);
|
|
154
|
+
background: var(--dsw-alias-brand-primary);
|
|
155
|
+
color: var(--dsw-alias-bg-base);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.notice {
|
|
159
|
+
margin: 0 18px 10px;
|
|
160
|
+
padding: 8px 12px;
|
|
161
|
+
border: 1px solid var(--dsw-alias-border-l1);
|
|
162
|
+
border-radius: 9px;
|
|
163
|
+
background: var(--dsw-alias-bg-layer-1);
|
|
164
|
+
color: var(--dsw-alias-label-secondary);
|
|
165
|
+
font-size: 12px;
|
|
166
|
+
flex: none;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* --- body / grid -------------------------------------------------------- */
|
|
170
|
+
|
|
171
|
+
.body {
|
|
172
|
+
flex: 1;
|
|
173
|
+
min-height: 0;
|
|
174
|
+
overflow-y: auto;
|
|
175
|
+
padding: 2px 18px 14px;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.state {
|
|
179
|
+
display: flex;
|
|
180
|
+
flex-direction: column;
|
|
181
|
+
align-items: center;
|
|
182
|
+
justify-content: center;
|
|
183
|
+
gap: 12px;
|
|
184
|
+
height: 100%;
|
|
185
|
+
min-height: 220px;
|
|
186
|
+
color: var(--dsw-alias-label-tertiary);
|
|
187
|
+
font-size: 13px;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.spinner {
|
|
191
|
+
width: 26px;
|
|
192
|
+
height: 26px;
|
|
193
|
+
border: 2px solid var(--dsw-alias-border-l2);
|
|
194
|
+
border-top-color: var(--dsw-alias-brand-primary);
|
|
195
|
+
border-radius: 50%;
|
|
196
|
+
animation: dsh-imagegen-templates-spin 0.9s linear infinite;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
@keyframes dsh-imagegen-templates-spin {
|
|
200
|
+
to { transform: rotate(360deg); }
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.grid {
|
|
204
|
+
display: grid;
|
|
205
|
+
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
|
206
|
+
gap: 12px;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.card {
|
|
210
|
+
display: flex;
|
|
211
|
+
flex-direction: column;
|
|
212
|
+
gap: 0;
|
|
213
|
+
padding: 0;
|
|
214
|
+
overflow: hidden;
|
|
215
|
+
border: 1px solid var(--dsw-alias-border-l1);
|
|
216
|
+
border-radius: 11px;
|
|
217
|
+
background: var(--dsw-alias-bg-layer-1);
|
|
218
|
+
cursor: pointer;
|
|
219
|
+
text-align: left;
|
|
220
|
+
font-family: inherit;
|
|
221
|
+
color: var(--dsw-alias-label-primary);
|
|
222
|
+
transition: border-color 0.15s ease, transform 0.15s ease;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.card:hover {
|
|
226
|
+
border-color: var(--dsw-alias-brand-primary);
|
|
227
|
+
transform: translateY(-1px);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.thumbWrap {
|
|
231
|
+
position: relative;
|
|
232
|
+
display: block;
|
|
233
|
+
width: 100%;
|
|
234
|
+
aspect-ratio: 1 / 1;
|
|
235
|
+
background: var(--dsw-alias-bg-layer-2);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.thumb {
|
|
239
|
+
display: block;
|
|
240
|
+
width: 100%;
|
|
241
|
+
height: 100%;
|
|
242
|
+
object-fit: cover;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.thumbPlaceholder {
|
|
246
|
+
display: flex;
|
|
247
|
+
align-items: center;
|
|
248
|
+
justify-content: center;
|
|
249
|
+
width: 100%;
|
|
250
|
+
height: 100%;
|
|
251
|
+
color: var(--dsw-alias-label-dimmed);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.featuredBadge {
|
|
255
|
+
position: absolute;
|
|
256
|
+
top: 8px;
|
|
257
|
+
left: 8px;
|
|
258
|
+
padding: 2px 8px;
|
|
259
|
+
border-radius: 999px;
|
|
260
|
+
background: var(--dsw-alias-brand-primary);
|
|
261
|
+
color: var(--dsw-alias-bg-base);
|
|
262
|
+
font-size: 11px;
|
|
263
|
+
font-weight: 600;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.cardBody {
|
|
267
|
+
display: flex;
|
|
268
|
+
flex-direction: column;
|
|
269
|
+
gap: 4px;
|
|
270
|
+
padding: 9px 11px 10px;
|
|
271
|
+
min-width: 0;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.cardTitle {
|
|
275
|
+
font-size: 12.5px;
|
|
276
|
+
font-weight: 600;
|
|
277
|
+
line-height: 1.35;
|
|
278
|
+
display: -webkit-box;
|
|
279
|
+
-webkit-line-clamp: 2;
|
|
280
|
+
-webkit-box-orient: vertical;
|
|
281
|
+
overflow: hidden;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.cardMeta {
|
|
285
|
+
display: flex;
|
|
286
|
+
align-items: center;
|
|
287
|
+
gap: 6px;
|
|
288
|
+
min-width: 0;
|
|
289
|
+
font-size: 11px;
|
|
290
|
+
color: var(--dsw-alias-label-tertiary);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.cardCategory {
|
|
294
|
+
flex: none;
|
|
295
|
+
padding: 1px 7px;
|
|
296
|
+
border-radius: 999px;
|
|
297
|
+
background: var(--dsw-alias-bg-layer-2);
|
|
298
|
+
color: var(--dsw-alias-label-secondary);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.cardSource {
|
|
302
|
+
overflow: hidden;
|
|
303
|
+
text-overflow: ellipsis;
|
|
304
|
+
white-space: nowrap;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/* --- footer ------------------------------------------------------------- */
|
|
308
|
+
|
|
309
|
+
.footer {
|
|
310
|
+
flex: none;
|
|
311
|
+
display: flex;
|
|
312
|
+
align-items: center;
|
|
313
|
+
justify-content: space-between;
|
|
314
|
+
gap: 10px;
|
|
315
|
+
padding: 9px 18px;
|
|
316
|
+
border-top: 1px solid var(--dsw-alias-border-l1);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.attribution {
|
|
320
|
+
font-size: 11.5px;
|
|
321
|
+
color: var(--dsw-alias-label-dimmed);
|
|
322
|
+
min-width: 0;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.sourceLink {
|
|
326
|
+
flex: none;
|
|
327
|
+
font-size: 11.5px;
|
|
328
|
+
font-weight: 600;
|
|
329
|
+
color: var(--dsw-alias-brand-primary);
|
|
330
|
+
text-decoration: none;
|
|
331
|
+
white-space: nowrap;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.sourceLink:hover {
|
|
335
|
+
text-decoration: underline;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/* --- detail overlay ----------------------------------------------------- */
|
|
339
|
+
|
|
340
|
+
.detailOverlay {
|
|
341
|
+
position: absolute;
|
|
342
|
+
inset: 0;
|
|
343
|
+
display: flex;
|
|
344
|
+
align-items: center;
|
|
345
|
+
justify-content: center;
|
|
346
|
+
padding: 34px;
|
|
347
|
+
background: var(--dsw-alias-bg-mask-1);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.detail {
|
|
351
|
+
display: grid;
|
|
352
|
+
grid-template-columns: minmax(0, 5fr) minmax(0, 4fr);
|
|
353
|
+
grid-template-rows: minmax(0, 1fr);
|
|
354
|
+
gap: 0;
|
|
355
|
+
width: min(980px, 100%);
|
|
356
|
+
max-height: 100%;
|
|
357
|
+
overflow: hidden;
|
|
358
|
+
border: 1px solid var(--dsw-alias-border-l1);
|
|
359
|
+
border-radius: 14px;
|
|
360
|
+
background: var(--dsw-alias-bg-base);
|
|
361
|
+
box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.detailMedia {
|
|
365
|
+
display: flex;
|
|
366
|
+
align-items: center;
|
|
367
|
+
justify-content: center;
|
|
368
|
+
min-height: 0;
|
|
369
|
+
overflow: hidden;
|
|
370
|
+
background: var(--dsw-alias-bg-layer-2);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.detailImage {
|
|
374
|
+
display: block;
|
|
375
|
+
width: 100%;
|
|
376
|
+
height: 100%;
|
|
377
|
+
object-fit: contain;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.detailInfo {
|
|
381
|
+
display: flex;
|
|
382
|
+
flex-direction: column;
|
|
383
|
+
gap: 10px;
|
|
384
|
+
min-height: 0;
|
|
385
|
+
overflow-y: auto;
|
|
386
|
+
padding: 18px;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.detailTitle {
|
|
390
|
+
margin: 0;
|
|
391
|
+
font-size: 15px;
|
|
392
|
+
font-weight: 650;
|
|
393
|
+
line-height: 1.4;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.detailMeta {
|
|
397
|
+
display: flex;
|
|
398
|
+
align-items: center;
|
|
399
|
+
flex-wrap: wrap;
|
|
400
|
+
gap: 8px;
|
|
401
|
+
font-size: 12px;
|
|
402
|
+
color: var(--dsw-alias-label-tertiary);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.detailLink {
|
|
406
|
+
color: var(--dsw-alias-brand-primary);
|
|
407
|
+
text-decoration: none;
|
|
408
|
+
overflow: hidden;
|
|
409
|
+
text-overflow: ellipsis;
|
|
410
|
+
white-space: nowrap;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
.detailLink:hover {
|
|
414
|
+
text-decoration: underline;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.detailPrompt {
|
|
418
|
+
flex: 1;
|
|
419
|
+
min-height: 0;
|
|
420
|
+
margin: 0;
|
|
421
|
+
padding: 12px;
|
|
422
|
+
overflow-y: auto;
|
|
423
|
+
border: 1px solid var(--dsw-alias-border-l1);
|
|
424
|
+
border-radius: 10px;
|
|
425
|
+
background: var(--dsw-alias-bg-layer-1);
|
|
426
|
+
color: var(--dsw-alias-label-primary);
|
|
427
|
+
font-size: 12.5px;
|
|
428
|
+
line-height: 1.6;
|
|
429
|
+
font-family: inherit;
|
|
430
|
+
white-space: pre-wrap;
|
|
431
|
+
word-break: break-word;
|
|
432
|
+
user-select: text;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.detailActions {
|
|
436
|
+
display: flex;
|
|
437
|
+
gap: 8px;
|
|
438
|
+
flex: none;
|
|
439
|
+
position: sticky;
|
|
440
|
+
bottom: 0;
|
|
441
|
+
margin: 0 -18px -18px;
|
|
442
|
+
padding: 12px 18px;
|
|
443
|
+
background: var(--dsw-alias-bg-base);
|
|
444
|
+
border-top: 1px solid var(--dsw-alias-border-l1);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/* Narrow shells: stack the detail pane. */
|
|
448
|
+
@media (max-width: 760px) {
|
|
449
|
+
.detail {
|
|
450
|
+
grid-template-columns: 1fr;
|
|
451
|
+
grid-template-rows: minmax(0, 3fr) minmax(0, 4fr);
|
|
452
|
+
}
|
|
453
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -26,6 +26,7 @@ export const inject = ['webServer', 'systemPrompt']
|
|
|
26
26
|
// contract only requires name / inject / Config / apply.
|
|
27
27
|
export { makeRoutes } from './routes.ts'
|
|
28
28
|
export { generateImage, ImageGenError } from './engine.ts'
|
|
29
|
+
export { listTemplates, readTemplateImage, refreshTemplates, clearTemplateMemo } from './templates-store.ts'
|
|
29
30
|
export { checkForUpdate, clearUpdateCache, compareVersions, CURRENT_VERSION, installUpdate, profileFromProcess } from './updater.ts'
|
|
30
31
|
|
|
31
32
|
/** The branded settings namespace of this plugin (the card edits it). */
|
|
@@ -58,7 +59,7 @@ const DEFAULT_ANNOUNCE = true
|
|
|
58
59
|
const SECTION_ORDER = 150
|
|
59
60
|
|
|
60
61
|
/** Model-facing announcement: plugin presence, capabilities, and limits. */
|
|
61
|
-
export const IMAGEGEN_GUIDANCE = '本机已安装 dsh-imagegen 插件(DSH AI 生图):侧边栏「AI 生图」入口。能力:对接 OpenAI 兼容图像生成 API(模型 gpt-image-2),支持文生图(/images/generations)与图生图(/images/edits,上传参考图);API 地址与密钥在 GUI「设置 → 插件 → 可配置」中配置,密钥仅存于本机设置文档;生成请求由本地宿主代理转发,结果以 base64
|
|
62
|
+
export const IMAGEGEN_GUIDANCE = '本机已安装 dsh-imagegen 插件(DSH AI 生图):侧边栏「AI 生图」入口。能力:对接 OpenAI 兼容图像生成 API(模型 gpt-image-2),支持文生图(/images/generations)与图生图(/images/edits,上传参考图);API 地址与密钥在 GUI「设置 → 插件 → 可配置」中配置,密钥仅存于本机设置文档;生成请求由本地宿主代理转发,结果以 base64 返回面板,可预览与下载。内置「提示词模板库」(面板提示词框左下角「模板库」按钮):打包 awesome-gpt-image-2 的数百条 gpt-image-2 提示词案例(含中文标题、分类、参考图,可搜索/按分类筛选),参考图经宿主代理按需缓存到本地;用户可一键把模板提示词填入提示词框再生成。限制:生成消耗上游 API 额度;图片内容由上游模型生成,可能不符合预期或包含不适宜内容;api_key 以明文存储在设置文档中;参考图会发送至所配置的 API 服务;模板库在线刷新与参考图首次加载需要访问 vibeui.top。用户提到「生图 / 绘画 / 生成图片 / gpt-image-2 / 文生图 / 图生图 / 提示词模板」时即指本插件,请据此协作。'
|
|
62
63
|
|
|
63
64
|
/** Effective config (schema defaults applied). */
|
|
64
65
|
interface EffectiveConfig {
|
package/src/protocol.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
export const IMAGEGEN_SETTINGS_NAMESPACE = 'dsh-imagegen'
|
|
9
9
|
|
|
10
10
|
/** Published package version shared by the host updater and the client UI. */
|
|
11
|
-
export const PLUGIN_VERSION = '1.0.
|
|
11
|
+
export const PLUGIN_VERSION = '1.0.9'
|
|
12
12
|
|
|
13
13
|
/** Same-origin route family (loopback-only, mirroring the dsh-ssh fence). */
|
|
14
14
|
export const SETTINGS_API = {
|
|
@@ -42,6 +42,64 @@ export const HISTORY_API = {
|
|
|
42
42
|
/** Maximum number of history entries retained host-side (oldest evicted). */
|
|
43
43
|
export const HISTORY_MAX = 50
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Same-origin route family for the bundled prompt-template library
|
|
47
|
+
* (awesome-gpt-image-2 mirror). The case list ships inside the package and is
|
|
48
|
+
* served by the host; reference images are proxied through the `image` prefix
|
|
49
|
+
* route and cached on disk so repeated views never hit the network again.
|
|
50
|
+
*/
|
|
51
|
+
export const TEMPLATES_API = {
|
|
52
|
+
list: '/api/dsh-imagegen/templates/list',
|
|
53
|
+
refresh: '/api/dsh-imagegen/templates/refresh',
|
|
54
|
+
image: '/api/dsh-imagegen/templates/image',
|
|
55
|
+
} as const
|
|
56
|
+
|
|
57
|
+
/** One prompt-library case as the browser consumes it. */
|
|
58
|
+
export interface TemplateCase {
|
|
59
|
+
/** Upstream case number (stable across refreshes). */
|
|
60
|
+
id: number
|
|
61
|
+
/** Short case title. */
|
|
62
|
+
title: string
|
|
63
|
+
/** Full reusable prompt text. */
|
|
64
|
+
prompt: string
|
|
65
|
+
/** English category name (grouping key). */
|
|
66
|
+
category: string
|
|
67
|
+
/** Chinese category display name. */
|
|
68
|
+
categoryZh: string
|
|
69
|
+
/** Style tags. */
|
|
70
|
+
styles: string[]
|
|
71
|
+
/** Scene tags. */
|
|
72
|
+
scenes: string[]
|
|
73
|
+
/** Original author handle, e.g. @vista8. */
|
|
74
|
+
sourceLabel: string
|
|
75
|
+
/** Original author link. */
|
|
76
|
+
sourceUrl: string
|
|
77
|
+
/** awesome-gpt-image-2 repo anchor link. */
|
|
78
|
+
githubUrl: string
|
|
79
|
+
/** Reference-image file name served through the image route ('' when none). */
|
|
80
|
+
image: string
|
|
81
|
+
/** Whether the source gallery featured the case. */
|
|
82
|
+
featured: boolean
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Template-library list payload. */
|
|
86
|
+
export interface TemplateListResult {
|
|
87
|
+
cases: TemplateCase[]
|
|
88
|
+
total: number
|
|
89
|
+
/** Where the served list came from. */
|
|
90
|
+
origin: 'bundled' | 'refreshed'
|
|
91
|
+
/** Upstream repository the library mirrors. */
|
|
92
|
+
repository: string
|
|
93
|
+
/** ISO time of the last successful refresh / bundle snapshot. */
|
|
94
|
+
fetchedAt: string
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Template-library refresh outcome. */
|
|
98
|
+
export interface TemplateRefreshResult {
|
|
99
|
+
total: number
|
|
100
|
+
fetchedAt: string
|
|
101
|
+
}
|
|
102
|
+
|
|
45
103
|
/** Generation modes. */
|
|
46
104
|
export type GenerateMode = 'text' | 'edit'
|
|
47
105
|
|