fix: default replicate previews to portrait ratio

This commit is contained in:
2026-05-20 17:17:06 +08:00
parent 288b695de2
commit 94bca09305
2 changed files with 21 additions and 3 deletions

View File

@@ -1587,6 +1587,20 @@
"message": "auto-save 2026-05-20 17:11 (~2)", "message": "auto-save 2026-05-20 17:11 (~2)",
"hash": "36c93cd", "hash": "36c93cd",
"files_changed": 2 "files_changed": 2
},
{
"ts": "2026-05-20T17:13:15+08:00",
"type": "commit",
"message": "fix: preserve primary image aspect ratio",
"hash": "288b695",
"files_changed": 2
},
{
"ts": "2026-05-20T17:17:06+08:00",
"type": "commit",
"message": "auto-save 2026-05-20 17:17 (~2)",
"hash": "1325a73",
"files_changed": 2
} }
] ]
} }

View File

@@ -34,6 +34,10 @@ function projectTitle(session: GenSession) {
return session.characterSpec?.name || session.prompt || '未命名项目'; return session.characterSpec?.name || session.prompt || '未命名项目';
} }
function defaultPrimaryAspectRatio(session: GenSession) {
return session.inputMode === 'replicate' || session.inputMode === 'extend' ? '2 / 3' : '1 / 1';
}
function imageSourcesForSession(session: GenSession) { function imageSourcesForSession(session: GenSession) {
const uploaded = session.uploadedImages?.map(image => ({ const uploaded = session.uploadedImages?.map(image => ({
url: image.url, url: image.url,
@@ -90,11 +94,11 @@ function ProjectBrief({ session }: { session: GenSession }) {
const generatedAssets = (session.packs ?? []).reduce((sum, pack) => sum + pack.assets.length, 0); const generatedAssets = (session.packs ?? []).reduce((sum, pack) => sum + pack.assets.length, 0);
const totalSlots = packSlotTotal(); const totalSlots = packSlotTotal();
const [previewOpen, setPreviewOpen] = useState(false); const [previewOpen, setPreviewOpen] = useState(false);
const [primaryAspectRatio, setPrimaryAspectRatio] = useState('1 / 1'); const [primaryAspectRatio, setPrimaryAspectRatio] = useState(defaultPrimaryAspectRatio(session));
useEffect(() => { useEffect(() => {
setPrimaryAspectRatio('1 / 1'); setPrimaryAspectRatio(defaultPrimaryAspectRatio(session));
}, [primaryImage?.url]); }, [primaryImage?.url, session.inputMode]);
return ( return (
<section className="project-brief-panel"> <section className="project-brief-panel">