@chad.dev/dsh-adclip 0.1.0 → 0.1.1
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 +0 -1
- package/README.md +9 -9
- package/client.js +190 -91
- package/engine/src/adclip/api.py +42 -14
- package/engine/src/adclip/catalog.py +341 -0
- package/engine/src/adclip/image_params.py +30 -49
- package/engine/src/adclip/intents.py +30 -11
- package/engine/src/adclip/media/ffmpeg.py +4 -4
- package/engine/src/adclip/media/subtitles.py +1 -1
- package/engine/src/adclip/models.py +2 -2
- package/engine/src/adclip/params.py +19 -224
- package/engine/src/adclip/pipeline/generate.py +56 -61
- package/engine/src/adclip/pipeline/image_runner.py +23 -8
- package/engine/src/adclip/pipeline/post.py +10 -3
- package/engine/src/adclip/pipeline/qa.py +4 -1
- package/engine/src/adclip/providers/ark.py +1 -1
- package/engine/src/adclip/providers/ark_image.py +114 -0
- package/engine/src/adclip/providers/minimax_image.py +3 -0
- package/engine/src/adclip/store.py +1 -1
- package/host/dsh.js +1 -1
- package/host/proxy.js +1 -1
- package/locale/en.json +1 -1
- package/locale/zh.json +2 -2
- package/package.json +2 -2
package/client.js
CHANGED
|
@@ -38,6 +38,7 @@ window.__ModuleLoader__.load({
|
|
|
38
38
|
.adp-eyebrow{font:10px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.12em;text-transform:uppercase;color:#C99B54;margin-bottom:5px}
|
|
39
39
|
.adp-title{font-size:24px;line-height:1.12;font-weight:750;letter-spacing:-.5px;margin:0}
|
|
40
40
|
.adp-lede{color:var(--dsw-alias-label-secondary);font-size:12.5px;margin:6px 0 0;max-width:620px}
|
|
41
|
+
.adp-lede.adp-nowrap{max-width:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
41
42
|
.adp-page-meta{display:flex;align-items:center;gap:8px;color:var(--dsw-alias-label-secondary);font-size:11px;padding-bottom:2px}
|
|
42
43
|
.adp-panel{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:14px;overflow:hidden;box-shadow:0 1px 0 rgba(255,255,255,.03) inset}
|
|
43
44
|
.adp-panel-grid{display:grid;grid-template-columns:360px minmax(0,1fr)}
|
|
@@ -114,6 +115,8 @@ window.__ModuleLoader__.load({
|
|
|
114
115
|
.adp-select{min-width:84px}
|
|
115
116
|
.adp-error{color:var(--dsw-alias-state-error-primary);font-size:11px;line-height:1.45;white-space:pre-wrap}
|
|
116
117
|
.adp-badge{font:10px/1.6 ui-monospace,SFMono-Regular,Menlo,monospace;border-radius:999px;padding:2px 7px;border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);letter-spacing:.02em}
|
|
118
|
+
.adp-caps{display:inline-flex;gap:4px;flex-wrap:wrap}
|
|
119
|
+
.adp-cap{font-size:10px;line-height:1.5;padding:0 5px;border-radius:4px;border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-2);white-space:nowrap}
|
|
117
120
|
.adp-badge.ok{color:var(--dsw-alias-state-success-primary);border-color:color-mix(in srgb,var(--dsw-alias-state-success-primary) 55%,transparent)}
|
|
118
121
|
.adp-badge.warn{color:var(--dsw-alias-state-warn-primary);border-color:color-mix(in srgb,var(--dsw-alias-state-warn-primary) 55%,transparent)}
|
|
119
122
|
.adp-badge.bad{color:var(--dsw-alias-state-error-primary);border-color:color-mix(in srgb,var(--dsw-alias-state-error-primary) 55%,transparent)}
|
|
@@ -214,6 +217,13 @@ window.__ModuleLoader__.load({
|
|
|
214
217
|
.adp-text-model>span{font:9px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.05em;color:#C99B54;white-space:nowrap}
|
|
215
218
|
.adp-text-model .adp-select{height:32px;max-width:220px;font-size:11px;min-width:120px}
|
|
216
219
|
.adp-model-select{height:32px;min-width:180px;max-width:260px;font-size:11px}
|
|
220
|
+
.adp-ref-upload{position:relative;display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 10px;border:1px dashed var(--dsw-alias-border-l2);border-radius:7px;color:var(--dsw-alias-label-secondary);font-size:11.5px;cursor:pointer;overflow:hidden;max-width:260px}
|
|
221
|
+
.adp-ref-upload:hover{border-color:#C99B54;color:var(--dsw-alias-label-primary)}
|
|
222
|
+
.adp-ref-upload.has{border-style:solid;padding:0 6px 0 4px}
|
|
223
|
+
.adp-ref-chip{display:inline-flex;align-items:center;gap:6px;min-width:0}
|
|
224
|
+
.adp-ref-chip img{width:24px;height:24px;border-radius:4px;object-fit:cover;flex:0 0 auto}
|
|
225
|
+
.adp-ref-name{max-width:170px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
226
|
+
|
|
217
227
|
.adp-advanced-panel{border:1px solid var(--dsw-alias-border-l1);border-radius:12px;background:var(--dsw-alias-bg-layer-1);padding:13px 15px;margin-top:10px}
|
|
218
228
|
.adp-settings-page .adp-section-head{margin-top:16px}
|
|
219
229
|
.adp-dsh-line{display:flex;align-items:center;justify-content:space-between;gap:10px;border:1px solid var(--dsw-alias-border-l1);border-radius:9px;background:var(--dsw-alias-bg-layer-1);padding:9px 11px}
|
|
@@ -495,13 +505,45 @@ window.__ModuleLoader__.load({
|
|
|
495
505
|
const duration = Number((source.match(/(\d{1,2})\s*(?:秒|s|sec)(?!\w)/i) || [])[1] || 0)
|
|
496
506
|
const resolution = (source.match(/(1080p|720p|480p|2k)/i) || [])[1] || ''
|
|
497
507
|
const mode = /(精细|分段|分镜)/.test(source) ? 'fine' : ''
|
|
498
|
-
|
|
508
|
+
// Subtitles are a sidecar SRT switch. Judge the "off" phrasings first so
|
|
509
|
+
// "不要字幕" never reads as "字幕".
|
|
510
|
+
let subtitle = ''
|
|
511
|
+
if (/字幕/.test(source)) {
|
|
512
|
+
if (/(不要|不启用|不用|去掉|关闭|关掉|取消|别加|无)字幕|字幕(不要|关掉|关闭|去掉|不用)/.test(source)) subtitle = 'off'
|
|
513
|
+
else if (/(加|开|要|带|生成|启用)字幕|字幕(打开|开启)/.test(source)) subtitle = 'sidecar'
|
|
514
|
+
}
|
|
515
|
+
const vendor = /可灵|kling/i.test(source) ? 'kling'
|
|
516
|
+
: /seedance|方舟|ark/i.test(source) ? 'ark'
|
|
517
|
+
: /minimax|海螺|hailuo/i.test(source) ? 'minimax' : ''
|
|
518
|
+
return { aspect, duration: duration || 0, resolution: resolution ? resolution.toLowerCase().replace('2k', '1080p') : '', mode, subtitle, vendor }
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
/** First usable model from a vendor named in the brief, or '' when none. */
|
|
522
|
+
function modelForVendor(vendor, models) {
|
|
523
|
+
if (!vendor) return ''
|
|
524
|
+
const row = (models || []).find((m) => m.kind === 'video' && m.provider === vendor && m.available && m.enabled !== false)
|
|
525
|
+
return row ? row.id : ''
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/** Default video model: first usable one, dialogue-capable first for remakes. */
|
|
529
|
+
function defaultModelId(models, needsDialogue) {
|
|
530
|
+
const rows = (models || []).filter((m) => m.kind === 'video' && m.available && m.enabled !== false && (m.capabilities || []).includes('text_to_video'))
|
|
531
|
+
const real = rows.filter((m) => m.provider !== 'synthetic')
|
|
532
|
+
const pool = real.length ? real : rows
|
|
533
|
+
const withAudio = needsDialogue ? pool.filter((m) => m.native_audio) : pool
|
|
534
|
+
const pick = (withAudio.length ? withAudio : pool)[0]
|
|
535
|
+
return pick ? pick.id : ''
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/** How the subtitle setting reads in the UI. */
|
|
539
|
+
function subtitleLabel(value) {
|
|
540
|
+
return value === 'sidecar' ? 'SRT 旁挂' : '不启用'
|
|
499
541
|
}
|
|
500
542
|
|
|
501
543
|
async function parseIntentWithDsh(brief, textModel) {
|
|
502
544
|
try {
|
|
503
545
|
const data = await api('/dsh/chat', { method: 'POST', body: {
|
|
504
|
-
system: '你是广告视频参数解析器。只输出 JSON,不要解释,不要 markdown。字段:aspect(9:16|16:9|1:1|4:3|3:4|21:9 或 null)、duration(整数秒或 null)、resolution(480p|720p|1080p 或 null)、generation_mode(fast|fine 或 null)、stitch(布尔,用户是否想把附件视频拼接)、reason(一句话)。只按用户明确表达解析,不要猜。',
|
|
546
|
+
system: '你是广告视频参数解析器。只输出 JSON,不要解释,不要 markdown。字段:aspect(9:16|16:9|1:1|4:3|3:4|21:9 或 null)、duration(整数秒或 null)、resolution(480p|720p|1080p 或 null)、generation_mode(fast|fine 或 null)、subtitle(off|sidecar|null,是否交付 SRT 旁挂字幕)、model_vendor(kling|ark|minimax|null,用户点名的厂商)、stitch(布尔,用户是否想把附件视频拼接)、reason(一句话)。只按用户明确表达解析,不要猜。',
|
|
505
547
|
messages: [{ role: 'user', content: [{ type: 'text', text: String(brief || '').slice(0, 1000) }] }],
|
|
506
548
|
maxTokens: 500,
|
|
507
549
|
provider: textModel && textModel.provider,
|
|
@@ -515,11 +557,14 @@ window.__ModuleLoader__.load({
|
|
|
515
557
|
const aspects = ['9:16', '16:9', '1:1', '4:3', '3:4', '21:9']
|
|
516
558
|
const resolutions = ['480p', '720p', '1080p']
|
|
517
559
|
const duration = Number(value.duration)
|
|
560
|
+
const vendors = ['kling', 'ark', 'minimax']
|
|
518
561
|
return {
|
|
519
562
|
aspect: aspects.includes(value.aspect) ? value.aspect : '',
|
|
520
563
|
duration: Number.isFinite(duration) && duration >= 1 && duration <= 30 ? duration : 0,
|
|
521
564
|
resolution: resolutions.includes(String(value.resolution || '').toLowerCase()) ? String(value.resolution).toLowerCase() : '',
|
|
522
565
|
mode: value.generation_mode === 'fine' ? 'fine' : '',
|
|
566
|
+
subtitle: ['off', 'sidecar'].includes(value.subtitle) ? value.subtitle : '',
|
|
567
|
+
vendor: vendors.includes(String(value.model_vendor || '')) ? String(value.model_vendor) : '',
|
|
523
568
|
stitch: Boolean(value.stitch),
|
|
524
569
|
}
|
|
525
570
|
} catch (e) { return null }
|
|
@@ -529,6 +574,21 @@ window.__ModuleLoader__.load({
|
|
|
529
574
|
return h('span', { className: 'adp-badge ' + (status || '') }, children)
|
|
530
575
|
}
|
|
531
576
|
|
|
577
|
+
const CAPABILITY_LABELS = {
|
|
578
|
+
text_to_video: '文生视频', image_to_video: '图生视频', reference_to_video: '参考视频',
|
|
579
|
+
text_to_image: '文生图', image_to_image: '图生图',
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/** One small chip per declared capability. */
|
|
583
|
+
function CapabilityChip({ capability }) {
|
|
584
|
+
return h('span', { className: 'adp-cap' }, CAPABILITY_LABELS[capability] || capability)
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
function CapabilityChips({ row }) {
|
|
588
|
+
const caps = (row && row.capabilities) || []
|
|
589
|
+
return h('span', { className: 'adp-caps' }, caps.map((cap) => h(CapabilityChip, { key: cap, capability: cap })))
|
|
590
|
+
}
|
|
591
|
+
|
|
532
592
|
/** Short label for the supervisor's bootstrap stage. */
|
|
533
593
|
function engineStageLabel(engine) {
|
|
534
594
|
const stage = engine && engine.boot && engine.boot.stage
|
|
@@ -757,19 +817,22 @@ window.__ModuleLoader__.load({
|
|
|
757
817
|
)
|
|
758
818
|
}
|
|
759
819
|
|
|
760
|
-
function AdvancedRow({ value, onChange, models }) {
|
|
820
|
+
function AdvancedRow({ value, onChange, models, needsDialogue }) {
|
|
761
821
|
const v = value || {}
|
|
762
822
|
const set = (key, val) => onChange(Object.assign({}, v, { [key]: val }))
|
|
763
|
-
const
|
|
823
|
+
const usableModels = (models || []).filter(m => m.available && m.enabled !== false)
|
|
824
|
+
const modelOptions = usableModels.map(m => ({ value: m.id, label: m.label }))
|
|
825
|
+
const currentModel = modelOptions.some(o => o.value === v.model) ? v.model : (modelOptions[0] ? modelOptions[0].value : '')
|
|
764
826
|
return h('div', { className: 'adp-col', style: { gap: 9 } },
|
|
765
827
|
h('div', { className: 'adp-field-grid g3' },
|
|
766
828
|
h(FormSelect, { label: '模式', value: v.generation_mode || 'fast', onChange: (x) => set('generation_mode', x), options: [{ value: 'fast', label: '快速 · 整条' }, { value: 'fine', label: '精细 · 分段' }] }),
|
|
767
829
|
h(FormSelect, { label: '时长(秒)', value: v.duration || 12, onChange: (x) => set('duration', Number(x)), options: [5, 8, 10, 12, 15, 30] }),
|
|
768
830
|
h(FormSelect, { label: '比例', value: v.aspect || '9:16', onChange: (x) => set('aspect', x), options: ['9:16', '16:9', '1:1', '4:3', '3:4', '21:9'] })
|
|
769
831
|
),
|
|
770
|
-
h('div', { className: 'adp-field-grid
|
|
832
|
+
h('div', { className: 'adp-field-grid g3' },
|
|
771
833
|
h(FormSelect, { label: '清晰度', value: v.resolution || '720p', onChange: (x) => set('resolution', x), options: ['480p', '720p', '1080p'] }),
|
|
772
|
-
h(FormSelect, { label: '模型', value:
|
|
834
|
+
h(FormSelect, { label: '模型', value: currentModel, onChange: (x) => set('model', x), options: modelOptions }),
|
|
835
|
+
h(FormSelect, { label: '字幕', value: v.subtitle || 'off', onChange: (x) => set('subtitle', x), options: [{ value: 'off', label: '不启用' }, { value: 'sidecar', label: 'SRT 旁挂' }] })
|
|
773
836
|
)
|
|
774
837
|
)
|
|
775
838
|
}
|
|
@@ -990,7 +1053,7 @@ window.__ModuleLoader__.load({
|
|
|
990
1053
|
h('div', { className: 'adp-h1' }, run.title || '成片'),
|
|
991
1054
|
h('div', { className: 'adp-small adp-muted' }, 'v' + (run.version || 1) + ' · ' + (adv.aspect || '9:16') + ' · ' + (adv.resolution || '720p') + (result.duration_s ? ' · ' + fmt(result.duration_s) : ''))
|
|
992
1055
|
),
|
|
993
|
-
h('div', { className: 'adp-result-badges' }, h(StatusBadge, { status: run.status })
|
|
1056
|
+
h('div', { className: 'adp-result-badges' }, h(StatusBadge, { status: run.status }))
|
|
994
1057
|
),
|
|
995
1058
|
run.error ? h('div', { className: 'adp-error' }, run.error) : null,
|
|
996
1059
|
h('div', { className: 'adp-result-grid' },
|
|
@@ -1117,8 +1180,7 @@ window.__ModuleLoader__.load({
|
|
|
1117
1180
|
const [products, setProducts] = useState([])
|
|
1118
1181
|
const [brief, setBrief] = useState('')
|
|
1119
1182
|
const [textModel, setTextModel] = useState(null)
|
|
1120
|
-
const [
|
|
1121
|
-
const [advanced, setAdvanced] = useState({ generation_mode: 'fast', duration: 12, aspect: '9:16', resolution: '720p', model: 'auto' })
|
|
1183
|
+
const [advanced, setAdvanced] = useState({ generation_mode: 'fast', duration: 12, aspect: '9:16', resolution: '720p', model: '' })
|
|
1122
1184
|
const [touched, setTouched] = useState({})
|
|
1123
1185
|
const [detected, setDetected] = useState(() => Object.assign(detectVideoParams(''), { stitch: false }))
|
|
1124
1186
|
const [persona, setPersona] = useState({ gender: 'any', age: 'youth', body_type: 'standard', ethnicity: 'asian' })
|
|
@@ -1128,31 +1190,38 @@ window.__ModuleLoader__.load({
|
|
|
1128
1190
|
const [personaBusy, setPersonaBusy] = useState(false)
|
|
1129
1191
|
const [polishBusy, setPolishBusy] = useState(false)
|
|
1130
1192
|
const [err, setErr] = useState('')
|
|
1131
|
-
const
|
|
1193
|
+
const usableModels = (models || []).filter((m) => m.available && m.enabled !== false)
|
|
1194
|
+
const hasRealModel = usableModels.length > 0
|
|
1132
1195
|
const selectedModel = (models || []).find((m) => m.id === advanced.model)
|
|
1133
|
-
const imageOnly = Boolean(selectedModel && !(selectedModel.
|
|
1196
|
+
const imageOnly = Boolean(selectedModel && !(selectedModel.capabilities || []).includes('text_to_video'))
|
|
1197
|
+
useEffect(() => {
|
|
1198
|
+
setAdvanced((prev) => {
|
|
1199
|
+
const usable = (models || []).filter((m) => m.available && m.enabled !== false)
|
|
1200
|
+
if (prev.model && usable.some((m) => m.id === prev.model)) return prev
|
|
1201
|
+
const pick = defaultModelId(models, true)
|
|
1202
|
+
return pick ? Object.assign({}, prev, { model: pick }) : prev
|
|
1203
|
+
})
|
|
1204
|
+
}, [models])
|
|
1134
1205
|
const selectedTextModel = textModel || defaultDshTextModel(dsh)
|
|
1135
1206
|
const selectedPersona = (personas || []).find((p) => p.id === personaId)
|
|
1136
1207
|
const dshReady = Boolean(dsh && dsh.available && (dsh.providers || []).length)
|
|
1137
1208
|
useEffect(() => { setDetected(Object.assign(detectVideoParams(brief), { stitch: /(拼接|拼起来|拼成|接起来|接到一起|合并|组合|连起来|插入|顺序拼|前后拼)/.test(brief) })) }, [brief])
|
|
1138
1209
|
const changeAdvanced = (next) => {
|
|
1139
1210
|
const changed = {}
|
|
1140
|
-
for (const key of ['aspect', 'duration', 'resolution', 'generation_mode']) {
|
|
1211
|
+
for (const key of ['aspect', 'duration', 'resolution', 'generation_mode', 'subtitle']) {
|
|
1141
1212
|
if (next[key] !== advanced[key]) changed[key] = true
|
|
1142
1213
|
}
|
|
1143
1214
|
if (Object.keys(changed).length) setTouched((prev) => Object.assign({}, prev, changed))
|
|
1144
1215
|
setAdvanced(next)
|
|
1145
1216
|
}
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
if (
|
|
1150
|
-
if (
|
|
1151
|
-
|
|
1152
|
-
if (
|
|
1153
|
-
if (
|
|
1154
|
-
if (touched.resolution && detected.resolution && detected.resolution !== advanced.resolution) conflicts.push('清晰度手动 ' + advanced.resolution + ' 覆盖描述 ' + detected.resolution)
|
|
1155
|
-
if (touched.generation_mode && detected.mode && detected.mode !== advanced.generation_mode) conflicts.push('模式手动覆盖描述识别')
|
|
1217
|
+
// The brief wins: every parameter it names replaces the control value, and
|
|
1218
|
+
// the list below says exactly what will change before the run starts.
|
|
1219
|
+
const overrides = []
|
|
1220
|
+
if (detected.aspect && detected.aspect !== advanced.aspect) overrides.push('比例 ' + detected.aspect + '(控件 ' + advanced.aspect + ')')
|
|
1221
|
+
if (detected.duration && Number(detected.duration) !== Number(advanced.duration)) overrides.push('时长 ' + detected.duration + 's(控件 ' + advanced.duration + 's)')
|
|
1222
|
+
if (detected.resolution && detected.resolution !== advanced.resolution) overrides.push('清晰度 ' + detected.resolution + '(控件 ' + advanced.resolution + ')')
|
|
1223
|
+
if (detected.mode && detected.mode !== advanced.generation_mode) overrides.push('模式 精细(控件 快速)')
|
|
1224
|
+
if (detected.subtitle && detected.subtitle !== (advanced.subtitle || 'off')) overrides.push('字幕 ' + subtitleLabel(detected.subtitle) + '(控件 ' + subtitleLabel(advanced.subtitle) + ')')
|
|
1156
1225
|
const savePersona = async () => {
|
|
1157
1226
|
setPersonaBusy(true); setErr('')
|
|
1158
1227
|
try {
|
|
@@ -1164,7 +1233,6 @@ window.__ModuleLoader__.load({
|
|
|
1164
1233
|
const start = async () => {
|
|
1165
1234
|
if (!refAsset) { setErr('请先上传参考视频'); return }
|
|
1166
1235
|
if (imageOnly && !products.length) { setErr('当前模型是图生视频,请先上传至少一张商品图'); return }
|
|
1167
|
-
if (!rights) { setErr('请确认有权使用这条参考视频'); return }
|
|
1168
1236
|
setBusy(true); setErr('')
|
|
1169
1237
|
try {
|
|
1170
1238
|
let smart = null
|
|
@@ -1175,13 +1243,18 @@ window.__ModuleLoader__.load({
|
|
|
1175
1243
|
if (smart.duration) next.duration = smart.duration
|
|
1176
1244
|
if (smart.resolution) next.resolution = smart.resolution
|
|
1177
1245
|
if (smart.mode) next.mode = smart.mode
|
|
1246
|
+
if (smart.subtitle) next.subtitle = smart.subtitle
|
|
1247
|
+
if (smart.vendor) next.vendor = smart.vendor
|
|
1178
1248
|
}
|
|
1179
1249
|
setDetected(next)
|
|
1180
1250
|
const merged = Object.assign({}, advanced)
|
|
1181
|
-
if (
|
|
1182
|
-
if (
|
|
1183
|
-
if (
|
|
1184
|
-
if (
|
|
1251
|
+
if (next.aspect) merged.aspect = next.aspect
|
|
1252
|
+
if (next.duration) merged.duration = next.duration
|
|
1253
|
+
if (next.resolution) merged.resolution = next.resolution
|
|
1254
|
+
if (next.mode) merged.generation_mode = next.mode
|
|
1255
|
+
if (next.subtitle) merged.subtitle = next.subtitle
|
|
1256
|
+
const vendorModel = modelForVendor(next.vendor, models)
|
|
1257
|
+
if (vendorModel) merged.model = vendorModel
|
|
1185
1258
|
if (selectedTextModel) merged.text_model = selectedTextModel
|
|
1186
1259
|
const personaPayload = personaEnabled ? { persona, persona_map: personaId ? { A: personaId, B: personaId } : {} } : {}
|
|
1187
1260
|
const data = await api('/runs', { method: 'POST', body: {
|
|
@@ -1216,7 +1289,7 @@ window.__ModuleLoader__.load({
|
|
|
1216
1289
|
h('p', { className: 'adp-lede' }, '把一条已验证的片子拆成结构和梗,换成你的商品、人物和台词。先给素材,再写要求,剩下的交给后台。')
|
|
1217
1290
|
),
|
|
1218
1291
|
h('div', { className: 'adp-page-meta' },
|
|
1219
|
-
h(Badge, { status: hasRealModel ? 'ok' : '
|
|
1292
|
+
h(Badge, { status: hasRealModel ? 'ok' : 'bad' }, hasRealModel ? '模型已就绪' : '未配置模型'),
|
|
1220
1293
|
h('span', null, '≤30s 参考片')
|
|
1221
1294
|
)
|
|
1222
1295
|
),
|
|
@@ -1268,18 +1341,13 @@ window.__ModuleLoader__.load({
|
|
|
1268
1341
|
)
|
|
1269
1342
|
)
|
|
1270
1343
|
),
|
|
1271
|
-
h('label', { className: 'adp-check' },
|
|
1272
|
-
h('input', { type: 'checkbox', checked: rights, onChange: (e) => setRights(e.currentTarget.checked) }),
|
|
1273
|
-
'我确认有权使用这条参考视频做二次创作'
|
|
1274
|
-
),
|
|
1275
1344
|
h('div', { className: 'adp-section-head' },
|
|
1276
1345
|
h('span', { className: 'adp-step' }, '03'),
|
|
1277
|
-
h('span', { className: 'adp-section-title' }, '生成设置')
|
|
1278
|
-
h('span', { className: 'adp-section-note' }, '默认值可直接开')
|
|
1346
|
+
h('span', { className: 'adp-section-title' }, '生成设置')
|
|
1279
1347
|
),
|
|
1280
|
-
h(AdvancedRow, { value: advanced, onChange: changeAdvanced, models }),
|
|
1348
|
+
h(AdvancedRow, { value: advanced, onChange: changeAdvanced, models, needsDialogue: true }),
|
|
1281
1349
|
imageOnly ? h('div', { className: 'adp-hint' }, '当前模型是图生视频:需要至少一张商品图;无原生音频。') : null,
|
|
1282
|
-
|
|
1350
|
+
overrides.length ? h('div', { className: 'adp-conflict', style: { margin: '7px 0 0' } }, h('b', null, '描述优先'), overrides.join(';')) : null,
|
|
1283
1351
|
h('div', { className: 'adp-section-head' },
|
|
1284
1352
|
h('span', { className: 'adp-step' }, '04'),
|
|
1285
1353
|
h('span', { className: 'adp-section-title' }, '模特'),
|
|
@@ -1316,12 +1384,12 @@ window.__ModuleLoader__.load({
|
|
|
1316
1384
|
),
|
|
1317
1385
|
h('div', { className: 'adp-actionbar' },
|
|
1318
1386
|
h('div', { className: 'adp-action-note' },
|
|
1319
|
-
!refAsset ? h('span', { style: { color: '#C99B54' } }, '先上传参考视频。') :
|
|
1387
|
+
!refAsset ? h('span', { style: { color: '#C99B54' } }, '先上传参考视频。') : (hasRealModel ? '将使用已配置的模型;生成通常需要几分钟。' : '还没有可用的视频模型,先去「设置」里配置厂商 key。'),
|
|
1320
1388
|
h('br'),
|
|
1321
1389
|
'开始后可在结果页看分镜、派生新版本或拼接。'
|
|
1322
1390
|
),
|
|
1323
1391
|
h('div', { className: 'adp-grow' }),
|
|
1324
|
-
h('button', { className: 'adp-primary', onClick: start, disabled: busy || !refAsset
|
|
1392
|
+
h('button', { className: 'adp-primary', onClick: start, disabled: busy || !refAsset },
|
|
1325
1393
|
busy ? '正在启动…' : '开始复刻',
|
|
1326
1394
|
h('span', { className: 'arrow' }, '→')
|
|
1327
1395
|
)
|
|
@@ -1356,7 +1424,7 @@ window.__ModuleLoader__.load({
|
|
|
1356
1424
|
const [mode, setMode] = useState('video')
|
|
1357
1425
|
const [textModel, setTextModel] = useState(null)
|
|
1358
1426
|
const [files, setFiles] = useState([])
|
|
1359
|
-
const [advanced, setAdvanced] = useState({ generation_mode: 'fast', duration: 8, aspect: '9:16', resolution: '720p', model: '
|
|
1427
|
+
const [advanced, setAdvanced] = useState({ generation_mode: 'fast', duration: 8, aspect: '9:16', resolution: '720p', model: '' })
|
|
1360
1428
|
const [showAdvanced, setShowAdvanced] = useState(false)
|
|
1361
1429
|
const [touched, setTouched] = useState({})
|
|
1362
1430
|
const [busy, setBusy] = useState(false)
|
|
@@ -1369,27 +1437,34 @@ window.__ModuleLoader__.load({
|
|
|
1369
1437
|
const selectedTextModel = textModel || defaultDshTextModel(dsh)
|
|
1370
1438
|
const stitchIntent = Boolean(detected.stitch)
|
|
1371
1439
|
const selectedModel = (models || []).find((m) => m.id === advanced.model)
|
|
1372
|
-
const imageOnly = Boolean(selectedModel && !(selectedModel.
|
|
1373
|
-
|
|
1440
|
+
const imageOnly = Boolean(selectedModel && !(selectedModel.capabilities || []).includes('text_to_video'))
|
|
1441
|
+
useEffect(() => {
|
|
1442
|
+
setAdvanced((prev) => {
|
|
1443
|
+
const usable = (models || []).filter((m) => m.available && m.enabled !== false)
|
|
1444
|
+
if (prev.model && usable.some((m) => m.id === prev.model)) return prev
|
|
1445
|
+
const pick = defaultModelId(models, false)
|
|
1446
|
+
return pick ? Object.assign({}, prev, { model: pick }) : prev
|
|
1447
|
+
})
|
|
1448
|
+
}, [models])
|
|
1449
|
+
const modelOptions = (models || []).filter((m) => m.available && m.enabled !== false).map((m) => ({ value: m.id, label: m.label }))
|
|
1450
|
+
const currentModel = modelOptions.some((o) => o.value === advanced.model) ? advanced.model : (modelOptions[0] ? modelOptions[0].value : '')
|
|
1374
1451
|
const detectedLabels = []
|
|
1375
1452
|
if (detected.aspect) detectedLabels.push(detected.aspect)
|
|
1376
1453
|
if (detected.duration) detectedLabels.push(detected.duration + 's')
|
|
1377
1454
|
if (detected.resolution) detectedLabels.push(detected.resolution)
|
|
1378
1455
|
if (detected.mode === 'fine') detectedLabels.push('精细')
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
if (
|
|
1383
|
-
if (
|
|
1384
|
-
|
|
1385
|
-
if (
|
|
1386
|
-
if (
|
|
1387
|
-
if (touched.resolution && detected.resolution && detected.resolution !== advanced.resolution) conflicts.push('清晰度手动 ' + advanced.resolution + ' 覆盖描述 ' + detected.resolution)
|
|
1388
|
-
if (touched.generation_mode && detected.mode && detected.mode !== advanced.generation_mode) conflicts.push('模式手动覆盖描述识别')
|
|
1456
|
+
// The brief wins: every parameter it names replaces the control value, and
|
|
1457
|
+
// the list below says exactly what will change before the run starts.
|
|
1458
|
+
const overrides = []
|
|
1459
|
+
if (detected.aspect && detected.aspect !== advanced.aspect) overrides.push('比例 ' + detected.aspect + '(控件 ' + advanced.aspect + ')')
|
|
1460
|
+
if (detected.duration && Number(detected.duration) !== Number(advanced.duration)) overrides.push('时长 ' + detected.duration + 's(控件 ' + advanced.duration + 's)')
|
|
1461
|
+
if (detected.resolution && detected.resolution !== advanced.resolution) overrides.push('清晰度 ' + detected.resolution + '(控件 ' + advanced.resolution + ')')
|
|
1462
|
+
if (detected.mode && detected.mode !== advanced.generation_mode) overrides.push('模式 精细(控件 快速)')
|
|
1463
|
+
if (detected.subtitle && detected.subtitle !== (advanced.subtitle || 'off')) overrides.push('字幕 ' + subtitleLabel(detected.subtitle) + '(控件 ' + subtitleLabel(advanced.subtitle) + ')')
|
|
1389
1464
|
const changeAdvanced = (patch) => {
|
|
1390
1465
|
const next = Object.assign({}, advanced, patch)
|
|
1391
1466
|
const changed = {}
|
|
1392
|
-
for (const key of ['aspect', 'duration', 'resolution', 'generation_mode']) {
|
|
1467
|
+
for (const key of ['aspect', 'duration', 'resolution', 'generation_mode', 'subtitle']) {
|
|
1393
1468
|
if (next[key] !== advanced[key]) changed[key] = true
|
|
1394
1469
|
}
|
|
1395
1470
|
if (Object.keys(changed).length) setTouched((prev) => Object.assign({}, prev, changed))
|
|
@@ -1425,14 +1500,19 @@ window.__ModuleLoader__.load({
|
|
|
1425
1500
|
if (smart.duration) next.duration = smart.duration
|
|
1426
1501
|
if (smart.resolution) next.resolution = smart.resolution
|
|
1427
1502
|
if (smart.mode) next.mode = smart.mode
|
|
1503
|
+
if (smart.subtitle) next.subtitle = smart.subtitle
|
|
1504
|
+
if (smart.vendor) next.vendor = smart.vendor
|
|
1428
1505
|
}
|
|
1429
1506
|
next.stitch = Boolean((smart && smart.stitch) || detected.stitch || /(拼接|拼起来|拼成|接起来|接到一起|合并|组合|连起来|插入|顺序拼|前后拼)/.test(brief))
|
|
1430
1507
|
setDetected(next)
|
|
1431
1508
|
const merged = Object.assign({}, advanced)
|
|
1432
|
-
if (
|
|
1433
|
-
if (
|
|
1434
|
-
if (
|
|
1435
|
-
if (
|
|
1509
|
+
if (next.aspect) merged.aspect = next.aspect
|
|
1510
|
+
if (next.duration) merged.duration = next.duration
|
|
1511
|
+
if (next.resolution) merged.resolution = next.resolution
|
|
1512
|
+
if (next.mode) merged.generation_mode = next.mode
|
|
1513
|
+
if (next.subtitle) merged.subtitle = next.subtitle
|
|
1514
|
+
const vendorModel = modelForVendor(next.vendor, models)
|
|
1515
|
+
if (vendorModel) merged.model = vendorModel
|
|
1436
1516
|
if (next.stitch) {
|
|
1437
1517
|
if (videos.length < 2) { setErr('要拼接请至少上传两段视频'); return }
|
|
1438
1518
|
const data = await api('/stitch', { method: 'POST', body: {
|
|
@@ -1457,17 +1537,17 @@ window.__ModuleLoader__.load({
|
|
|
1457
1537
|
const imageAvailable = (imageModels || []).some((m) => m.available)
|
|
1458
1538
|
const modeTabs = h('div', { className: 'adp-create-tabs' },
|
|
1459
1539
|
h('button', { className: 'adp-create-tab' + (mode === 'video' ? ' on' : ''), onClick: () => setMode('video') }, '文生视频'),
|
|
1460
|
-
h('button', { className: 'adp-create-tab' + (mode === 'image' ? ' on' : ''), disabled: !imageAvailable, title: imageAvailable ? '用文字生成图片' : '
|
|
1540
|
+
h('button', { className: 'adp-create-tab' + (mode === 'image' ? ' on' : ''), disabled: !imageAvailable, title: imageAvailable ? '用文字生成图片' : '先在设置里配置图片模型厂商 key', onClick: () => imageAvailable && setMode('image') }, '文生图片', !imageAvailable ? h('span', { className: 'adp-create-tab-note' }, '未配置图片模型') : null)
|
|
1461
1541
|
)
|
|
1462
1542
|
const pageHead = h('div', { className: 'adp-page-head' },
|
|
1463
1543
|
h('div', null,
|
|
1464
1544
|
h('div', { className: 'adp-eyebrow' }, 'FREE CREATE'),
|
|
1465
1545
|
h('h1', { className: 'adp-title' }, '自由创作'),
|
|
1466
|
-
h('p', { className: 'adp-lede' }, '
|
|
1546
|
+
h('p', { className: 'adp-lede adp-nowrap', title: '文生视频出成片;文生图片出商品图。参数可直接写在描述里。' }, '文生视频出成片;文生图片出商品图。参数可直接写在描述里。')
|
|
1467
1547
|
)
|
|
1468
1548
|
)
|
|
1469
1549
|
if (mode === 'image') {
|
|
1470
|
-
return h('div', { className: 'adp-page' }, pageHead, modeTabs, h(ImagePanel, { imageModels, onStarted }))
|
|
1550
|
+
return h('div', { className: 'adp-page' }, pageHead, modeTabs, h(ImagePanel, { imageModels, onStarted, onRefreshAssets }))
|
|
1471
1551
|
}
|
|
1472
1552
|
return h('div', { className: 'adp-page' },
|
|
1473
1553
|
pageHead,
|
|
@@ -1498,11 +1578,11 @@ window.__ModuleLoader__.load({
|
|
|
1498
1578
|
h('input', { ref: input, type: 'file', accept: 'image/*,video/*', multiple: true, onChange: upload, style: { display: 'none' } })
|
|
1499
1579
|
),
|
|
1500
1580
|
detectedLabels.length ? h('div', { className: 'adp-detected' }, h('span', null, '从描述识别'), detectedLabels.map((label) => h('span', { key: label, className: 'adp-detected-chip' }, label))) : null,
|
|
1501
|
-
|
|
1581
|
+
overrides.length ? h('div', { className: 'adp-conflict' }, h('b', null, '描述优先'), overrides.join(';')) : null,
|
|
1502
1582
|
h('div', { className: 'adp-composer-foot' },
|
|
1503
1583
|
h('div', { className: 'adp-row' },
|
|
1504
1584
|
h(TextModelSelect, { dsh, value: selectedTextModel, onChange: setTextModel }),
|
|
1505
|
-
h('select', { className: 'adp-select adp-model-select', value:
|
|
1585
|
+
h('select', { className: 'adp-select adp-model-select', value: currentModel, onChange: (e) => setAdvanced(Object.assign({}, advanced, { model: e.currentTarget.value })) },
|
|
1506
1586
|
modelOptions.map((o) => h('option', { key: o.value, value: o.value }, o.label))
|
|
1507
1587
|
),
|
|
1508
1588
|
h('button', { className: 'adp-btn ghost', onClick: () => setShowAdvanced((v) => !v) }, showAdvanced ? '收起参数' : '参数'),
|
|
@@ -1515,30 +1595,38 @@ window.__ModuleLoader__.load({
|
|
|
1515
1595
|
)
|
|
1516
1596
|
),
|
|
1517
1597
|
showAdvanced ? h('div', { className: 'adp-advanced-panel' },
|
|
1518
|
-
h('div', { className: 'adp-section-head' }, h('span', { className: 'adp-section-title' }, '生成参数')
|
|
1519
|
-
h(
|
|
1520
|
-
h(FormSelect, { label: '模式', value: advanced.generation_mode, onChange: (x) => changeAdvanced({ generation_mode: x }), options: [{ value: 'fast', label: '快速 · 整条' }, { value: 'fine', label: '精细 · 分段' }] }),
|
|
1521
|
-
h(FormSelect, { label: '时长(秒)', value: advanced.duration, onChange: (x) => changeAdvanced({ duration: Number(x) }), options: [5, 8, 10, 12, 15, 30] }),
|
|
1522
|
-
h(FormSelect, { label: '比例', value: advanced.aspect, onChange: (x) => changeAdvanced({ aspect: x }), options: ['9:16', '16:9', '1:1', '4:3', '3:4', '21:9'] })
|
|
1523
|
-
),
|
|
1524
|
-
h('div', { className: 'adp-field-grid g2' },
|
|
1525
|
-
h(FormSelect, { label: '清晰度', value: advanced.resolution, onChange: (x) => changeAdvanced({ resolution: x }), options: ['480p', '720p', '1080p'] })
|
|
1526
|
-
),
|
|
1598
|
+
h('div', { className: 'adp-section-head' }, h('span', { className: 'adp-section-title' }, '生成参数')),
|
|
1599
|
+
h(AdvancedRow, { value: advanced, onChange: (next) => changeAdvanced(next), models, needsDialogue: false }),
|
|
1527
1600
|
imageOnly ? h('div', { className: 'adp-hint' }, '当前模型是图生视频:需要图片附件;它不生成原生音频。') : null
|
|
1528
1601
|
) : null,
|
|
1529
1602
|
err ? h('div', { className: 'adp-error' }, err) : null
|
|
1530
1603
|
)
|
|
1531
1604
|
}
|
|
1532
1605
|
|
|
1533
|
-
function ImagePanel({ imageModels, onStarted }) {
|
|
1534
|
-
const available = (imageModels || []).filter((m) => m.available)
|
|
1606
|
+
function ImagePanel({ imageModels, onStarted, onRefreshAssets }) {
|
|
1607
|
+
const available = (imageModels || []).filter((m) => m.available && (m.capabilities || []).includes('text_to_image'))
|
|
1535
1608
|
const [prompt, setPrompt] = useState('')
|
|
1536
1609
|
const [model, setModel] = useState(available[0] ? available[0].id : '')
|
|
1537
1610
|
const [aspect, setAspect] = useState('1:1')
|
|
1538
1611
|
const [area, setArea] = useState('2K')
|
|
1539
1612
|
const [busy, setBusy] = useState(false)
|
|
1540
1613
|
const [err, setErr] = useState('')
|
|
1614
|
+
const [refAsset, setRefAsset] = useState(null)
|
|
1615
|
+
const [refBusy, setRefBusy] = useState(false)
|
|
1541
1616
|
const selected = available.find((m) => m.id === model) || available[0]
|
|
1617
|
+
const takesReference = Boolean(selected && (selected.capabilities || []).includes('image_to_image'))
|
|
1618
|
+
const uploadReference = async (event) => {
|
|
1619
|
+
const file = (event.currentTarget.files || [])[0]
|
|
1620
|
+
event.currentTarget.value = ''
|
|
1621
|
+
if (!file) return
|
|
1622
|
+
if (!file.type.startsWith('image/')) { setErr('参考图只支持图片文件'); return }
|
|
1623
|
+
setRefBusy(true); setErr('')
|
|
1624
|
+
try {
|
|
1625
|
+
const asset = await uploadFile(file, 'image')
|
|
1626
|
+
setRefAsset(asset)
|
|
1627
|
+
onRefreshAssets && await onRefreshAssets()
|
|
1628
|
+
} catch (e) { setErr(String(e.message || e)) } finally { setRefBusy(false) }
|
|
1629
|
+
}
|
|
1542
1630
|
useEffect(() => {
|
|
1543
1631
|
if (!selected && available.length) { setModel(available[0].id); setArea(available[0].default_area || '2K') }
|
|
1544
1632
|
if (selected && selected.default_area && !(selected.areas || []).includes(area)) setArea(selected.default_area)
|
|
@@ -1547,12 +1635,12 @@ window.__ModuleLoader__.load({
|
|
|
1547
1635
|
if (!prompt.trim()) { setErr('先描述你想生成的图片'); return }
|
|
1548
1636
|
setBusy(true); setErr('')
|
|
1549
1637
|
try {
|
|
1550
|
-
const data = await api('/images', { method: 'POST', body: { prompt: prompt.trim(), model: selected ? selected.id : '', aspect, area } })
|
|
1638
|
+
const data = await api('/images', { method: 'POST', body: { prompt: prompt.trim(), model: selected ? selected.id : '', aspect, area, reference_asset_id: takesReference && refAsset ? refAsset.id : '' } })
|
|
1551
1639
|
onStarted(data.run)
|
|
1552
1640
|
} catch (e) { setErr(String(e.message || e)) } finally { setBusy(false) }
|
|
1553
1641
|
}
|
|
1554
1642
|
if (!available.length) {
|
|
1555
|
-
return h('div', { className: 'adp-card adp-col' }, h('div', { className: 'adp-h2' }, '暂无可用图片模型'), h('div', { className: 'adp-small adp-muted' }, '
|
|
1643
|
+
return h('div', { className: 'adp-card adp-col' }, h('div', { className: 'adp-h2' }, '暂无可用图片模型'), h('div', { className: 'adp-small adp-muted' }, '到「设置」里配置 MiniMax 或火山方舟的 key 后,图片模型会出现在这里。'))
|
|
1556
1644
|
}
|
|
1557
1645
|
return h('div', { className: 'adp-composer' },
|
|
1558
1646
|
h('div', { className: 'adp-composer-head' }, h('span', { className: 'adp-composer-label' }, '描述图片'), h('span', { className: 'adp-composer-count' }, prompt.length + ' / 1000')),
|
|
@@ -1563,7 +1651,15 @@ window.__ModuleLoader__.load({
|
|
|
1563
1651
|
available.map((m) => h('option', { key: m.id, value: m.id }, m.label))
|
|
1564
1652
|
),
|
|
1565
1653
|
h('select', { className: 'adp-select', value: aspect, onChange: (e) => setAspect(e.currentTarget.value) }, (selected ? selected.aspects : ['1:1']).map((x) => h('option', { key: x, value: x }, x))),
|
|
1566
|
-
h('select', { className: 'adp-select', value: area, onChange: (e) => setArea(e.currentTarget.value) }, (selected ? selected.areas : ['2K']).map((x) => h('option', { key: x, value: x }, x)))
|
|
1654
|
+
h('select', { className: 'adp-select', value: area, onChange: (e) => setArea(e.currentTarget.value) }, (selected ? selected.areas : ['2K']).map((x) => h('option', { key: x, value: x }, x))),
|
|
1655
|
+
takesReference ? h('label', { className: 'adp-ref-upload' + (refAsset ? ' has' : ''), title: '可选:上传一张参考图,按图生图生成' },
|
|
1656
|
+
refBusy ? h('span', null, '上传中…')
|
|
1657
|
+
: refAsset
|
|
1658
|
+
? h('span', { className: 'adp-ref-chip' }, h('img', { src: mediaUrl(refAsset.path), alt: refAsset.name }), h('span', { className: 'adp-ref-name' }, refAsset.name))
|
|
1659
|
+
: h('span', null, '+ 参考图(可选)'),
|
|
1660
|
+
h('input', { type: 'file', accept: 'image/*', onChange: uploadReference, disabled: refBusy, style: { position: 'absolute', width: 1, height: 1, opacity: 0, clip: 'rect(0 0 0 0)', overflow: 'hidden' } })
|
|
1661
|
+
) : null,
|
|
1662
|
+
refAsset && takesReference ? h('button', { className: 'adp-btn ghost', onClick: () => setRefAsset(null), title: '移除参考图' }, '移除') : null
|
|
1567
1663
|
),
|
|
1568
1664
|
h('button', { className: 'adp-primary', onClick: start, disabled: busy }, busy ? '生成中…' : '生成图片', h('span', { className: 'arrow' }, '→'))
|
|
1569
1665
|
),
|
|
@@ -1928,8 +2024,8 @@ window.__ModuleLoader__.load({
|
|
|
1928
2024
|
api('/settings/keys').then((d) => setKeys(d.keys || [])).catch((e) => setErr(String(e.message || e)))
|
|
1929
2025
|
}, [])
|
|
1930
2026
|
const providers = [
|
|
1931
|
-
{ id: 'minimax', name: 'MiniMax', key: 'MINIMAX_API_KEY', desc: 'H3 原生对白 / Hailuo 图生视频' },
|
|
1932
|
-
{ id: 'ark', name: '火山方舟', key: 'ARK_API_KEY', desc: 'Seedance 2.5 / 2.0' },
|
|
2027
|
+
{ id: 'minimax', name: 'MiniMax', key: 'MINIMAX_API_KEY', desc: 'H3 原生对白 / Hailuo 图生视频 / H3 Image' },
|
|
2028
|
+
{ id: 'ark', name: '火山方舟', key: 'ARK_API_KEY', desc: 'Seedance 2.5 / 2.0 · Seedream 4.0' },
|
|
1933
2029
|
{ id: 'kling', name: 'Kling 可灵', key: 'KLING_API_KEY', desc: 'Kling v3 原生音频' },
|
|
1934
2030
|
]
|
|
1935
2031
|
const statusFor = (name) => (keys || []).find((k) => k.name === name) || { present: false, masked: '' }
|
|
@@ -1976,7 +2072,7 @@ window.__ModuleLoader__.load({
|
|
|
1976
2072
|
h('div', null,
|
|
1977
2073
|
h('div', { className: 'adp-eyebrow' }, 'SETTINGS / MODELS'),
|
|
1978
2074
|
h('h1', { className: 'adp-title' }, '设置与模型'),
|
|
1979
|
-
h('p', { className: 'adp-lede' }, '
|
|
2075
|
+
h('p', { className: 'adp-lede' }, '视频与图片模型;勾选后才会出现在生成页。文本模型由 DSH 提供,在创作页选择。')
|
|
1980
2076
|
),
|
|
1981
2077
|
h('div', { className: 'adp-row' }, health ? h(Badge, { status: health.ok ? 'ok' : 'bad' }, health.ok ? '引擎在线' : '引擎离线') : null, h('button', { className: 'adp-btn', onClick: refresh, disabled: refreshing }, refreshing ? '刷新中…' : '刷新模型'), h('button', { className: 'adp-btn ghost', onClick: async () => { try { await api('/reveal', { method: 'POST', body: { path: '' } }) } catch (e) { setErr(String(e.message || e)) } } }, '打开数据文件夹'))
|
|
1982
2078
|
),
|
|
@@ -2024,8 +2120,8 @@ window.__ModuleLoader__.load({
|
|
|
2024
2120
|
!openModelsForProvider && enabledProviderModels.length ? h('div', { className: 'adp-model-summary' }, enabledProviderModels.map((m) => h('span', { key: m.id, className: 'adp-model-summary-chip' }, m.label))) : null,
|
|
2025
2121
|
openModelsForProvider ? h('div', { className: 'adp-provider-models' },
|
|
2026
2122
|
providerModels.length ? providerModels.map((m) => h('div', { key: m.id, className: 'adp-provider-model' + (m.available ? ' on' : '') + (m.enabled === false ? ' off' : '') },
|
|
2027
|
-
h('div', null, h('div', { className: 'adp-provider-model-name' }, m.label), h(
|
|
2028
|
-
h('div', { className: 'adp-row', style: { gap: 5 } }, m.available ? h(Badge, { status: 'ok' }, '可用') : h(Badge,
|
|
2123
|
+
h('div', null, h('div', { className: 'adp-provider-model-name' }, m.label), h(CapabilityChips, { row: m })),
|
|
2124
|
+
h('div', { className: 'adp-row', style: { gap: 5 } }, m.available ? h(Badge, { status: 'ok' }, '可用') : h(Badge, { title: m.reason || '' }, '待 key'), m.native_audio ? h('span', { className: 'adp-small adp-muted' }, '原生对白') : null, h('label', { className: 'adp-model-enable' }, h('input', { type: 'checkbox', checked: m.enabled !== false, disabled: busy === 'models', onChange: () => toggleModel(m), title: '是否出现在生成页' }), '启用'))
|
|
2029
2125
|
)) : h('div', { className: 'adp-small adp-muted' }, '该厂商暂无可展示模型;保存 key 后刷新。')
|
|
2030
2126
|
) : null
|
|
2031
2127
|
)
|
|
@@ -2033,12 +2129,12 @@ window.__ModuleLoader__.load({
|
|
|
2033
2129
|
notice ? h('div', { className: 'adp-notice' }, notice) : null,
|
|
2034
2130
|
err ? h('div', { className: 'adp-error', style: { marginTop: 10 } }, err) : null,
|
|
2035
2131
|
h('div', { className: 'adp-section-head', style: { marginTop: 20 } }, h('span', { className: 'adp-step' }, '02'), h('span', { className: 'adp-section-title' }, '其他模型'), h('span', { className: 'adp-section-note' }, '未接入或可选通道')),
|
|
2036
|
-
h('table', { className: 'adp-table' }, h('thead', null, h('tr', null, h('th', null, '模型'), h('th', null, '
|
|
2037
|
-
h('div', { className: 'adp-hint', style: { marginTop: 12 } }, '
|
|
2132
|
+
h('table', { className: 'adp-table' }, h('thead', null, h('tr', null, h('th', null, '模型'), h('th', null, '能力'), h('th', null, '状态'), h('th', null, '启用'))), h('tbody', null, otherModels.map((m) => h('tr', { key: m.id }, h('td', null, m.label), h('td', null, h(CapabilityChips, { row: m })), h('td', null, h(Badge, { title: m.reason || '' }, '未接入')), h('td', null, h('label', { className: 'adp-model-enable' }, h('input', { type: 'checkbox', checked: m.enabled !== false, disabled: busy === 'models', onChange: () => toggleModel(m) }), '启用')))))),
|
|
2133
|
+
h('div', { className: 'adp-hint', style: { marginTop: 12 } }, '密钥只保存在本机数据目录的 settings.json(权限 0600);不会回显完整值。生产版应迁移到系统 Keychain。')
|
|
2038
2134
|
)
|
|
2039
2135
|
}
|
|
2040
2136
|
|
|
2041
|
-
class
|
|
2137
|
+
class AdClipBoundary extends React.Component {
|
|
2042
2138
|
constructor(props) {
|
|
2043
2139
|
super(props)
|
|
2044
2140
|
this.state = { error: null }
|
|
@@ -2055,7 +2151,7 @@ window.__ModuleLoader__.load({
|
|
|
2055
2151
|
h('style', null, CSS),
|
|
2056
2152
|
h('div', { className: 'adp-crash' },
|
|
2057
2153
|
h('div', { className: 'box' },
|
|
2058
|
-
h('h3', null, '
|
|
2154
|
+
h('h3', null, 'AdClip UI 加载失败'),
|
|
2059
2155
|
h('div', null, String(this.state.error && (this.state.error.stack || this.state.error.message || this.state.error))),
|
|
2060
2156
|
h('div', { style: { marginTop: 12 } }, h('button', { className: 'adp-btn', onClick: () => location.reload() }, '重新加载'))
|
|
2061
2157
|
)
|
|
@@ -2071,7 +2167,6 @@ window.__ModuleLoader__.load({
|
|
|
2071
2167
|
const [health, setHealth] = useState(null)
|
|
2072
2168
|
const [models, setModels] = useState([])
|
|
2073
2169
|
const [dsh, setDsh] = useState(null)
|
|
2074
|
-
const [imageModels, setImageModels] = useState([])
|
|
2075
2170
|
const [runs, setRuns] = useState([])
|
|
2076
2171
|
const [assets, setAssets] = useState([])
|
|
2077
2172
|
const [personas, setPersonas] = useState([])
|
|
@@ -2084,8 +2179,8 @@ window.__ModuleLoader__.load({
|
|
|
2084
2179
|
if (state) setEngine(state)
|
|
2085
2180
|
if (state && !state.ok) return
|
|
2086
2181
|
try {
|
|
2087
|
-
const [h, m, r, a, p, d
|
|
2088
|
-
setHealth(h); setModels(m.models || []); setRuns(r.runs || []); setAssets(a.assets || []); setPersonas(p.personas || []); setDsh(d.dsh || null)
|
|
2182
|
+
const [h, m, r, a, p, d] = await Promise.all([api('/health'), api('/models'), api('/runs?limit=20'), api('/assets?limit=60'), api('/personas'), api('/dsh/models').catch(() => ({ dsh: null }))])
|
|
2183
|
+
setHealth(h); setModels(m.models || []); setRuns(r.runs || []); setAssets(a.assets || []); setPersonas(p.personas || []); setDsh(d.dsh || null)
|
|
2089
2184
|
setSelected(prev => prev ? (r.runs || []).find(x => x.id === prev.id) || prev : null)
|
|
2090
2185
|
} catch (e) { setErr(String(e.message || e)) }
|
|
2091
2186
|
}, [])
|
|
@@ -2108,6 +2203,10 @@ window.__ModuleLoader__.load({
|
|
|
2108
2203
|
return () => clearInterval(timer)
|
|
2109
2204
|
}, [selected && selected.id, selected && selected.status])
|
|
2110
2205
|
|
|
2206
|
+
// One catalogue, two views: generation pages filter on kind + capability.
|
|
2207
|
+
const videoModels = (models || []).filter((m) => m.kind === 'video')
|
|
2208
|
+
const imageModels = (models || []).filter((m) => m.kind === 'image')
|
|
2209
|
+
|
|
2111
2210
|
const openRun = (run) => { setSelected(run) }
|
|
2112
2211
|
const started = (run) => { setSelected(run); void refresh() }
|
|
2113
2212
|
|
|
@@ -2135,8 +2234,8 @@ window.__ModuleLoader__.load({
|
|
|
2135
2234
|
: null,
|
|
2136
2235
|
err ? h('div', { className: 'adp-error' }, err) : null,
|
|
2137
2236
|
selected ? h(ResultPanel, { run: selected, onChanged: started, onBack: () => setSelected(null), assets }) : null,
|
|
2138
|
-
h('div', { style: { display: (!selected && tab === 'recreate') ? 'block' : 'none' } }, h(RecreateTab, { models, dsh, onStarted: started, personas, onRefreshPersonas: refresh })),
|
|
2139
|
-
h('div', { style: { display: (!selected && tab === 'text') ? 'block' : 'none' } }, h(TextTab, { models, dsh, imageModels, onStarted: started, assets, onRefreshAssets: refresh })),
|
|
2237
|
+
h('div', { style: { display: (!selected && tab === 'recreate') ? 'block' : 'none' } }, h(RecreateTab, { models: videoModels, dsh, onStarted: started, personas, onRefreshPersonas: refresh })),
|
|
2238
|
+
h('div', { style: { display: (!selected && tab === 'text') ? 'block' : 'none' } }, h(TextTab, { models: videoModels, dsh, imageModels, onStarted: started, assets, onRefreshAssets: refresh })),
|
|
2140
2239
|
!selected && tab === 'assets' ? h(AssetsTab, { onRefresh: refresh }) : null,
|
|
2141
2240
|
!selected && tab === 'personas' ? h(PersonasTab, { personas, onRefresh: refresh }) : null,
|
|
2142
2241
|
!selected && tab === 'tasks' ? h(TasksTab, { onOpen: openRun }) : null,
|
|
@@ -2149,8 +2248,8 @@ window.__ModuleLoader__.load({
|
|
|
2149
2248
|
return {
|
|
2150
2249
|
inject: ['slots'],
|
|
2151
2250
|
apply(ctx) {
|
|
2152
|
-
ctx.slots.inject('main', () => ctx.slots.register({ name: 'main', key: 'adplus' }, () => h(
|
|
2153
|
-
ctx.slots.inject('sidebar.panellist', () => ctx.slots.register({ name: 'sidebar.panellist', id: 'adplus', order: 30, label: () => '
|
|
2251
|
+
ctx.slots.inject('main', () => ctx.slots.register({ name: 'main', key: 'adplus' }, () => h(AdClipBoundary, null, h(App))))
|
|
2252
|
+
ctx.slots.inject('sidebar.panellist', () => ctx.slots.register({ name: 'sidebar.panellist', id: 'adplus', order: 30, label: () => 'AdClip' }, Icon))
|
|
2154
2253
|
},
|
|
2155
2254
|
}
|
|
2156
2255
|
},
|