fix: polish regeneration controls
This commit is contained in:
@@ -776,6 +776,33 @@
|
|||||||
"message": "feat: add audit database and safer image review",
|
"message": "feat: add audit database and safer image review",
|
||||||
"hash": "a4fffd4",
|
"hash": "a4fffd4",
|
||||||
"files_changed": 23
|
"files_changed": 23
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ts": "2026-05-19T14:33:52+08:00",
|
||||||
|
"type": "commit",
|
||||||
|
"message": "feat: add audit database and safer image review",
|
||||||
|
"hash": "9ab7756",
|
||||||
|
"files_changed": 23
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ts": "2026-05-19T06:40:03Z",
|
||||||
|
"type": "session-heartbeat",
|
||||||
|
"message": "Codex 会话活跃 · 最近命令:codex · 分支 master · 2 项未提交变更 · 最近提交:feat: add audit database and safer image review",
|
||||||
|
"files_changed": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ts": "2026-05-19T14:40:13+08:00",
|
||||||
|
"type": "commit",
|
||||||
|
"message": "auto-save 2026-05-19 14:40 (~2)",
|
||||||
|
"hash": "d6af010",
|
||||||
|
"files_changed": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ts": "2026-05-19T14:45:02+08:00",
|
||||||
|
"type": "commit",
|
||||||
|
"message": "fix: polish regeneration controls",
|
||||||
|
"hash": "254c2c3",
|
||||||
|
"files_changed": 2
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,10 +33,6 @@ function aspectCss(aspectRatio: AssetTemplate['aspectRatio'] | string | undefine
|
|||||||
return aspectRatio.replace(':', ' / ');
|
return aspectRatio.replace(':', ' / ');
|
||||||
}
|
}
|
||||||
|
|
||||||
function manifestUrl(sessionId: string, kind: PackKind, version: string) {
|
|
||||||
return `/api/export/${sessionId}_${kind}_${version}_manifest.json`;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Asset Row ────────────────────────────────── */
|
/* ── Asset Row ────────────────────────────────── */
|
||||||
function AssetRow({ template, asset, accent, onRegenerate }: {
|
function AssetRow({ template, asset, accent, onRegenerate }: {
|
||||||
template: AssetTemplate;
|
template: AssetTemplate;
|
||||||
@@ -51,7 +47,7 @@ function AssetRow({ template, asset, accent, onRegenerate }: {
|
|||||||
const ready = !!asset;
|
const ready = !!asset;
|
||||||
async function handleRedo() {
|
async function handleRedo() {
|
||||||
if (!asset || !onRegenerate || regenerating) return;
|
if (!asset || !onRegenerate || regenerating) return;
|
||||||
const ok = window.confirm('重做这 1 张会重新调用图片模型并产生费用。确认重做?');
|
const ok = window.confirm('重新生成这 1 张会再次调用图片模型并产生费用。确认继续?');
|
||||||
if (!ok) return;
|
if (!ok) return;
|
||||||
setRegenerating(true);
|
setRegenerating(true);
|
||||||
try {
|
try {
|
||||||
@@ -114,12 +110,12 @@ function AssetRow({ template, asset, accent, onRegenerate }: {
|
|||||||
)}
|
)}
|
||||||
{ready && onRegenerate && (
|
{ready && onRegenerate && (
|
||||||
<div className="mt-2 pt-2 border-t border-amber-400/10 flex items-center justify-between gap-3">
|
<div className="mt-2 pt-2 border-t border-amber-400/10 flex items-center justify-between gap-3">
|
||||||
<span className="text-[10px] text-amber-200/45">成本操作</span>
|
<span className="text-[10px] text-white/35">重新生成</span>
|
||||||
<button
|
<button
|
||||||
onClick={() => setShowRedo(value => !value)}
|
onClick={() => setShowRedo(value => !value)}
|
||||||
className="text-[10px] text-amber-200/70 hover:text-amber-100 rounded-lg px-2 py-1 ring-1 ring-amber-300/15 bg-amber-300/[0.04]"
|
className="text-[10px] text-white/55 hover:text-white rounded-lg px-2 py-1 ring-1 ring-white/[0.08] bg-white/[0.04]"
|
||||||
>
|
>
|
||||||
{showRedo ? '收起重做' : '打开重做'}
|
{showRedo ? '收起' : '调整后生成'}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -134,9 +130,9 @@ function AssetRow({ template, asset, accent, onRegenerate }: {
|
|||||||
<button
|
<button
|
||||||
onClick={handleRedo}
|
onClick={handleRedo}
|
||||||
disabled={regenerating}
|
disabled={regenerating}
|
||||||
className="rounded-lg bg-amber-500/80 hover:bg-amber-400 text-black text-[10px] px-2 py-1 disabled:opacity-40"
|
className="rounded-lg bg-white/[0.12] hover:bg-white/[0.18] text-white text-[10px] px-2 py-1 disabled:opacity-40"
|
||||||
>
|
>
|
||||||
{regenerating ? '...' : '确认付费重做'}
|
{regenerating ? '...' : '确认生成'}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -174,7 +170,7 @@ function PackSection({ kind, session, primaryImage, pack, isLoading, onGenerate,
|
|||||||
|
|
||||||
function handleGenerateClick() {
|
function handleGenerateClick() {
|
||||||
if (pack) {
|
if (pack) {
|
||||||
const ok = window.confirm(`${PACK_LABELS[kind]} 已有 ${generatedCount} 张图,重跑会重新调用图片模型并产生费用。确认继续?`);
|
const ok = window.confirm(`${PACK_LABELS[kind]} 已有 ${generatedCount} 张图,重新生成会再次调用图片模型并产生费用。确认继续?`);
|
||||||
if (!ok) return;
|
if (!ok) return;
|
||||||
}
|
}
|
||||||
onGenerate();
|
onGenerate();
|
||||||
@@ -205,15 +201,6 @@ function PackSection({ kind, session, primaryImage, pack, isLoading, onGenerate,
|
|||||||
</div>
|
</div>
|
||||||
{/* actions */}
|
{/* actions */}
|
||||||
<div className="flex items-center gap-2 shrink-0">
|
<div className="flex items-center gap-2 shrink-0">
|
||||||
{pack && (
|
|
||||||
<a
|
|
||||||
href={manifestUrl(session.id, kind, pack.version)}
|
|
||||||
className="text-[10px] text-violet-300 hover:text-violet-200 px-2 py-1 rounded-lg bg-white/[0.04] ring-1 ring-white/[0.08] transition-colors"
|
|
||||||
title="下载 manifest"
|
|
||||||
>
|
|
||||||
↓
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
<button
|
<button
|
||||||
onClick={handleGenerateClick}
|
onClick={handleGenerateClick}
|
||||||
disabled={isLoading}
|
disabled={isLoading}
|
||||||
@@ -223,7 +210,7 @@ function PackSection({ kind, session, primaryImage, pack, isLoading, onGenerate,
|
|||||||
<svg width="12" height="12" viewBox="0 0 24 24" className="animate-spin" fill="none" stroke="currentColor" strokeWidth="2.5">
|
<svg width="12" height="12" viewBox="0 0 24 24" className="animate-spin" fill="none" stroke="currentColor" strokeWidth="2.5">
|
||||||
<path d="M12 2a10 10 0 0 1 10 10" strokeLinecap="round" />
|
<path d="M12 2a10 10 0 0 1 10 10" strokeLinecap="round" />
|
||||||
</svg>
|
</svg>
|
||||||
) : pack ? '危险重跑' : `生成 ${total} 张`}
|
) : pack ? '重新生成' : `生成 ${total} 张`}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => setOpen(v => !v)}
|
onClick={() => setOpen(v => !v)}
|
||||||
|
|||||||
Reference in New Issue
Block a user