dsh-feiyu-life 0.6.0 → 0.7.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/CHANGELOG.md +12 -0
- package/README.md +8 -10
- package/client.js +112 -131
- package/image-prompt.js +191 -183
- package/image.js +276 -325
- package/locale/zh.json +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# 更新记录
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
- **相机与生活线融合**:`shoot` 的「此刻」不再自己读剧本文件,改成走生活线的状态机(`generate`)——拍出来的穿着、地点、光线跟注入给她的完全一致。
|
|
6
|
+
- **命名空间统一**:相机路由 `/dsh-feiyu-life/image/*`,配置 `feiyu-life-image-config.json`,照片目录 `~/.dsh/feiyu-life-image/`,日志 `feiyu-life-image.log`;旧路径仍可读,已有照片不丢。
|
|
7
|
+
- **标识符英文**:`image.js` / `image-prompt.js` 全部英文;重复的「生活此刻 / 推地点 / 日志」合成一处。
|
|
8
|
+
- **`shoot` 参数英文**:`hint` / `type` / `location` / `outfit` / `expression`。
|
|
9
|
+
- 设置页照片面板走新接口,字段与其余面板一致(`config` / `photos` / `today` / `check` 等)。
|
|
10
|
+
|
|
11
|
+
## 0.6.1
|
|
12
|
+
|
|
13
|
+
- 设置页名字从「鱼的生活线」改成「**鱼的生活**」——相机并进来之后,这一页已经不只是生活线了。
|
|
14
|
+
|
|
3
15
|
## 0.6.0
|
|
4
16
|
|
|
5
17
|
相机并进来了(原 `dsh-feiyu-image`)。她要拍照时不用再装第二个插件。
|
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# dsh-feiyu-life ·
|
|
1
|
+
# dsh-feiyu-life · 鱼的生活
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/dsh-feiyu-life)
|
|
4
4
|
[](./LICENSE)
|
|
5
5
|
[](https://nodejs.org/)
|
|
6
6
|
|
|
7
|
-

|
|
8
8
|
|
|
9
9
|
给她一条**自己的时间**。
|
|
10
10
|
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
(说话)这些是你自己的日子,别当时间表念:不说"按日程/计划/安排",不报时间段、不列清单。
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
设置页在 **设置 →
|
|
24
|
+
设置页在 **设置 → 鱼的生活**,六个页签:此刻 / 年度 / 课表 / 作息 / 身体 / 事件。
|
|
25
25
|
「此刻」页顶部是一条 0–24 点的时序图:灰=按计划走,橙=`life_adjust` 改过的。
|
|
26
26
|
|
|
27
27
|
---
|
|
@@ -138,7 +138,7 @@ life_adjust 调整 ─┘
|
|
|
138
138
|
dsh plugin --profile web add dsh-feiyu-life
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
装完**刷新一下页面**,设置里就有「鱼的生活」。
|
|
142
142
|
|
|
143
143
|
更新要**先卸再装**(直接装可能拿到缓存里的旧副本):
|
|
144
144
|
|
|
@@ -161,18 +161,16 @@ dsh plugin --profile web add /absolute/path/to/dsh-feiyu-life
|
|
|
161
161
|
|
|
162
162
|
改完代码要生效:在插件页卸掉再装一次(模块是加载时读的,不是每次都读盘)。
|
|
163
163
|
|
|
164
|
-
##
|
|
164
|
+
## 相机
|
|
165
165
|
|
|
166
166
|
`shoot` 工具:`selfie` 拍她自己、`scene` 拍别的东西。
|
|
167
167
|
|
|
168
|
-
-
|
|
169
|
-
- 自拍带参考图锁角色(`~/.dsh/feiyu-image/角色设定/正面.jpg
|
|
168
|
+
- 自动带上「此刻」的穿着和地点——直接取生活线的状态,跟注入给她的那份是同一个源;
|
|
169
|
+
- 自拍带参考图锁角色(`~/.dsh/feiyu-life-image/角色设定/正面.jpg`,旧目录也会读);
|
|
170
170
|
- 提示词两级加工:模型扩写 / 本地模板;
|
|
171
171
|
- **出图自检**:看一眼,角色跑偏、画风错、画崩(多手多指)、有文字水印就重拍一次;
|
|
172
172
|
- 生图走火山方舟 Seedream,主模型挂了自动换备用模型;
|
|
173
|
-
-
|
|
174
|
-
|
|
175
|
-
它原来是个独立包 `dsh-feiyu-image`,两边都要读生活线才出得像,所以合了。**独立包停止更新**。
|
|
173
|
+
- 配置在 `~/.dsh/feiyu-life-image-config.json`,设置页「照片」页签里改。
|
|
176
174
|
|
|
177
175
|
## 已知边界
|
|
178
176
|
|
package/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* dsh-feiyu-life · browser half (Settings ->
|
|
2
|
+
* dsh-feiyu-life · browser half (Settings -> 鱼的生活)
|
|
3
3
|
*
|
|
4
4
|
* Same plugin convention: window.__ModuleLoader__.load({ id, factory }), React via require.
|
|
5
5
|
*
|
|
@@ -433,15 +433,15 @@ window.__ModuleLoader__.load({
|
|
|
433
433
|
tab === 'day' ? dayPage : null,
|
|
434
434
|
tab === 'body' ? bodyPage : null,
|
|
435
435
|
tab === 'events' ? eventsPage : null,
|
|
436
|
-
tab === 'photo' ? h(
|
|
436
|
+
tab === 'photo' ? h(ImagePanel.Panel) : null,
|
|
437
437
|
h('div', { 'data-fl-msg': '' }, message))
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
|
|
441
|
-
// ──
|
|
442
|
-
//
|
|
443
|
-
const
|
|
444
|
-
const API = '/dsh-feiyu-image'
|
|
441
|
+
// ── camera settings (merged from dsh-feiyu-image) ──
|
|
442
|
+
// Its own scope so CSS / API names do not collide with the life panel.
|
|
443
|
+
const ImagePanel = (() => {
|
|
444
|
+
const API = '/dsh-feiyu-life/image'
|
|
445
445
|
|
|
446
446
|
const CSS = `
|
|
447
447
|
[data-fi-wrap]{display:flex;flex-direction:column;gap:14px;padding:4px 2px 24px;color-scheme:light dark;font-size:13px;}
|
|
@@ -465,221 +465,202 @@ window.__ModuleLoader__.load({
|
|
|
465
465
|
[data-fi-preview]{max-width:100%;border-radius:10px;border:1px solid rgba(127,127,127,.3);}
|
|
466
466
|
`
|
|
467
467
|
|
|
468
|
-
function
|
|
468
|
+
function Label(props) {
|
|
469
469
|
return h('label', { style: { display: 'flex', flexDirection: 'column', gap: 4 } },
|
|
470
470
|
h('span', { style: { fontSize: 12, opacity: 0.7 } }, props.label),
|
|
471
471
|
props.children)
|
|
472
472
|
}
|
|
473
473
|
|
|
474
474
|
function Panel() {
|
|
475
|
-
const [
|
|
476
|
-
const [
|
|
477
|
-
const [
|
|
475
|
+
const [status, setStatus] = useState(null)
|
|
476
|
+
const [config, setConfig] = useState(null)
|
|
477
|
+
const [message, setMessage] = useState('')
|
|
478
478
|
const [busy, setBusy] = useState(false)
|
|
479
|
-
const [
|
|
480
|
-
const [
|
|
481
|
-
const [
|
|
482
|
-
const [
|
|
483
|
-
const [
|
|
484
|
-
|
|
485
|
-
const
|
|
486
|
-
|
|
479
|
+
const [draft, setDraft] = useState({ hint: '在宿舍书桌前托腮看镜头', outfit: '', expression: '', type: 'selfie' })
|
|
480
|
+
const [result, setResult] = useState(null)
|
|
481
|
+
const [models, setModels] = useState([])
|
|
482
|
+
const [modelNote, setModelNote] = useState('')
|
|
483
|
+
const [manual, setManual] = useState(false)
|
|
484
|
+
|
|
485
|
+
const loadModels = async (force) => {
|
|
486
|
+
setModelNote('拉取中…')
|
|
487
487
|
try {
|
|
488
|
-
const r = await fetch(`${API}/models${
|
|
488
|
+
const r = await fetch(`${API}/models${force ? '?f=1' : ''}`, { credentials: 'same-origin' })
|
|
489
489
|
const d = await r.json()
|
|
490
490
|
if (!d.ok) throw new Error(d.error || '拉不到模型列表')
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
? '没拉到,先用内置名单:' + String(d
|
|
494
|
-
: `${(d
|
|
491
|
+
setModels(d.models || [])
|
|
492
|
+
setModelNote(d.modelError
|
|
493
|
+
? '没拉到,先用内置名单:' + String(d.modelError).slice(0, 80)
|
|
494
|
+
: `${(d.models || []).length} 个可选${d.cached ? '(缓存 10 分钟)' : ''}`)
|
|
495
495
|
} catch (e) {
|
|
496
|
-
|
|
496
|
+
setModels([]); setModelNote('拉取失败:' + String((e && e.message) || e).slice(0, 100))
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
499
|
|
|
500
|
-
const
|
|
500
|
+
const load = async () => {
|
|
501
501
|
try {
|
|
502
502
|
const r = await fetch(`${API}/state`, { credentials: 'same-origin' })
|
|
503
503
|
const d = await r.json()
|
|
504
504
|
if (!d.ok) throw new Error(d.error || '读不到状态')
|
|
505
|
-
|
|
506
|
-
} catch (e) {
|
|
505
|
+
setStatus(d); setConfig(d.config)
|
|
506
|
+
} catch (e) { setMessage('读取失败:' + String(e.message || e)) }
|
|
507
507
|
}
|
|
508
|
-
useEffect(() => {
|
|
509
|
-
useEffect(() => {
|
|
508
|
+
useEffect(() => { load() }, [])
|
|
509
|
+
useEffect(() => { loadModels() }, [])
|
|
510
510
|
|
|
511
|
-
const
|
|
512
|
-
const
|
|
513
|
-
const
|
|
511
|
+
const edit = (k) => (e) => setConfig({ ...config, [k]: e && e.target ? e.target.value : e })
|
|
512
|
+
const editNum = (k) => (e) => setConfig({ ...config, [k]: Number(e.target.value) })
|
|
513
|
+
const editCheck = (k) => (e) => setConfig({ ...config, [k]: Boolean(e.target.checked) })
|
|
514
514
|
|
|
515
|
-
const
|
|
516
|
-
setBusy(true);
|
|
515
|
+
const save = async () => {
|
|
516
|
+
setBusy(true); setMessage('保存中…')
|
|
517
517
|
try {
|
|
518
518
|
const r = await fetch(`${API}/save`, {
|
|
519
519
|
method: 'POST', credentials: 'same-origin',
|
|
520
520
|
headers: { 'content-type': 'application/json' },
|
|
521
|
-
body: JSON.stringify({
|
|
521
|
+
body: JSON.stringify({ config }),
|
|
522
522
|
})
|
|
523
523
|
const d = await r.json()
|
|
524
524
|
if (!d.ok) throw new Error(d.error || '保存失败')
|
|
525
|
-
|
|
526
|
-
await
|
|
527
|
-
} catch (e) {
|
|
525
|
+
setMessage('已保存,下一张就按新配置走'); setConfig(d.config)
|
|
526
|
+
await load()
|
|
527
|
+
} catch (e) { setMessage('保存失败:' + String(e.message || e)) } finally { setBusy(false) }
|
|
528
528
|
}
|
|
529
529
|
|
|
530
|
-
const
|
|
531
|
-
setBusy(true);
|
|
530
|
+
const shoot = async () => {
|
|
531
|
+
setBusy(true); setMessage('正在拍,方舟大概 30 秒…'); setResult(null)
|
|
532
532
|
try {
|
|
533
533
|
const r = await fetch(`${API}/test`, {
|
|
534
534
|
method: 'POST', credentials: 'same-origin',
|
|
535
535
|
headers: { 'content-type': 'application/json' },
|
|
536
|
-
body: JSON.stringify(
|
|
536
|
+
body: JSON.stringify(draft),
|
|
537
537
|
})
|
|
538
538
|
const d = await r.json()
|
|
539
539
|
if (!d.ok) throw new Error(d.error || '试拍失败')
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
} catch (e) { setMsg('试拍失败:' + String(e.message || e)) } finally { setBusy(false) }
|
|
540
|
+
const name = String(d.image || '').split('/').pop()
|
|
541
|
+
setResult({ url: `${API}/file?n=${encodeURIComponent(name)}`, prompt: d.prompt, bytes: d.bytes, check: d.check || null, notes: d.notes || [] })
|
|
542
|
+
setMessage(d.check ? (d.check.pass ? '拍好了,自检过了' : '拍好了,但自检说不合格') : '拍好了')
|
|
543
|
+
await load()
|
|
544
|
+
} catch (e) { setMessage('试拍失败:' + String(e.message || e)) } finally { setBusy(false) }
|
|
546
545
|
}
|
|
547
546
|
|
|
548
|
-
if (!
|
|
547
|
+
if (!status || !config) return h('div', { 'data-fi-wrap': '' }, h('div', { 'data-fi-note': '' }, message || '读取中…'))
|
|
549
548
|
|
|
550
|
-
const
|
|
551
|
-
const 用Ark = true
|
|
549
|
+
const photos = status.photos || []
|
|
552
550
|
|
|
553
551
|
return h('div', { 'data-fi-wrap': '' },
|
|
554
|
-
// 状态
|
|
555
552
|
h('div', { 'data-fi-row': '' },
|
|
556
|
-
h('span', { 'data-fi-chip': '', 'data-ok':
|
|
557
|
-
|
|
558
|
-
h('span', { 'data-fi-chip': '', 'data-bad':
|
|
559
|
-
|
|
560
|
-
h('span', { 'data-fi-chip': '' }, `今日 ${
|
|
553
|
+
h('span', { 'data-fi-chip': '', 'data-ok': status.ark && status.ark.ok ? '' : undefined },
|
|
554
|
+
status.ark && status.ark.ok ? '方舟 已连接' : '方舟 未配置'),
|
|
555
|
+
h('span', { 'data-fi-chip': '', 'data-bad': status.hasRef ? undefined : '' },
|
|
556
|
+
status.hasRef ? '参考图 有' : '参考图 缺'),
|
|
557
|
+
h('span', { 'data-fi-chip': '' }, `今日 ${status.today}/${status.limit}`),
|
|
561
558
|
h('span', { 'data-fi-chip': '' }, '后端 火山方舟')),
|
|
562
559
|
|
|
563
|
-
// 后端
|
|
564
560
|
h('div', { 'data-fi-sec': '' },
|
|
565
561
|
h('div', { 'data-fi-h': '' }, '模型'),
|
|
566
562
|
h('div', { 'data-fi-row': '' },
|
|
567
|
-
h(
|
|
563
|
+
h(Label, { label: '模型(自动从后端拉)' },
|
|
568
564
|
h('div', { 'data-fi-row': '' },
|
|
569
|
-
(
|
|
570
|
-
? h('input', { value:
|
|
565
|
+
(manual || !models.length)
|
|
566
|
+
? h('input', { value: config.模型 || '', onChange: edit('模型'), placeholder: '手填模型 id', style: { width: 300 } })
|
|
571
567
|
: h('select', {
|
|
572
|
-
value:
|
|
568
|
+
value: models.includes(config.模型) ? config.模型 : '__keep',
|
|
573
569
|
style: { width: 300 },
|
|
574
570
|
onChange: (e) => {
|
|
575
571
|
const v = e.target.value
|
|
576
|
-
if (v === '__custom') {
|
|
572
|
+
if (v === '__custom') { setManual(true); return }
|
|
577
573
|
if (v === '__keep') return
|
|
578
|
-
|
|
574
|
+
setConfig({ ...config, 模型: v })
|
|
579
575
|
},
|
|
580
576
|
},
|
|
581
|
-
...(
|
|
582
|
-
|
|
577
|
+
...(models.includes(config.模型) ? [] : [h('option', { key: '__keep', value: '__keep' }, `当前:${config.模型 || '(空)'}`)]),
|
|
578
|
+
...models.map((id) => h('option', { key: id, value: id }, id)),
|
|
583
579
|
h('option', { key: '__custom', value: '__custom' }, '手填…')),
|
|
584
|
-
h('button', { 'data-fi-btn': '', onClick: () =>
|
|
585
|
-
|
|
580
|
+
h('button', { 'data-fi-btn': '', onClick: () => loadModels(true) }, '刷新'),
|
|
581
|
+
manual ? h('button', { 'data-fi-btn': '', onClick: () => setManual(false) }, '改用列表') : null))),
|
|
586
582
|
h('div', { 'data-fi-row': '' },
|
|
587
583
|
h('label', { 'data-fi-row': '' },
|
|
588
|
-
h('input', { type: 'checkbox', checked: Boolean(
|
|
584
|
+
h('input', { type: 'checkbox', checked: Boolean(config.用参考图), onChange: editCheck('用参考图') }),
|
|
589
585
|
h('span', {}, '用参考图锁角色(方舟专用)')),
|
|
590
|
-
h(
|
|
591
|
-
h('input', { value:
|
|
586
|
+
h(Label, { label: '参考图路径' },
|
|
587
|
+
h('input', { value: config.参考图 || '', onChange: edit('参考图'), placeholder: '留空 = ~/.dsh/feiyu-life-image/角色设定/正面.jpg', style: { width: 420 } }))),
|
|
592
588
|
h('div', { 'data-fi-note': '' },
|
|
593
|
-
(
|
|
589
|
+
(modelNote ? `模型列表:${modelNote}。` : '') + '列表是实时问方舟要的,新出的模型会自动出现。')),
|
|
594
590
|
|
|
595
|
-
// 形象
|
|
596
591
|
h('div', { 'data-fi-sec': '' },
|
|
597
592
|
h('div', { 'data-fi-h': '' }, '形象与画风'),
|
|
598
|
-
h(
|
|
599
|
-
|
|
600
|
-
h(
|
|
601
|
-
|
|
602
|
-
h(
|
|
603
|
-
|
|
604
|
-
h(字段, { label: '镜头(自拍时用)' },
|
|
605
|
-
h('textarea', { value: cfg.镜头 || '', onChange: 改('镜头') })),
|
|
606
|
-
h(字段, { label: '默认表情' },
|
|
607
|
-
h('input', { value: cfg.表情 || '', onChange: 改('表情') })),
|
|
608
|
-
h(字段, { label: '画面细节(越具体越像真的)' },
|
|
609
|
-
h('textarea', { value: cfg.细节 || '', onChange: 改('细节') })),
|
|
593
|
+
h(Label, { label: '固定特征(长相,每次一字不差带上)' }, h('textarea', { value: config.外观 || '', onChange: edit('外观') })),
|
|
594
|
+
h(Label, { label: '默认服装(可被「穿着」参数覆盖)' }, h('textarea', { value: config.服装 || '', onChange: edit('服装') })),
|
|
595
|
+
h(Label, { label: '画风' }, h('textarea', { value: config.风格 || '', onChange: edit('风格') })),
|
|
596
|
+
h(Label, { label: '镜头(自拍时用)' }, h('textarea', { value: config.镜头 || '', onChange: edit('镜头') })),
|
|
597
|
+
h(Label, { label: '默认表情' }, h('input', { value: config.表情 || '', onChange: edit('表情') })),
|
|
598
|
+
h(Label, { label: '画面细节(越具体越像真的)' }, h('textarea', { value: config.细节 || '', onChange: edit('细节') })),
|
|
610
599
|
h('div', { 'data-fi-row': '' },
|
|
611
|
-
h(
|
|
612
|
-
h('select', { value:
|
|
600
|
+
h(Label, { label: '画幅' },
|
|
601
|
+
h('select', { value: config.画幅 || '竖幅', onChange: edit('画幅') },
|
|
613
602
|
h('option', { value: '竖幅' }, '竖幅 1440×1920(手机自拍)'),
|
|
614
603
|
h('option', { value: '方形' }, '方形 2048×2048'),
|
|
615
604
|
h('option', { value: '横幅' }, '横幅 1920×1440'))),
|
|
616
|
-
h('div', { 'data-fi-note': '', style: { flex: 1 } },
|
|
617
|
-
'穿着默认取生活线里「此刻」那一段(不用填);一张 60–100 秒。'))),
|
|
605
|
+
h('div', { 'data-fi-note': '', style: { flex: 1 } }, '穿着默认取生活线里「此刻」那一段(不用填);一张 60–100 秒。'))),
|
|
618
606
|
|
|
619
|
-
// 节流
|
|
620
607
|
h('div', { 'data-fi-sec': '' },
|
|
621
608
|
h('div', { 'data-fi-h': '' }, '节流'),
|
|
622
609
|
h('div', { 'data-fi-row': '' },
|
|
623
|
-
h(
|
|
624
|
-
h(
|
|
625
|
-
h(
|
|
610
|
+
h(Label, { label: '每天最多' }, h('input', { type: 'number', value: config.每日上限, onChange: editNum('每日上限') })),
|
|
611
|
+
h(Label, { label: '两次最短间隔(秒)' }, h('input', { type: 'number', value: config.最短间隔秒, onChange: editNum('最短间隔秒') })),
|
|
612
|
+
h(Label, { label: '存图目录(留空=默认)' }, h('input', { value: config.存图目录 || '', onChange: edit('存图目录'), style: { width: 320 } }))),
|
|
626
613
|
h('div', { 'data-fi-row': '' },
|
|
627
614
|
h('label', { 'data-fi-row': '' },
|
|
628
|
-
h('input', { type: 'checkbox', checked:
|
|
615
|
+
h('input', { type: 'checkbox', checked: config.出图自检 !== false, onChange: editCheck('出图自检') }),
|
|
629
616
|
h('span', {}, '出图后自检(看一眼角色/画风/画崩/文字水印)')),
|
|
630
|
-
h(
|
|
631
|
-
h('input', { type: 'number', value:
|
|
632
|
-
h('div', { 'data-fi-note': '' },
|
|
633
|
-
'自检要花一次视觉调用,约 5–10 秒;重拍会多出一张图,也算今天的额度。')),
|
|
617
|
+
h(Label, { label: '不合格最多重拍' },
|
|
618
|
+
h('input', { type: 'number', value: config.自检重拍 ?? 1, min: 0, max: 2, onChange: editNum('自检重拍') }))),
|
|
619
|
+
h('div', { 'data-fi-note': '' }, '自检要花一次视觉调用,约 5–10 秒;重拍会多出一张图,也算今天的额度。')),
|
|
634
620
|
|
|
635
|
-
// 保存
|
|
636
621
|
h('div', { 'data-fi-row': '' },
|
|
637
|
-
h('button', { 'data-fi-btn': '', 'data-primary': '', disabled: busy, onClick:
|
|
638
|
-
h('button', { 'data-fi-btn': '', disabled: busy, onClick:
|
|
639
|
-
h('span', { 'data-fi-msg': '' },
|
|
622
|
+
h('button', { 'data-fi-btn': '', 'data-primary': '', disabled: busy, onClick: save }, '保存'),
|
|
623
|
+
h('button', { 'data-fi-btn': '', disabled: busy, onClick: load }, '重新读取'),
|
|
624
|
+
h('span', { 'data-fi-msg': '' }, message)),
|
|
640
625
|
|
|
641
|
-
// 试拍
|
|
642
626
|
h('div', { 'data-fi-sec': '' },
|
|
643
627
|
h('div', { 'data-fi-h': '' }, '试拍(不进对话,直接看效果)'),
|
|
644
628
|
h('div', { 'data-fi-row': '' },
|
|
645
|
-
h(
|
|
646
|
-
h('input', { value:
|
|
647
|
-
h(
|
|
648
|
-
h('input', { value:
|
|
649
|
-
h(
|
|
650
|
-
h('input', { value:
|
|
651
|
-
h(
|
|
652
|
-
h('select', { value:
|
|
629
|
+
h(Label, { label: '画面' },
|
|
630
|
+
h('input', { value: draft.hint, onChange: (e) => setDraft({ ...draft, hint: e.target.value }), style: { width: 360 } })),
|
|
631
|
+
h(Label, { label: '穿着(可空)' },
|
|
632
|
+
h('input', { value: draft.outfit, onChange: (e) => setDraft({ ...draft, outfit: e.target.value }), placeholder: '睡衣 / 卫衣 / 浴巾' })),
|
|
633
|
+
h(Label, { label: '表情(可空)' },
|
|
634
|
+
h('input', { value: draft.expression || '', onChange: (e) => setDraft({ ...draft, expression: e.target.value }), placeholder: '偷笑 / 困 / 委屈' })),
|
|
635
|
+
h(Label, { label: '类型' },
|
|
636
|
+
h('select', { value: draft.type, onChange: (e) => setDraft({ ...draft, type: e.target.value }) },
|
|
653
637
|
h('option', { value: 'selfie' }, '自拍'),
|
|
654
638
|
h('option', { value: 'scene' }, '只拍场景'))),
|
|
655
|
-
h('button', { 'data-fi-btn': '', 'data-primary': '', disabled: busy, onClick:
|
|
639
|
+
h('button', { 'data-fi-btn': '', 'data-primary': '', disabled: busy, onClick: shoot }, '拍一张(约 35 秒)')),
|
|
656
640
|
h('div', { 'data-fi-note': '' }, '用的是保存后的配置;如果刚改过参数,先点保存。'),
|
|
657
|
-
result
|
|
658
|
-
h('img', { 'data-fi-preview': '', src:
|
|
641
|
+
result && result.url ? h('div', { 'data-fi-sec': '' },
|
|
642
|
+
h('img', { 'data-fi-preview': '', src: result.url, alt: '试拍结果' }),
|
|
659
643
|
h('div', { 'data-fi-note': '' },
|
|
660
|
-
(
|
|
661
|
-
? (
|
|
662
|
-
+ (
|
|
663
|
-
+ (
|
|
644
|
+
(result.check
|
|
645
|
+
? (result.check.pass ? '自检:合格 ' : '自检:不合格 ')
|
|
646
|
+
+ (result.check.problems && result.check.problems.length ? '· ' + result.check.problems.join(';') + ' ' : '')
|
|
647
|
+
+ (result.check.pass ? '' : '· 改法:' + (result.check.fix || '无'))
|
|
664
648
|
: '自检:没跑成'),
|
|
665
|
-
...(
|
|
649
|
+
...(result.notes || []).map((x, i) => h('div', { key: 'n' + i, 'data-fi-note': '' }, '· ' + x)),
|
|
666
650
|
),
|
|
667
|
-
h('div', { 'data-fi-note': '' }, `提示词:${
|
|
651
|
+
h('div', { 'data-fi-note': '' }, `提示词:${result.prompt}`)) : null),
|
|
668
652
|
|
|
669
|
-
// 最近照片
|
|
670
653
|
h('div', { 'data-fi-sec': '' },
|
|
671
|
-
h('div', { 'data-fi-h': '' }, `最近的照片(${
|
|
654
|
+
h('div', { 'data-fi-h': '' }, `最近的照片(${photos.length})`),
|
|
672
655
|
h('div', { 'data-fi-grid': '' },
|
|
673
|
-
|
|
674
|
-
key: p
|
|
675
|
-
src: `${API}/file?n=${encodeURIComponent(p
|
|
676
|
-
title: `${p
|
|
677
|
-
alt: p
|
|
678
|
-
}))))
|
|
679
|
-
)
|
|
656
|
+
...photos.map((p) => h('img', {
|
|
657
|
+
key: p.name,
|
|
658
|
+
src: `${API}/file?n=${encodeURIComponent(p.name)}`,
|
|
659
|
+
title: `${p.name} · ${Math.round(p.size / 1024)}KB`,
|
|
660
|
+
alt: p.name,
|
|
661
|
+
})))))
|
|
680
662
|
}
|
|
681
663
|
|
|
682
|
-
function result(x) { return x && x.url }
|
|
683
664
|
return { Panel, CSS }
|
|
684
665
|
})()
|
|
685
666
|
|
|
@@ -694,14 +675,14 @@ window.__ModuleLoader__.load({
|
|
|
694
675
|
|
|
695
676
|
const style2 = document.createElement('style')
|
|
696
677
|
style2.setAttribute('data-plugin-css', 'dsh-feiyu-image')
|
|
697
|
-
style2.textContent =
|
|
678
|
+
style2.textContent = ImagePanel.CSS
|
|
698
679
|
document.head.appendChild(style2)
|
|
699
680
|
ctx.effect(() => () => style2.remove(), 'dsh-feiyu-image: settings css')
|
|
700
681
|
|
|
701
682
|
const slots = (typeof ctx.get === 'function' ? ctx.get('slots') : undefined) || ctx.slots
|
|
702
683
|
if (!slots) return
|
|
703
684
|
slots.inject('settings.section', () => slots.register(
|
|
704
|
-
{ name: 'settings.section', id: 'feiyu-life', order: 56, label: '
|
|
685
|
+
{ name: 'settings.section', id: 'feiyu-life', order: 56, label: '鱼的生活' },
|
|
705
686
|
() => h(Panel),
|
|
706
687
|
))
|
|
707
688
|
|