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 |
+
<title>CLOVIS AI λ£©λΆ μμ±κΈ°</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script>
|
| 9 |
+
tailwind.config = { darkMode: 'class', theme: { extend: { colors: { brand: { blue: '#3B82F6', hover: '#2563EB' } } } } }
|
| 10 |
+
</script>
|
| 11 |
+
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin />
|
| 12 |
+
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css" />
|
| 13 |
+
<style>
|
| 14 |
+
* { font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
|
| 15 |
+
body { -webkit-font-smoothing: antialiased; background: #1a1a1a; color: #f9fafb; margin: 0; overflow: hidden; }
|
| 16 |
+
::-webkit-scrollbar { width: 6px; height: 6px; }
|
| 17 |
+
::-webkit-scrollbar-track { background: #1a1a1a; }
|
| 18 |
+
::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }
|
| 19 |
+
::-webkit-scrollbar-thumb:hover { background: #4b5563; }
|
| 20 |
+
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
| 21 |
+
@keyframes shimmer { 0% { background-position: -600px 0; } 100% { background-position: 600px 0; } }
|
| 22 |
+
@keyframes pulseRing { 0% { transform: scale(0.85); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }
|
| 23 |
+
.animate-fadeIn { animation: fadeIn .25s ease-out; }
|
| 24 |
+
.shimmer { background: linear-gradient(90deg, #232323 0%, #2c2c2c 40%, #232323 80%); background-size: 600px 100%; animation: shimmer 1.6s linear infinite; }
|
| 25 |
+
.pulse-ring::before { content: ''; position: absolute; inset: -6px; border-radius: 9999px; border: 2px solid #3B82F6; animation: pulseRing 1.4s ease-out infinite; }
|
| 26 |
+
.ai-label-overlay { position: absolute; top: 12pt; right: 12pt; font-weight: 300; font-size: 10pt; color: #3c3c3c; pointer-events: none; z-index: 2; letter-spacing: -0.02em; }
|
| 27 |
+
.drop-active { border-color: #3B82F6 !important; background: rgba(59,130,246,.08) !important; }
|
| 28 |
+
textarea { resize: vertical; }
|
| 29 |
+
</style>
|
| 30 |
+
<script type="importmap">
|
| 31 |
+
{ "imports": {
|
| 32 |
+
"react": "https://esm.sh/react@19.1.0",
|
| 33 |
+
"react/": "https://esm.sh/react@19.1.0/",
|
| 34 |
+
"react-dom/": "https://esm.sh/react-dom@19.1.0/",
|
| 35 |
+
"lucide-react": "https://esm.sh/lucide-react@0.462.0?external=react"
|
| 36 |
+
} }
|
| 37 |
+
</script>
|
| 38 |
+
</head>
|
| 39 |
+
<body>
|
| 40 |
+
<div id="root"></div>
|
| 41 |
+
<script type="module">
|
| 42 |
+
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
| 43 |
+
import ReactDOM from 'react-dom/client';
|
| 44 |
+
import { Download, X, Upload, Sparkles, RefreshCw, AlertTriangle, Clock, Check, ImagePlus, User, Maximize2, ChevronDown } from 'lucide-react';
|
| 45 |
+
|
| 46 |
+
const h = React.createElement;
|
| 47 |
+
|
| 48 |
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 49 |
+
// Constants β μν¬νλ‘μ°(SPAO.json) CustomCombo μ΅μ
κ³Ό 1:1
|
| 50 |
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 51 |
+
const SHOT_OPTIONS = ['μ μ μ»·', 'μλ°μ μ»·', 'νλ°μ μ»·']; // νλ μμ νμ μ· κ·μΉμ΄ μ ν¨ (λ νΌλ°μ€λ ν¬μ¦ μ°Έκ³ μ©)
|
| 52 |
+
const ANGLE_OPTIONS = ['μ λ©΄', 'λ°μΈ‘λ©΄', 'μΈ‘λ©΄', 'λ‘μ°μ΅κΈ', 'νμ΄μ΅κΈ', 'νλ©΄', 'λ νΌλ°μ€ λ°λ¦'];
|
| 53 |
+
const GAZE_OPTIONS = ['μΉ΄λ©λΌ μμ', 'μμ°μ€λ¬μ΄ μμ ', 'λ νΌλ°μ€ λ°λ¦'];
|
| 54 |
+
const AGE_OPTIONS = ['μ±μΈ', 'ν€μ¦'];
|
| 55 |
+
const DETAIL_GROUPS = [
|
| 56 |
+
{ key: 'outer', label: 'μμ°ν°', length: 'outer_length', fit: 'outer_fit' },
|
| 57 |
+
{ key: 'top', label: 'μμ', length: 'top_length', fit: 'top_fit' },
|
| 58 |
+
{ key: 'bottom', label: 'νμ', length: 'bottom_length', fit: 'bottom_fit' },
|
| 59 |
+
];
|
| 60 |
+
const DETAIL_OPTIONS = {
|
| 61 |
+
outer_length: { label: 'μμ°ν° κΈΈμ΄', options: ['ν리', '골λ°', 'νλ²
μ§'], def: '골λ°' },
|
| 62 |
+
outer_fit: { label: 'μμ°ν° ν', options: ['μ¬λ¦Ό', 'νμ€', 'μ€λ²'], def: 'νμ€' },
|
| 63 |
+
top_length: { label: 'μμ κΈΈμ΄', options: ['ν리', '골λ°', 'νλ²
μ§'], def: '골λ°' },
|
| 64 |
+
top_fit: { label: 'μμ ν', options: ['μ¬λ¦Ό', 'νμ€', 'μ€λ²'], def: 'μ€λ²' },
|
| 65 |
+
bottom_length: { label: 'νμ κΈΈμ΄', options: ['νλ²
μ§', '무λ¦', 'μ’
μ리', 'λ°λͺ©', 'μ λ°'], def: 'μ λ°' },
|
| 66 |
+
bottom_fit: { label: 'νμ ν', options: ['μ¬λ¦Ό', 'νμ€', 'μ€λ²'], def: 'μ€λ²' },
|
| 67 |
+
};
|
| 68 |
+
|
| 69 |
+
const ADULT_FACE_PRESETS = [
|
| 70 |
+
{ id: 'preset_17', label: 'μ¬μ± 1', url: '/face_preset_17.png' },
|
| 71 |
+
{ id: 'preset_18', label: 'μ¬μ± 2', url: '/face_preset_18.png' },
|
| 72 |
+
{ id: 'preset_19', label: 'μ¬μ± 3', url: '/face_preset_19.png' },
|
| 73 |
+
];
|
| 74 |
+
// CLOVIS λ ν€μ¦ λΌμΈμ΄ μμ΄ ν€μ¦ ν리μ
Β·μ°λ Ή ν κΈμ λ
ΈμΆνμ§ μμ (μν¬νλ‘μ° age 콀보μλ 'μ±μΈ' κ³ μ μ λ¬)
|
| 75 |
+
|
| 76 |
+
const IMAGE_SLOTS = [
|
| 77 |
+
{ key: 'outer', label: 'μμ°ν°', required: false },
|
| 78 |
+
{ key: 'top', label: 'μμ', required: false },
|
| 79 |
+
{ key: 'bottom', label: 'νμ', required: false, hint: 'μνΌμ€λ μ¬κΈ°' },
|
| 80 |
+
{ key: 'shoes', label: 'μ λ°', required: false },
|
| 81 |
+
{ key: 'inner', label: 'μ΄λμ¨μ΄', required: false },
|
| 82 |
+
{ key: 'belt', label: '벨νΈ', required: false },
|
| 83 |
+
{ key: 'background', label: 'λ°°κ²½', required: false, hint: 'λΉμ°λ©΄ κΈ°λ³Έ μ€νλμ€' },
|
| 84 |
+
{ key: 'pose', label: 'λ νΌλ°μ€ ν¬μ¦', required: false, hint: 'ν¬μ¦ μ°Έκ³ μ© Β· ꡬλλ μ· μ ν κΈ°μ€' },
|
| 85 |
+
];
|
| 86 |
+
|
| 87 |
+
// λν
μΌ μ°Έμ‘°: ν΄λ‘μ¦μ
μ μμ± λͺ¨λΈμ μ§μ μ°Έμ‘°λ‘ μ λ¬ (μ 체 μ΅λ 4μ₯)
|
| 88 |
+
// μ·λ§λ€ μ¬λ‘― 2κ°(a/b), μ¬λ‘―λ³λ‘ μ’
λ₯λ₯Ό κ³ λ¦ β μ’
λ₯λ comfy_client.DETAIL_KIND_EN ν€μ 1:1
|
| 89 |
+
const DETAIL_MAX = 4;
|
| 90 |
+
const DETAIL_SLOTS = ['a', 'b'];
|
| 91 |
+
// μ· μ’
λ₯λ³ λν
μΌ νλͺ© β key λ comfy_client.DETAIL_KIND_EN κ³Ό 1:1. short: μΉ© νμ, label: ν΄ν
|
| 92 |
+
const K = {
|
| 93 |
+
texture: { key: 'texture', short: 'μ‘°μ§κ°', label: 'μλ¨ μ‘°μ§κ° (μ· μ 체μ λ°μ)' },
|
| 94 |
+
logo: { key: 'logo', short: 'λ‘κ³ ', label: 'λ‘κ³ Β·νλ¦°νΈ (λ©μΈ μ¬μ§κ³Ό κ°μ μμΉ)' },
|
| 95 |
+
neckline: { key: 'neckline', short: 'λ₯λΌμΈ', label: 'λ₯λΌμΈΒ·μΉ΄λΌ' },
|
| 96 |
+
collar: { key: 'collar', short: 'μΉ΄λΌΒ·νλ', label: 'μΉ΄λΌΒ·νλΒ·λΌν ' },
|
| 97 |
+
sleeve: { key: 'sleeve', short: 'μλ§€', label: 'μ맀·컀νμ€' },
|
| 98 |
+
hem: { key: 'hem', short: 'λ°λ¨', label: 'λ°λ¨Β·ν΄ λ§κ°' },
|
| 99 |
+
waist: { key: 'waist', short: 'ν리', label: 'ν리 (μ¨μ΄μ€νΈλ°΄λ·벨νΈλ£¨νΒ·λλ‘μ€νΈλ§)' },
|
| 100 |
+
pocket: { key: 'pocket', short: 'ν¬μΌ', label: 'ν¬μΌ (ννΒ·μ€ν°μΉΒ·νλ©)' },
|
| 101 |
+
closure: { key: 'closure', short: 'μ§νΌΒ·λ²νΌ', label: 'μ§νΌΒ·λ²νΌΒ·μ€λ
' },
|
| 102 |
+
trim: { key: 'trim', short: 'λΆμμ¬', label: 'λΆμμ¬ (λΌλ²¨Β·νΒ·μν λ±)' },
|
| 103 |
+
material: { key: 'material', short: 'μμ¬', label: 'μμ¬Β·μ§κ° (κ°μ£½Β·μ€μ¨μ΄λΒ·λ©μ λ±, μ 체μ λ°μ)' },
|
| 104 |
+
sole: { key: 'sole', short: 'λ°μ°½', label: 'λ°μ°½Β·μμμ' },
|
| 105 |
+
lacing: { key: 'lacing', short: 'λ', label: 'λΒ·μμΌλ Β·μ€ν¬' },
|
| 106 |
+
heel: { key: 'heel', short: 'λ€μΆ', label: 'λ€μΆΒ·ννΒ·λ°λͺ©' },
|
| 107 |
+
buckle: { key: 'buckle', short: 'λ²ν΄', label: 'λ²ν΄' },
|
| 108 |
+
edge: { key: 'edge', short: 'μ€ν°μΉ', label: 'μ€ν°μΉΒ·μ£μ§Β·λ²¨νΈν' },
|
| 109 |
+
};
|
| 110 |
+
const DETAIL_KINDS_BY_GARMENT = {
|
| 111 |
+
outer: [K.texture, K.logo, K.collar, K.sleeve, K.hem, K.pocket, K.closure, K.trim],
|
| 112 |
+
top: [K.texture, K.logo, K.neckline, K.sleeve, K.hem, K.pocket, K.trim],
|
| 113 |
+
bottom: [K.texture, K.logo, K.waist, K.hem, K.pocket, K.closure, K.trim],
|
| 114 |
+
shoes: [K.material, K.logo, K.sole, K.lacing, K.heel, K.trim],
|
| 115 |
+
inner: [K.texture, K.logo, K.neckline, K.sleeve, K.hem],
|
| 116 |
+
belt: [K.material, K.buckle, K.logo, K.edge],
|
| 117 |
+
};
|
| 118 |
+
// μ¬λ‘― κΈ°λ³Έκ°: μΌμͺ½ = μμ¬/μ‘°μ§κ°, μ€λ₯Έμͺ½ = λ‘κ³ (벨νΈλ λ²ν΄)
|
| 119 |
+
const defaultKind = (g, slot) => {
|
| 120 |
+
const list = DETAIL_KINDS_BY_GARMENT[g] || [];
|
| 121 |
+
if (slot === 'a') return list[0]?.key;
|
| 122 |
+
return g === 'belt' ? 'buckle' : (list.find(k => k.key === 'logo') || list[1] || list[0])?.key;
|
| 123 |
+
};
|
| 124 |
+
const DETAIL_GARMENTS = [
|
| 125 |
+
{ key: 'outer', label: 'μμ°ν°' }, { key: 'top', label: 'μμ' }, { key: 'bottom', label: 'νμ' },
|
| 126 |
+
{ key: 'shoes', label: 'μ λ°' }, { key: 'inner', label: 'μ΄λμ¨μ΄' }, { key: 'belt', label: '벨νΈ' },
|
| 127 |
+
];
|
| 128 |
+
|
| 129 |
+
// AI νκΈ° β μ μ₯ μ μΊλ²μ€μ μ½μ
(κΈ°μ‘΄ μ±κ³Ό λμΌ κ·κ²©)
|
| 130 |
+
const AI_LABEL_TEXT = 'AI μμ± μ΄λ―Έμ§';
|
| 131 |
+
const AI_LABEL_FONT_PT = 28;
|
| 132 |
+
const AI_LABEL_MARGIN_PT = 12 * (28 / 10);
|
| 133 |
+
|
| 134 |
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 135 |
+
// Helpers
|
| 136 |
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 137 |
+
const fileToDataUrl = (file, maxSide = 1536) => new Promise((resolve, reject) => {
|
| 138 |
+
const reader = new FileReader();
|
| 139 |
+
reader.onerror = reject;
|
| 140 |
+
reader.onload = () => {
|
| 141 |
+
const img = new Image();
|
| 142 |
+
img.onerror = reject;
|
| 143 |
+
img.onload = () => {
|
| 144 |
+
const scale = Math.min(1, maxSide / Math.max(img.width, img.height));
|
| 145 |
+
const w = Math.round(img.width * scale), hgt = Math.round(img.height * scale);
|
| 146 |
+
const canvas = document.createElement('canvas');
|
| 147 |
+
canvas.width = w; canvas.height = hgt;
|
| 148 |
+
const ctx = canvas.getContext('2d');
|
| 149 |
+
const keepPng = /png|webp/i.test(file.type);
|
| 150 |
+
if (!keepPng) { ctx.fillStyle = '#fff'; ctx.fillRect(0, 0, w, hgt); }
|
| 151 |
+
ctx.drawImage(img, 0, 0, w, hgt);
|
| 152 |
+
resolve(keepPng ? canvas.toDataURL('image/png') : canvas.toDataURL('image/jpeg', 0.92));
|
| 153 |
+
};
|
| 154 |
+
img.src = reader.result;
|
| 155 |
+
};
|
| 156 |
+
reader.readAsDataURL(file);
|
| 157 |
+
});
|
| 158 |
+
|
| 159 |
+
const drawAiDisclosureOnCanvas = (ctx, width, height) => {
|
| 160 |
+
ctx.save();
|
| 161 |
+
ctx.textAlign = 'right'; ctx.textBaseline = 'top'; ctx.fillStyle = '#3c3c3c';
|
| 162 |
+
ctx.font = `300 ${AI_LABEL_FONT_PT}pt 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif`;
|
| 163 |
+
const ptToPx = 96 / 72;
|
| 164 |
+
const m = Math.max(AI_LABEL_MARGIN_PT * ptToPx, Math.min(width, height) * 0.028, 18);
|
| 165 |
+
ctx.fillText(AI_LABEL_TEXT, width - m, m);
|
| 166 |
+
ctx.restore();
|
| 167 |
+
};
|
| 168 |
+
|
| 169 |
+
async function downloadWithLabel(imageUrl, filename, withLabel = true) {
|
| 170 |
+
const img = new Image();
|
| 171 |
+
await new Promise((res, rej) => { img.onload = res; img.onerror = rej; img.src = imageUrl; });
|
| 172 |
+
const canvas = document.createElement('canvas');
|
| 173 |
+
canvas.width = img.naturalWidth; canvas.height = img.naturalHeight;
|
| 174 |
+
const ctx = canvas.getContext('2d');
|
| 175 |
+
ctx.drawImage(img, 0, 0);
|
| 176 |
+
if (withLabel) drawAiDisclosureOnCanvas(ctx, canvas.width, canvas.height);
|
| 177 |
+
const a = document.createElement('a');
|
| 178 |
+
a.href = canvas.toDataURL('image/png'); a.download = filename; a.click();
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
const sleep = (ms) => new Promise(r => setTimeout(r, ms));
|
| 182 |
+
|
| 183 |
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 184 |
+
// μ±λ μ¬μ΄μ¦ λ΄λ³΄λ΄κΈ° β μμ±μ 3:4 μλ³Έ ν λ², μ±λ κ·κ²©μ μ μ₯ μ λ³ν
|
| 185 |
+
// μ¬λ°±μ AI μ¬μμ±μ΄ μλλΌ μλ³Έ κ°μ₯μ리 ν½μ
μ μ€(ν) λ¨μλ‘ μ°μ₯ν΄ μ±μ (μλ³Έ ν½μ
무μμ€)
|
| 186 |
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 187 |
+
const EXPORT_PRESETS = [
|
| 188 |
+
{ key: 'original', label: 'μλ³Έ', desc: '1536Γ2048', w: null, h: null, suffix: '' },
|
| 189 |
+
{ key: 'mall', label: 'μ΄λλλͺ°Β·λ€μ΄λ²Β·μ¬λ°©λ·', desc: '1400Γ1400', w: 1400, h: 1400, suffix: '_1400x1400' },
|
| 190 |
+
{ key: 'zigzag', label: 'μ§κ·Έμ¬κ·Έ', desc: '1080Γ1296', w: 1080, h: 1296, suffix: '_1080x1296' },
|
| 191 |
+
];
|
| 192 |
+
|
| 193 |
+
// λμ μΊλ²μ€μ (μ€Β·ν¬ λ°μν΄) μλ³Έμ κ·Έλ¦¬κ³ , λ¨λ μ’μ° μ¬λ°±μ κ°μ₯μ리 1px μ΄μ λλ € μ±μ΄λ€.
|
| 194 |
+
function renderChannelCanvas(img, W, H, zoom, offX, offY, withLabel) {
|
| 195 |
+
const sw = img.naturalWidth, sh = img.naturalHeight;
|
| 196 |
+
const s = Math.min(W / sw, H / sh) * zoom;
|
| 197 |
+
const dw = sw * s, dh = sh * s;
|
| 198 |
+
// ν¬ ν΄λ¨ν: μ»€λ² μ λλ μΆμ μ€μ κ³ μ , 컀λ²λλ μΆμ λΉνμ΄ μ μκΈ°λ λ²μλ‘ μ ν
|
| 199 |
+
let dx = dw >= W ? Math.min(0, Math.max(W - dw, (W - dw) / 2 + offX)) : (W - dw) / 2;
|
| 200 |
+
let dy = dh >= H ? Math.min(0, Math.max(H - dh, (H - dh) / 2 + offY)) : (H - dh) / 2;
|
| 201 |
+
const canvas = document.createElement('canvas');
|
| 202 |
+
canvas.width = W; canvas.height = H;
|
| 203 |
+
const ctx = canvas.getContext('2d');
|
| 204 |
+
ctx.imageSmoothingQuality = 'high';
|
| 205 |
+
ctx.fillStyle = '#ffffff'; ctx.fillRect(0, 0, W, H);
|
| 206 |
+
// 보μ΄λ μλ³Έ μΈλ‘ κ΅¬κ° (μ¬λ°± μ€μ μμ κ°μ νμμ μκΈ° μν΄)
|
| 207 |
+
const sy0 = Math.max(0, -dy / s), syh = Math.min(sh - sy0, H / s);
|
| 208 |
+
const padL = Math.ceil(Math.max(0, dx)), padR = Math.ceil(Math.max(0, W - (dx + dw)));
|
| 209 |
+
if (padL > 0) ctx.drawImage(img, 0, sy0, 1, syh, 0, 0, padL, H);
|
| 210 |
+
if (padR > 0) ctx.drawImage(img, sw - 1, sy0, 1, syh, W - padR, 0, padR, H);
|
| 211 |
+
ctx.drawImage(img, dx, dy, dw, dh);
|
| 212 |
+
if (withLabel) drawAiDisclosureOnCanvas(ctx, W, H);
|
| 213 |
+
return canvas;
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
function ExportModal({ current, aiLabel, onClose }) {
|
| 217 |
+
const [preset, setPreset] = useState('mall');
|
| 218 |
+
const [zoom, setZoom] = useState(1);
|
| 219 |
+
const [off, setOff] = useState({ x: 0, y: 0 });
|
| 220 |
+
const imgRef = useRef(null);
|
| 221 |
+
const [ready, setReady] = useState(false);
|
| 222 |
+
const canvasRef = useRef(null);
|
| 223 |
+
const dragRef = useRef(null);
|
| 224 |
+
const p = EXPORT_PRESETS.find(x => x.key === preset);
|
| 225 |
+
|
| 226 |
+
useEffect(() => { // μλ³Έ λ‘λ (1ν)
|
| 227 |
+
const img = new Image();
|
| 228 |
+
img.onload = () => { imgRef.current = img; setReady(true); };
|
| 229 |
+
img.src = current.imageUrl;
|
| 230 |
+
}, [current.imageUrl]);
|
| 231 |
+
|
| 232 |
+
useEffect(() => { setZoom(1); setOff({ x: 0, y: 0 }); }, [preset]);
|
| 233 |
+
|
| 234 |
+
useEffect(() => { // 미리보기 λ λ
|
| 235 |
+
const img = imgRef.current, cv = canvasRef.current;
|
| 236 |
+
if (!ready || !img || !cv || !p.w) return;
|
| 237 |
+
const out = renderChannelCanvas(img, p.w, p.h, zoom, off.x, off.y, aiLabel);
|
| 238 |
+
cv.width = out.width; cv.height = out.height;
|
| 239 |
+
cv.getContext('2d').drawImage(out, 0, 0);
|
| 240 |
+
}, [ready, preset, zoom, off, aiLabel]);
|
| 241 |
+
|
| 242 |
+
const startDrag = (e) => {
|
| 243 |
+
if (!p.w) return;
|
| 244 |
+
e.preventDefault();
|
| 245 |
+
dragRef.current = { x: e.clientX, y: e.clientY, ox: off.x, oy: off.y };
|
| 246 |
+
const scale = p.h / (canvasRef.current?.getBoundingClientRect().height || p.h);
|
| 247 |
+
const move = (ev) => {
|
| 248 |
+
const d = dragRef.current; if (!d) return;
|
| 249 |
+
setOff({ x: d.ox + (ev.clientX - d.x) * scale, y: d.oy + (ev.clientY - d.y) * scale });
|
| 250 |
+
};
|
| 251 |
+
const up = () => { dragRef.current = null; window.removeEventListener('pointermove', move); window.removeEventListener('pointerup', up); };
|
| 252 |
+
window.addEventListener('pointermove', move); window.addEventListener('pointerup', up);
|
| 253 |
+
};
|
| 254 |
+
|
| 255 |
+
const save = () => {
|
| 256 |
+
const base = `clovis_${current.meta.shot}_${current.meta.angle}_${current.id}`;
|
| 257 |
+
if (!p.w) { downloadWithLabel(current.imageUrl, `${base}.png`, aiLabel); return; }
|
| 258 |
+
const out = renderChannelCanvas(imgRef.current, p.w, p.h, zoom, off.x, off.y, aiLabel);
|
| 259 |
+
const a = document.createElement('a');
|
| 260 |
+
a.href = out.toDataURL('image/png'); a.download = `${base}${p.suffix}.png`; a.click();
|
| 261 |
+
};
|
| 262 |
+
|
| 263 |
+
return h('div', { className: 'fixed inset-0 z-50 bg-black/80 flex items-center justify-center animate-fadeIn', onClick: onClose },
|
| 264 |
+
h('div', { className: 'bg-[#222] rounded-2xl border border-[#333] w-[min(720px,94vw)] max-h-[92vh] overflow-y-auto p-5 flex flex-col gap-4', onClick: e => e.stopPropagation() },
|
| 265 |
+
h('div', { className: 'flex items-center justify-between' },
|
| 266 |
+
h('h3', { className: 'text-[15px] font-semibold' }, 'λ€μ΄λ‘λ β μ±λ μ¬μ΄μ¦'),
|
| 267 |
+
h('button', { type: 'button', onClick: onClose, className: 'text-gray-500 hover:text-white' }, h(X, { size: 18 }))),
|
| 268 |
+
// μ±λ μ ν
|
| 269 |
+
h('div', { className: 'grid grid-cols-3 gap-2' }, EXPORT_PRESETS.map(x =>
|
| 270 |
+
h('button', { key: x.key, type: 'button', onClick: () => setPreset(x.key),
|
| 271 |
+
className: `rounded-xl border px-2 py-2.5 text-center transition-colors ${preset === x.key ? 'border-brand-blue bg-brand-blue/10' : 'border-[#3a3a3a] hover:border-[#4b5563]'}` },
|
| 272 |
+
h('div', { className: `text-[12.5px] font-semibold leading-tight ${preset === x.key ? 'text-white' : 'text-gray-300'}` }, x.label),
|
| 273 |
+
h('div', { className: 'text-[11px] text-gray-500 mt-0.5' }, x.desc)))),
|
| 274 |
+
// 미리보기
|
| 275 |
+
p.w
|
| 276 |
+
? h('div', { className: 'flex flex-col items-center gap-3' },
|
| 277 |
+
h('div', { className: 'relative' },
|
| 278 |
+
h('canvas', { ref: canvasRef, onPointerDown: startDrag,
|
| 279 |
+
className: 'max-h-[52vh] w-auto max-w-full rounded-lg border border-[#3a3a3a] bg-white cursor-grab active:cursor-grabbing select-none touch-none' }),
|
| 280 |
+
h('div', { className: 'absolute bottom-2 left-1/2 -translate-x-1/2 text-[10.5px] text-gray-400 bg-black/55 rounded-full px-2.5 py-0.5 pointer-events-none' }, 'λλκ·Έλ‘ μμΉ μ‘°μ ')),
|
| 281 |
+
h('div', { className: 'w-full max-w-[420px] flex items-center gap-3' },
|
| 282 |
+
h('span', { className: 'text-[11.5px] text-gray-500 shrink-0' }, 'λͺ¨λΈ ν¬κΈ°'),
|
| 283 |
+
h('input', { type: 'range', min: 100, max: 180, value: Math.round(zoom * 100),
|
| 284 |
+
onChange: e => setZoom(e.target.value / 100), className: 'flex-1 accent-[#3B82F6]' }),
|
| 285 |
+
h('span', { className: 'text-[11.5px] text-gray-400 w-10 text-right font-mono' }, `${Math.round(zoom * 100)}%`),
|
| 286 |
+
h('button', { type: 'button', onClick: () => { setZoom(1); setOff({ x: 0, y: 0 }); },
|
| 287 |
+
className: 'text-[11.5px] text-gray-500 hover:text-gray-300 shrink-0' }, 'μ΄κΈ°ν')),
|
| 288 |
+
h('p', { className: 'text-[11.5px] text-gray-500 text-center leading-relaxed m-0' },
|
| 289 |
+
'100% = μ μ²΄κ° λ€ λ€μ΄κ°λ μν (μ’μ°λ λ°°κ²½ μ°μ₯). μ¬λΌμ΄λλ₯Ό μ¬λ¦¬λ©΄ μμλ μ¬λ°±λΆν° μ리며 λͺ¨λΈμ΄ 컀μ§λλ€.'))
|
| 290 |
+
: h('p', { className: 'text-[12.5px] text-gray-400 text-center py-6 m-0' }, 'μμ±λ μλ³Έ(1536Γ2048)μ κ·Έλλ‘ μ μ₯ν©λλ€.'),
|
| 291 |
+
// μ μ₯
|
| 292 |
+
h('div', { className: 'flex items-center justify-between gap-3' },
|
| 293 |
+
h('span', { className: 'text-[11.5px] text-gray-500' }, aiLabel ? "'AI μμ± μ΄λ―Έμ§' νκΈ° ν¬ν¨" : 'AI νκΈ° μμ'),
|
| 294 |
+
h('button', { type: 'button', onClick: save,
|
| 295 |
+
className: 'h-10 px-5 rounded-xl bg-brand-blue hover:bg-brand-hover text-white text-[13px] font-semibold flex items-center gap-1.5' },
|
| 296 |
+
h(Download, { size: 15 }), p.w ? `${p.desc} μ μ₯` : 'μλ³Έ μ μ₯'))));
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
// λΉλ‘κ·ΈμΈ μ¬μ©μλ μμ
μ λ€μ λΆλ¬μ¬ μ μλλ‘ λΈλΌμ°μ λ³ IDλ₯Ό λ³΄κ΄ (λ‘κ·ΈμΈ μμ μλ²κ° κ³μ λͺ
μΌλ‘ λ¬Άμ)
|
| 300 |
+
const CLIENT_ID = (() => {
|
| 301 |
+
try {
|
| 302 |
+
let id = localStorage.getItem('clovis_client_id');
|
| 303 |
+
if (!id) { id = crypto.randomUUID(); localStorage.setItem('clovis_client_id', id); }
|
| 304 |
+
return id;
|
| 305 |
+
} catch { return 'c-' + Math.random().toString(36).slice(2); }
|
| 306 |
+
})();
|
| 307 |
+
const apiHeaders = (json = false) => ({ 'X-Client-Id': CLIENT_ID, ...(json ? { 'Content-Type': 'application/json' } : {}) });
|
| 308 |
+
|
| 309 |
+
// μ μΆ β jobId β ν΄λ§. κΈ΄ HTTP μ°κ²°μ μ‘κ³ μμ§ μμΌλ―λ‘ Space νλ‘μ νμμμκ³Ό 무κ΄.
|
| 310 |
+
async function submitToComfy(payload) {
|
| 311 |
+
const res = await fetch('/api/comfy/generate', { method: 'POST', headers: apiHeaders(true), body: JSON.stringify(payload) });
|
| 312 |
+
if (!res.ok) { const e = await res.json().catch(() => ({})); throw new Error(e.detail || `HTTP ${res.status}`); }
|
| 313 |
+
return (await res.json()).jobId;
|
| 314 |
+
}
|
| 315 |
+
async function pollComfyJob(jobId, onProgress) {
|
| 316 |
+
let misses = 0;
|
| 317 |
+
while (true) {
|
| 318 |
+
await sleep(3000);
|
| 319 |
+
let r;
|
| 320 |
+
try { r = await fetch(`/api/comfy/jobs/${jobId}`, { headers: apiHeaders() }); } catch { if (++misses > 10) throw new Error('μλ² μλ΅μ΄ μμ΅λλ€.'); continue; }
|
| 321 |
+
if (r.status === 404) throw new Error('μμ
μ 보λ₯Ό μμ΄λ²λ Έμ΅λλ€ (μλ² μ¬μμ). λ€μ μλν΄μ£ΌμΈμ.');
|
| 322 |
+
if (!r.ok) { if (++misses > 10) throw new Error(`HTTP ${r.status}`); continue; }
|
| 323 |
+
misses = 0;
|
| 324 |
+
const j = await r.json();
|
| 325 |
+
onProgress?.(j);
|
| 326 |
+
if (j.status === 'done') return j;
|
| 327 |
+
if (j.status === 'cancelled') return null; // μ¬μ©μ μ·¨μ β μ‘°μ©ν μ’
λ£
|
| 328 |
+
if (j.status === 'error') throw new Error(j.error || 'μμ± μ€ν¨');
|
| 329 |
+
}
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
const fmtSec = (s) => { s = Math.round(s || 0); return s >= 60 ? `${Math.floor(s / 60)}λΆ ${s % 60}μ΄` : `${s}μ΄`; };
|
| 333 |
+
|
| 334 |
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 335 |
+
// UI atoms
|
| 336 |
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 337 |
+
const SectionTitle = ({ children, right }) => h('div', { className: 'flex items-center justify-between mb-2.5' },
|
| 338 |
+
h('h3', { className: 'text-[13px] font-semibold text-gray-200 tracking-tight' }, children), right || null);
|
| 339 |
+
|
| 340 |
+
const Segmented = ({ options, value, onChange, cols }) => h('div', {
|
| 341 |
+
className: `grid gap-1.5`, style: { gridTemplateColumns: `repeat(${cols || options.length}, minmax(0, 1fr))` } },
|
| 342 |
+
options.map(o => h('button', {
|
| 343 |
+
key: o, type: 'button', onClick: () => onChange(o),
|
| 344 |
+
className: `px-2 py-2 rounded-lg text-[12.5px] font-medium border transition-colors ${value === o
|
| 345 |
+
? 'bg-brand-blue border-brand-blue text-white'
|
| 346 |
+
: 'bg-[#242424] border-[#333] text-gray-300 hover:border-[#4b5563] hover:text-white'}`
|
| 347 |
+
}, o)));
|
| 348 |
+
|
| 349 |
+
const UploadTile = ({ slot, value, onChange, disabled }) => {
|
| 350 |
+
const inputRef = useRef(null);
|
| 351 |
+
const [drag, setDrag] = useState(false);
|
| 352 |
+
const handleFiles = async (files) => {
|
| 353 |
+
const f = files?.[0]; if (!f || !f.type.startsWith('image/')) return;
|
| 354 |
+
onChange(await fileToDataUrl(f), f.name);
|
| 355 |
+
};
|
| 356 |
+
return h('div', {
|
| 357 |
+
className: `relative rounded-xl border overflow-hidden group ${drag ? 'drop-active' : ''} ${value ? 'border-[#3a3a3a]' : 'border-dashed border-[#3a3a3a] bg-[#212121] hover:border-[#4b5563]'}`,
|
| 358 |
+
style: { aspectRatio: '3 / 4' },
|
| 359 |
+
onDragOver: e => { e.preventDefault(); setDrag(true); }, onDragLeave: () => setDrag(false),
|
| 360 |
+
onDrop: e => { e.preventDefault(); setDrag(false); if (!disabled) handleFiles(e.dataTransfer.files); },
|
| 361 |
+
onClick: () => !disabled && !value && inputRef.current?.click(),
|
| 362 |
+
},
|
| 363 |
+
h('input', { ref: inputRef, type: 'file', accept: 'image/*', className: 'hidden', onChange: e => { handleFiles(e.target.files); e.target.value = ''; } }),
|
| 364 |
+
value
|
| 365 |
+
? h(React.Fragment, null,
|
| 366 |
+
h('img', { src: value, className: 'w-full h-full object-cover bg-white', alt: slot.label }),
|
| 367 |
+
!disabled && h('button', { type: 'button', onClick: e => { e.stopPropagation(); onChange(null, null); },
|
| 368 |
+
className: 'absolute top-1.5 right-1.5 w-6 h-6 rounded-full bg-black/70 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity' }, h(X, { size: 13 })),
|
| 369 |
+
h('div', { className: 'absolute bottom-0 inset-x-0 px-2 py-1 bg-gradient-to-t from-black/70 to-transparent text-[11px] text-white' }, slot.label))
|
| 370 |
+
: h('div', { className: 'absolute inset-0 flex flex-col items-center justify-center gap-1 text-gray-500 cursor-pointer' },
|
| 371 |
+
h(ImagePlus, { size: 18 }),
|
| 372 |
+
h('span', { className: 'text-[11.5px] text-gray-300' }, slot.label, slot.required && h('span', { className: 'text-brand-blue ml-0.5' }, '*')),
|
| 373 |
+
slot.hint && h('span', { className: 'text-[10px] text-gray-500 px-2 text-center leading-tight' }, slot.hint))
|
| 374 |
+
);
|
| 375 |
+
};
|
| 376 |
+
|
| 377 |
+
const DetailTile = ({ value, onChange, disabled }) => {
|
| 378 |
+
const inputRef = useRef(null);
|
| 379 |
+
const handleFiles = async (files) => {
|
| 380 |
+
const f = files?.[0]; if (!f || !f.type.startsWith('image/')) return;
|
| 381 |
+
onChange(await fileToDataUrl(f, 1024), f.name);
|
| 382 |
+
};
|
| 383 |
+
return h('div', {
|
| 384 |
+
className: `relative w-full rounded-lg overflow-hidden group ${value ? 'border border-[#3a3a3a]' : 'border border-dashed border-[#3a3a3a] bg-[#212121] hover:border-[#4b5563]'} ${disabled ? 'opacity-60 border-[#333]' : ''}`,
|
| 385 |
+
style: { aspectRatio: '1 / 1' },
|
| 386 |
+
onDragOver: e => e.preventDefault(), onDrop: e => { e.preventDefault(); if (!disabled) handleFiles(e.dataTransfer.files); },
|
| 387 |
+
onClick: () => !disabled && !value && inputRef.current?.click(),
|
| 388 |
+
},
|
| 389 |
+
h('input', { ref: inputRef, type: 'file', accept: 'image/*', className: 'hidden', onChange: e => { handleFiles(e.target.files); e.target.value = ''; } }),
|
| 390 |
+
value
|
| 391 |
+
? h(React.Fragment, null,
|
| 392 |
+
h('img', { src: value, className: 'w-full h-full object-cover bg-white' }),
|
| 393 |
+
!disabled && h('button', { type: 'button', onClick: e => { e.stopPropagation(); onChange(null, null); },
|
| 394 |
+
className: 'absolute top-1 right-1 w-5 h-5 rounded-full bg-black/70 text-white flex items-center justify-center opacity-0 group-hover:opacity-100' }, h(X, { size: 11 })))
|
| 395 |
+
: h('div', { className: 'absolute inset-0 flex items-center justify-center text-gray-600 cursor-pointer' }, h(ImagePlus, { size: 14 })));
|
| 396 |
+
};
|
| 397 |
+
|
| 398 |
+
const FaceTile = ({ preset, selected, onClick }) => h('button', {
|
| 399 |
+
type: 'button', onClick, title: preset.label,
|
| 400 |
+
className: `relative rounded-xl overflow-hidden border-2 transition-colors ${selected ? 'border-brand-blue' : 'border-transparent hover:border-[#4b5563]'}`,
|
| 401 |
+
style: { aspectRatio: '1 / 1' } },
|
| 402 |
+
h('img', { src: preset.url, className: 'w-full h-full object-cover', alt: preset.label }),
|
| 403 |
+
selected && h('div', { className: 'absolute top-1 right-1 w-5 h-5 rounded-full bg-brand-blue flex items-center justify-center' }, h(Check, { size: 12, className: 'text-white' })),
|
| 404 |
+
h('div', { className: 'absolute bottom-0 inset-x-0 px-1.5 py-0.5 bg-black/60 text-[10.5px] text-white text-center' }, preset.label));
|
| 405 |
+
|
| 406 |
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 407 |
+
// App
|
| 408 |
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 409 |
+
function App() {
|
| 410 |
+
const [user, setUser] = useState({ username: 'anonymous', is_logged_in: false, oauth_enabled: false });
|
| 411 |
+
const [health, setHealth] = useState(null);
|
| 412 |
+
|
| 413 |
+
const age = 'μ±μΈ'; // CLOVIS: μ±μΈ κ³ μ
|
| 414 |
+
const [facePreset, setFacePreset] = useState('preset_17');
|
| 415 |
+
const [detailKinds, setDetailKinds] = useState({}); // 'outer:a' β kind key
|
| 416 |
+
const [genCount, setGenCount] = useState(1); // ν λ²μ μμ±ν λ§€μ
|
| 417 |
+
const [faceUpload, setFaceUpload] = useState(null);
|
| 418 |
+
const [shot, setShot] = useState('μ μ μ»·');
|
| 419 |
+
const [angle, setAngle] = useState('λ°μΈ‘λ©΄');
|
| 420 |
+
const [gaze, setGaze] = useState('μμ°μ€λ¬μ΄ μμ ');
|
| 421 |
+
const [prompt, setPrompt] = useState('');
|
| 422 |
+
const [details, setDetails] = useState(Object.fromEntries(Object.entries(DETAIL_OPTIONS).map(([k, v]) => [k, v.def])));
|
| 423 |
+
const [detailTab, setDetailTab] = useState('top');
|
| 424 |
+
const [images, setImages] = useState({});
|
| 425 |
+
const [imageNames, setImageNames] = useState({}); // μ¬λ‘―λ³ μλ³Έ νμΌλͺ
(Dataset λ‘κ·ΈΒ·μ€νμΌμ½λ μ§κ³μ©)
|
| 426 |
+
const [faceUploadName, setFaceUploadName] = useState(null);
|
| 427 |
+
const [poseSpec, setPoseSpec] = useState(''); // ν¬μ¦ μ§μ λ¬Έμ₯ (λΉμ°λ©΄ GPT λΉμ μ΄ λ νΌλ°μ€μμ μλ μΆμΆ)
|
| 428 |
+
|
| 429 |
+
const [jobs, setJobs] = useState([]); // μ§ν μ€/μ€ν¨ μμ
[{id, jobId, meta, stageLabel, startedAt, error}]
|
| 430 |
+
const [tick, setTick] = useState(0); // κ²½κ³Όμκ° νμμ© 1μ΄ νμ΄λ¨Έ
|
| 431 |
+
const [results, setResults] = useState([]); // [{id, imageUrl, meta, elapsedSec}]
|
| 432 |
+
const [current, setCurrent] = useState(null);
|
| 433 |
+
const [error, setError] = useState(null);
|
| 434 |
+
const [aiLabel, setAiLabel] = useState(true);
|
| 435 |
+
const [lightbox, setLightbox] = useState(false); // κ²°κ³Ό μ΄λ―Έμ§ νλ 보기
|
| 436 |
+
const [exportOpen, setExportOpen] = useState(false); // μ±λ μ¬μ΄μ¦ λ€μ΄λ‘λ λͺ¨λ¬
|
| 437 |
+
const [showSpecs, setShowSpecs] = useState(false); // μμ λΆμ κ²°κ³Ό / μ΅μ’
ν둬ννΈ νΌμΉκΈ°
|
| 438 |
+
useEffect(() => {
|
| 439 |
+
if (!lightbox) return;
|
| 440 |
+
const onKey = (e) => { if (e.key === 'Escape') setLightbox(false); };
|
| 441 |
+
window.addEventListener('keydown', onKey);
|
| 442 |
+
return () => window.removeEventListener('keydown', onKey);
|
| 443 |
+
}, [lightbox]);
|
| 444 |
+
const faceFileRef = useRef(null);
|
| 445 |
+
|
| 446 |
+
useEffect(() => {
|
| 447 |
+
fetch('/api/whoami').then(r => r.ok ? r.json() : null).then(d => d && setUser(d)).catch(() => {});
|
| 448 |
+
fetch('/api/comfy/health').then(r => r.ok ? r.json() : { ok: false, error: 'λΈλ¦¬μ§ λΌμ°νΈκ° μμ΅λλ€' }).then(setHealth).catch(() => setHealth({ ok: false, error: 'μν νμΈ μ€ν¨' }));
|
| 449 |
+
}, []);
|
| 450 |
+
|
| 451 |
+
const activeJobs = jobs.filter(j => !j.error);
|
| 452 |
+
useEffect(() => {
|
| 453 |
+
if (activeJobs.length === 0) return;
|
| 454 |
+
const id = setInterval(() => setTick(t => t + 1), 1000);
|
| 455 |
+
return () => clearInterval(id);
|
| 456 |
+
}, [activeJobs.length]);
|
| 457 |
+
|
| 458 |
+
const presets = ADULT_FACE_PRESETS;
|
| 459 |
+
const setImg = (key, v, name) => {
|
| 460 |
+
setImages(prev => ({ ...prev, [key]: v })); setImageNames(prev => ({ ...prev, [key]: v ? (name || null) : null }));
|
| 461 |
+
if (key === 'pose' && !v) { if (angle === 'λ νΌλ°μ€ λ°λ¦') setAngle('λ°μΈ‘λ©΄'); if (gaze === 'λ νΌλ°μ€ λ°λ¦') setGaze('μμ°μ€λ¬μ΄ μμ '); }
|
| 462 |
+
};
|
| 463 |
+
|
| 464 |
+
const kindOf = (g, slot) => { // μ μ₯λ κ°μ΄ κ·Έ μ· μ’
λ₯μ μμΌλ©΄ κΈ°λ³Έκ°μΌλ‘
|
| 465 |
+
const list = DETAIL_KINDS_BY_GARMENT[g] || [];
|
| 466 |
+
const v = detailKinds[`${g}:${slot}`];
|
| 467 |
+
return list.some(k => k.key === v) ? v : defaultKind(g, slot);
|
| 468 |
+
};
|
| 469 |
+
const detailList = DETAIL_GARMENTS.flatMap(g => DETAIL_SLOTS.map(slot => ({ garment: g.key, kind: kindOf(g.key, slot), image: images[`detail:${g.key}:${slot}`], filename: imageNames[`detail:${g.key}:${slot}`] })))
|
| 470 |
+
.filter(x => x.image && images[x.garment]);
|
| 471 |
+
const detailCount = detailList.length;
|
| 472 |
+
const missing = [];
|
| 473 |
+
if (!images.outer && !images.top && !images.bottom) missing.push('μμ 1κ° μ΄μ (μμ°ν°Β·μμΒ·νμ)');
|
| 474 |
+
const canGenerate = missing.length === 0 && (faceUpload || facePreset) && health?.ok;
|
| 475 |
+
|
| 476 |
+
// νλμ payload λ‘ μμ
1건 μμ. payload λ κ²°κ³Όμ ν¨κ» 보κ΄λμ΄ "μ΄ μ€μ μΌλ‘ λ€μ μμ±"μ μ°μΈλ€.
|
| 477 |
+
const startJob = async (payload, meta) => {
|
| 478 |
+
const id = Date.now().toString(36) + Math.random().toString(36).slice(2, 5);
|
| 479 |
+
setJobs(prev => [...prev, { id, meta, payload, stageLabel: 'μμ² μ μ‘ μ€', startedAt: Date.now() }]);
|
| 480 |
+
const patch = (p) => setJobs(prev => prev.map(j => j.id === id ? { ...j, ...p } : j));
|
| 481 |
+
let jobId;
|
| 482 |
+
try {
|
| 483 |
+
jobId = await submitToComfy(payload);
|
| 484 |
+
} catch (e) {
|
| 485 |
+
patch({ error: e.message }); return;
|
| 486 |
+
}
|
| 487 |
+
patch({ jobId, stageLabel: 'λκΈ° μ€' });
|
| 488 |
+
await trackJob(id, jobId, meta, patch, payload);
|
| 489 |
+
};
|
| 490 |
+
|
| 491 |
+
const buildPayload = () => {
|
| 492 |
+
const meta = { shot, angle, gaze, age, prompt, face: faceUpload ? 'μ
λ‘λ' : (presets.find(p => p.id === facePreset)?.label || facePreset) };
|
| 493 |
+
const mainImages = Object.fromEntries(Object.entries(images).filter(([k, v]) => v && !k.startsWith('detail:')));
|
| 494 |
+
return { face: faceUpload || facePreset, faceFilename: faceUpload ? faceUploadName : null, images: mainImages, imageFilenames: imageNames,
|
| 495 |
+
details: detailList.slice(0, DETAIL_MAX).map(x => ({ garment: x.garment, kind: x.kind, image: x.image, filename: x.filename || null })),
|
| 496 |
+
poseSpec: (images.pose || poseSpec.trim()) ? poseSpec.trim() : '',
|
| 497 |
+
options: { shot, angle, gaze, age, ...details }, prompt, meta };
|
| 498 |
+
};
|
| 499 |
+
|
| 500 |
+
const handleGenerate = () => {
|
| 501 |
+
if (user.oauth_enabled && !user.is_logged_in) { alert("λ‘κ·ΈμΈμ΄ νμν©λλ€. μ°μΈ‘ μλ¨μ 'Hugging Faceλ‘ λ‘κ·ΈμΈ' λ²νΌμ λλ¬μ£ΌμΈμ."); return; }
|
| 502 |
+
if (!canGenerate) return;
|
| 503 |
+
setError(null);
|
| 504 |
+
const payload = buildPayload();
|
| 505 |
+
for (let i = 0; i < genCount; i++) startJob(payload, payload.meta); // κ°μ payload κ°μ²΄ 곡μ (λ©λͺ¨λ¦¬ μ μ½)
|
| 506 |
+
};
|
| 507 |
+
|
| 508 |
+
// μΈμ
κ²°κ³Ό μμ : νλ©΄μμ μ κ±° + μλ² λ³΄κ΄λΆλ μμ ν΄ μλ‘κ³ μΉ¨ 볡ꡬλ₯Ό λ§μ
|
| 509 |
+
const deleteResult = async (r) => {
|
| 510 |
+
if (!confirm('μ΄ κ²°κ³Όλ₯Ό μ§μΈκΉμ? λλ릴 μ μμ΄μ.')) return;
|
| 511 |
+
setResults(prev => {
|
| 512 |
+
const next = prev.filter(x => x.id !== r.id);
|
| 513 |
+
setCurrent(cur => (cur?.id === r.id ? (next[0] || null) : cur));
|
| 514 |
+
return next;
|
| 515 |
+
});
|
| 516 |
+
try { if (r.jobId) await fetch(`/api/comfy/jobs/${r.jobId}`, { method: 'DELETE', headers: apiHeaders() }); } catch {}
|
| 517 |
+
};
|
| 518 |
+
|
| 519 |
+
// μΈμ
κ²°κ³Όμ 보κ΄λ payload λ‘ λμΌ μ‘°κ±΄ μ¬μμ± (νμ¬ νΌ μνλ 건λλ¦¬μ§ μμ)
|
| 520 |
+
const regenFrom = (r) => {
|
| 521 |
+
if (user.oauth_enabled && !user.is_logged_in) { alert("λ‘κ·ΈμΈμ΄ νμν©λλ€."); return; }
|
| 522 |
+
if (!r?.payload) return;
|
| 523 |
+
startJob(r.payload, r.meta);
|
| 524 |
+
};
|
| 525 |
+
|
| 526 |
+
// μλ² μμ
μ μλ£κΉμ§ λ°λΌκ°λ©° κ²°κ³Ό/μλ¬λ₯Ό λ°μ (μ μμ²κ³Ό μλ‘κ³ μΉ¨ 볡ꡬ λ λ€ μ¬μ©)
|
| 527 |
+
const trackJob = async (id, jobId, meta, patch, payload = null) => {
|
| 528 |
+
try {
|
| 529 |
+
const j = await pollComfyJob(jobId, (st) => patch({ stageLabel: st.stageLabel, execStartedAt: st.execStartedAt || null }));
|
| 530 |
+
if (!j) { setJobs(prev => prev.filter(x => x.id !== id)); return; } // μ·¨μλ¨
|
| 531 |
+
const item = { id, jobId, imageUrl: j.imageUrl, meta, payload, elapsedSec: j.elapsedSec, createdAt: j.createdAt, garmentSpecs: j.garmentSpecs || null, finalPrompt: j.finalPrompt || null, poseSpec: j.poseSpec || null };
|
| 532 |
+
setResults(prev => prev.some(r => r.id === id) ? prev : [item, ...prev]);
|
| 533 |
+
setCurrent(prev => prev || item);
|
| 534 |
+
setJobs(prev => prev.filter(x => x.id !== id));
|
| 535 |
+
} catch (e) {
|
| 536 |
+
patch({ error: e.message });
|
| 537 |
+
}
|
| 538 |
+
};
|
| 539 |
+
const dismissJob = (id) => setJobs(prev => prev.filter(j => j.id !== id));
|
| 540 |
+
const cancelJob = async (job) => { // μ§ν μ€ μμ
μ·¨μ: μλ²μ μμ² ν μΉ΄λ μ κ±° (ν΄λ§λ cancelled λ₯Ό λ³΄κ³ λ©μΆ€)
|
| 541 |
+
setJobs(prev => prev.map(x => x.id === job.id ? { ...x, cancelling: true, stageLabel: 'μ·¨μ μ€' } : x));
|
| 542 |
+
try { if (job.jobId) await fetch(`/api/comfy/jobs/${job.jobId}/cancel`, { method: 'POST', headers: apiHeaders() }); } catch {}
|
| 543 |
+
setJobs(prev => prev.filter(x => x.id !== job.id));
|
| 544 |
+
};
|
| 545 |
+
|
| 546 |
+
// μλ‘κ³ μΉ¨/μ¬μ μ μ μλ²μ λ¨μ μλ λ΄ μμ
볡ꡬ
|
| 547 |
+
useEffect(() => {
|
| 548 |
+
(async () => {
|
| 549 |
+
try {
|
| 550 |
+
const r = await fetch('/api/comfy/jobs', { headers: apiHeaders() });
|
| 551 |
+
if (!r.ok) return;
|
| 552 |
+
const { jobs: saved } = await r.json();
|
| 553 |
+
const done = saved.filter(j => j.status === 'done' && j.imageUrl)
|
| 554 |
+
.map(j => ({ id: j.id, jobId: j.id, imageUrl: j.imageUrl, meta: j.meta || {}, elapsedSec: j.elapsedSec, createdAt: j.createdAt, garmentSpecs: j.garmentSpecs || null, finalPrompt: j.finalPrompt || null, poseSpec: j.poseSpec || null }))
|
| 555 |
+
.sort((a, b) => b.createdAt - a.createdAt);
|
| 556 |
+
if (done.length) { setResults(done); setCurrent(prev => prev || done[0]); }
|
| 557 |
+
const pending = saved.filter(j => j.status !== 'done' && j.status !== 'cancelled');
|
| 558 |
+
if (pending.length) {
|
| 559 |
+
setJobs(pending.map(j => ({ id: j.id, jobId: j.id, meta: j.meta || {}, stageLabel: j.stageLabel, startedAt: j.createdAt, execStartedAt: j.execStartedAt || null, error: j.error || null })));
|
| 560 |
+
for (const j of pending.filter(x => x.status === 'running')) {
|
| 561 |
+
const patch = (p) => setJobs(prev => prev.map(x => x.id === j.id ? { ...x, ...p } : x));
|
| 562 |
+
trackJob(j.id, j.id, j.meta || {}, patch);
|
| 563 |
+
}
|
| 564 |
+
}
|
| 565 |
+
} catch {}
|
| 566 |
+
})();
|
| 567 |
+
}, []);
|
| 568 |
+
|
| 569 |
+
// ββ Left: settings ββββββββββββββββββββββββββββββββββββββββ
|
| 570 |
+
const left = h('aside', { className: 'w-full lg:w-[420px] xl:w-[460px] shrink-0 h-full overflow-y-auto border-r border-[#2a2a2a] bg-[#1e1e1e]' },
|
| 571 |
+
h('div', { className: 'p-5 space-y-6' },
|
| 572 |
+
|
| 573 |
+
h('section', null,
|
| 574 |
+
h(SectionTitle, null, 'μΌκ΅΄'),
|
| 575 |
+
h('div', { className: 'grid grid-cols-4 gap-2' },
|
| 576 |
+
presets.map(p => h(FaceTile, { key: p.id, preset: p, selected: !faceUpload && facePreset === p.id, onClick: () => { setFaceUpload(null); setFacePreset(p.id); } })),
|
| 577 |
+
h('button', { type: 'button', onClick: () => faceFileRef.current?.click(),
|
| 578 |
+
className: `relative rounded-xl overflow-hidden border-2 ${faceUpload ? 'border-brand-blue' : 'border-dashed border-[#3a3a3a] hover:border-[#4b5563] bg-[#242424]'}`, style: { aspectRatio: '1 / 1' } },
|
| 579 |
+
faceUpload
|
| 580 |
+
? h(React.Fragment, null, h('img', { src: faceUpload, className: 'w-full h-full object-cover' }),
|
| 581 |
+
h('span', { onClick: e => { e.stopPropagation(); setFaceUpload(null); }, className: 'absolute top-1 right-1 w-5 h-5 rounded-full bg-black/70 flex items-center justify-center' }, h(X, { size: 11 })),
|
| 582 |
+
h('div', { className: 'absolute bottom-0 inset-x-0 py-0.5 bg-black/60 text-[10.5px] text-center' }, 'μ
λ‘λ'))
|
| 583 |
+
: h('div', { className: 'absolute inset-0 flex flex-col items-center justify-center gap-1 text-gray-400' }, h(User, { size: 16 }), h('span', { className: 'text-[10.5px]' }, 'μ§μ μ
λ‘λ'))),
|
| 584 |
+
h('input', { ref: faceFileRef, type: 'file', accept: 'image/*', className: 'hidden', onChange: async e => { const f = e.target.files?.[0]; if (f) { setFaceUpload(await fileToDataUrl(f, 1024)); setFaceUploadName(f.name); } e.target.value = ''; } }))),
|
| 585 |
+
|
| 586 |
+
h('section', null, h(SectionTitle, null, 'μ· μ ν'), h(Segmented, { options: SHOT_OPTIONS, value: shot, cols: 3, onChange: setShot })),
|
| 587 |
+
h('section', null,
|
| 588 |
+
h(SectionTitle, { right: images.pose && h('span', { className: 'text-[11px] text-gray-500' }, "'λ νΌλ°μ€ λ°λ¦' = ν¬μ¦ μ¬μ§μ μ΅κΈ") }, 'μΉ΄λ©λΌ μ΅κΈ'),
|
| 589 |
+
h(Segmented, { options: images.pose ? ANGLE_OPTIONS : ANGLE_OPTIONS.filter(o => o !== 'λ νΌλ°μ€ λ°λ¦'), value: angle, onChange: setAngle, cols: 4 })),
|
| 590 |
+
h('section', null, h(SectionTitle, null, 'μμ '), h(Segmented, { options: images.pose ? GAZE_OPTIONS : GAZE_OPTIONS.filter(o => o !== 'λ νΌλ°μ€ λ°λ¦'), value: gaze, onChange: setGaze })),
|
| 591 |
+
|
| 592 |
+
h('section', null,
|
| 593 |
+
h(SectionTitle, null, 'ν둬ννΈ μμ±'),
|
| 594 |
+
h('textarea', { value: prompt, onChange: e => setPrompt(e.target.value), rows: 3,
|
| 595 |
+
placeholder: 'μΆκ° μ§μμ¬ν (μ ν). μ: μμ μ£Όλ¨Έλμ λ£κ³ μ΄μ§ λ―Έμ, μλ§€λ₯Ό ν λ² μ μ΄ μ¬λ¦° μ€νμΌλ§',
|
| 596 |
+
className: 'w-full rounded-xl bg-[#242424] border border-[#333] px-3 py-2.5 text-[13px] text-gray-100 placeholder-gray-500 focus:outline-none focus:border-brand-blue' })),
|
| 597 |
+
|
| 598 |
+
h('section', null,
|
| 599 |
+
h(SectionTitle, { right: h('span', { className: 'text-[11px] text-gray-500' }, 'μμ°ν°Β·μμΒ·νμ μ€ 1κ° μ΄μ') }, 'μ΄λ―Έμ§ μ
λ‘λ'),
|
| 600 |
+
h('div', { className: 'grid grid-cols-4 gap-2' },
|
| 601 |
+
IMAGE_SLOTS.map(s => h(UploadTile, { key: s.key, slot: s, value: images[s.key], onChange: (v, name) => setImg(s.key, v, name) })))),
|
| 602 |
+
|
| 603 |
+
(images.pose || poseSpec) && (health?.ok && health.poseText !== false) && h('section', { className: 'animate-fadeIn' },
|
| 604 |
+
h(SectionTitle, { right: h('span', { className: 'text-[11px] text-gray-500' }, 'λΉμ°λ©΄ λ νΌλ°μ€μμ μλ μΆμΆ') }, 'ν¬μ¦ μ§μ (μ ν)'),
|
| 605 |
+
h('textarea', { value: poseSpec, onChange: e => setPoseSpec(e.target.value), rows: 3,
|
| 606 |
+
placeholder: 'μ: μ€λ₯Ένμ λ€μ΄ μλ±μ μ€λ₯Έμͺ½ κ΄μλμ΄μ κ°λ³κ² λλ€. μΌνμ μμ°μ€λ½κ² λ΄λ¦¬κ³ 체μ€μ μΌλ°μ. λͺΈν΅μ μΉ΄λ©λΌ μͺ½μΌλ‘ μ΄μ§ μ°μΈ‘.',
|
| 607 |
+
className: 'w-full rounded-xl bg-[#242424] border border-[#333] px-3 py-2.5 text-[12.5px] text-gray-100 placeholder-gray-500 focus:outline-none focus:border-brand-blue' }),
|
| 608 |
+
h('p', { className: 'text-[11px] text-gray-500 mt-1.5 leading-relaxed' }, 'λ νΌλ°μ€ ν¬μ¦λ₯Ό λ¬Έμ₯μΌλ‘ λ°κΏ ν둬ννΈ λ§¨ λμ μ΅μ°μ μ§μλ‘ λ£μ΄μ. κ²°κ³Όκ° λμ€λ©΄ μλ ν¨λμμ μλ μΆμΆλ λ¬Έμ₯μ νμΈνκ³ , νλ¦° λΆλΆμ μ¬κΈ°μ κ³ μ³ λ€μ μμ±ν μ μμ΄μ.')),
|
| 609 |
+
|
| 610 |
+
h('section', null,
|
| 611 |
+
h(SectionTitle, null, 'κΈΈμ΄ Β· ν'),
|
| 612 |
+
h('div', { className: 'flex gap-1.5 mb-3' },
|
| 613 |
+
DETAIL_GROUPS.map(g => h('button', {
|
| 614 |
+
key: g.key, type: 'button', onClick: () => setDetailTab(g.key),
|
| 615 |
+
className: `px-3 py-1.5 rounded-lg text-[12.5px] font-semibold transition-colors ${detailTab === g.key
|
| 616 |
+
? 'bg-brand-blue text-white'
|
| 617 |
+
: (images[g.key] ? 'bg-[#2a2a2a] text-gray-200 hover:bg-[#333]' : 'bg-[#242424] text-gray-500 hover:text-gray-300')}`
|
| 618 |
+
}, g.label, images[g.key] ? h('span', { className: `ml-1.5 inline-block w-1.5 h-1.5 rounded-full align-middle ${detailTab === g.key ? 'bg-white' : 'bg-brand-blue'}` }) : null))),
|
| 619 |
+
(() => {
|
| 620 |
+
const g = DETAIL_GROUPS.find(x => x.key === detailTab);
|
| 621 |
+
const rows = [['κΈΈμ΄', g.length], ['ν', g.fit]];
|
| 622 |
+
return h('div', { key: g.key, className: 'space-y-2 animate-fadeIn' },
|
| 623 |
+
rows.map(([label, k]) => h('div', { key: k, className: 'grid grid-cols-[52px_1fr] items-center gap-2' },
|
| 624 |
+
h('span', { className: 'text-[12px] text-gray-400' }, label),
|
| 625 |
+
h('div', { className: 'flex flex-wrap gap-1.5' },
|
| 626 |
+
DETAIL_OPTIONS[k].options.map(o => h('button', {
|
| 627 |
+
key: o, type: 'button', onClick: () => setDetails(d => ({ ...d, [k]: o })),
|
| 628 |
+
className: `px-3 py-1.5 rounded-lg text-[12.5px] font-medium border transition-colors ${details[k] === o
|
| 629 |
+
? 'bg-brand-blue border-brand-blue text-white'
|
| 630 |
+
: 'bg-[#242424] border-[#333] text-gray-300 hover:border-[#4b5563] hover:text-white'}`
|
| 631 |
+
}, o))))),
|
| 632 |
+
!images[g.key] && h('p', { className: 'text-[11px] text-gray-500 pt-1' }, `${g.label} μ΄λ―Έμ§λ₯Ό μ¬λ¦¬μ§ μμΌλ©΄ μ΄ μ€μ μ μ¬μ©λμ§ μμμ.`));
|
| 633 |
+
})()),
|
| 634 |
+
|
| 635 |
+
h('section', null,
|
| 636 |
+
h(SectionTitle, { right: h('span', { className: `text-[11px] ${detailCount >= DETAIL_MAX ? 'text-amber-400' : 'text-gray-500'}` }, `μ ν Β· ${detailCount}/${DETAIL_MAX}μ₯`) }, 'λν
μΌ μ°Έμ‘°'),
|
| 637 |
+
health?.ok && health.detailCuts === false
|
| 638 |
+
? h('p', { className: 'text-[11.5px] text-gray-500' }, 'νμ¬ λ°°ν¬λ μν¬νλ‘μ°(workflow_api.json)μ λν
μΌ μ°Έμ‘° μ
λ ₯μ΄ μμ΄ μ¬μ©ν μ μμ΄μ. v5 μν¬νλ‘μ°λ₯Ό Export (API)ν΄μ κ΅μ²΄ν΄μ£ΌμΈμ.')
|
| 639 |
+
: h(React.Fragment, null,
|
| 640 |
+
h('p', { className: 'text-[11px] text-gray-500 mb-2.5 leading-relaxed' }, 'ν΄λ‘μ¦μ
μ μ¬λ¦¬κ³ μ΄λ€ λΆμμΈμ§ 골λΌμ£ΌμΈμ (μ· μ’
λ₯λ³λ‘ νλͺ©μ΄ λ¬λΌμ). μ‘°μ§κ°Β·μμ¬λ μ· μ 체μ, λλ¨Έμ§λ κ·Έ λΆμμλ§ λ°μνκ³ μ€λ£¨μ£μ λ©μΈ μ¬μ§ κ·Έλλ‘ μ μ§νλλ‘ μ λ¬λΌμ. μ°Έμ‘°κ° λ§μΌλ©΄ μ νλκ° λ¨μ΄μ Έμ μ 체 4μ₯κΉμ§λ§.'),
|
| 641 |
+
h('div', { className: 'grid grid-cols-2 gap-x-4 gap-y-2.5' },
|
| 642 |
+
DETAIL_GARMENTS.map(g => {
|
| 643 |
+
const enabled = !!images[g.key];
|
| 644 |
+
return h('div', { key: g.key, className: 'flex items-center gap-2' },
|
| 645 |
+
h('span', { className: `w-14 shrink-0 text-[12px] ${enabled ? 'text-gray-300' : 'text-gray-600'}`, title: enabled ? '' : `${g.label} μ΄λ―Έμ§λ₯Ό λ¨Όμ μ¬λ €μ£ΌμΈμ` }, g.label),
|
| 646 |
+
DETAIL_SLOTS.map(slot => {
|
| 647 |
+
const id = `${g.key}:${slot}`;
|
| 648 |
+
const cur = images[`detail:${id}`];
|
| 649 |
+
const kind = kindOf(g.key, slot);
|
| 650 |
+
const kindList = DETAIL_KINDS_BY_GARMENT[g.key] || [];
|
| 651 |
+
const kindObj = kindList.find(k => k.key === kind) || kindList[0];
|
| 652 |
+
return h('div', { key: slot, className: 'w-16 flex flex-col items-center gap-1' },
|
| 653 |
+
h(DetailTile, { value: cur, disabled: !enabled || (!cur && detailCount >= DETAIL_MAX), onChange: (v, name) => setImg(`detail:${id}`, v, name) }),
|
| 654 |
+
// μ’
λ₯ μ ν μΉ© β λ€μ΄ν°λΈ select λ₯Ό λ²νΌμ²λΌ 보μ΄κ² (appearance-none + 컀μ€ν
νμ΄ν)
|
| 655 |
+
h('div', { className: 'relative w-full', title: enabled ? `${kindObj.label} Β· ν΄λ¦ν΄μ λΆμ λ³κ²½` : '' },
|
| 656 |
+
h('select', {
|
| 657 |
+
value: kind, disabled: !enabled,
|
| 658 |
+
onChange: e => setDetailKinds(prev => ({ ...prev, [id]: e.target.value })),
|
| 659 |
+
style: { appearance: 'none', WebkitAppearance: 'none', MozAppearance: 'none' },
|
| 660 |
+
className: `w-full h-6 rounded-md border text-[10.5px] font-medium pl-1.5 pr-5 cursor-pointer focus:outline-none focus:border-brand-blue transition-colors
|
| 661 |
+
${cur ? 'bg-brand-blue/15 border-brand-blue/60 text-blue-200 hover:bg-brand-blue/25'
|
| 662 |
+
: 'bg-[#2a2a2a] border-[#3f3f3f] text-gray-300 hover:border-[#5a5a5a] hover:bg-[#303030]'}
|
| 663 |
+
disabled:opacity-40 disabled:cursor-default`
|
| 664 |
+
}, kindList.map(k => h('option', { key: k.key, value: k.key, className: 'bg-[#242424] text-gray-200' }, k.short))),
|
| 665 |
+
h(ChevronDown, { size: 12, className: `absolute right-1 top-1/2 -translate-y-1/2 pointer-events-none ${cur ? 'text-blue-200' : 'text-gray-400'}` })));
|
| 666 |
+
}));
|
| 667 |
+
})))),
|
| 668 |
+
|
| 669 |
+
h('div', { className: 'pt-3 pb-3 sticky bottom-0 bg-[#1e1e1e] border-t border-[#2a2a2a] -mx-5 px-5' },
|
| 670 |
+
missing.length > 0 && h('p', { className: 'text-[11.5px] text-gray-500 mb-2' }, `νμ: ${missing.join(', ')}`),
|
| 671 |
+
activeJobs.length > 0 && missing.length === 0 && h('p', { className: 'text-[11.5px] text-gray-500 mb-2' }, `${activeJobs.length}건 μ§ν μ€ β μ€μ μ λ°κΏ λ°λ‘ λ€μ μ»·μ κ±Έμ΄λ μ μμ΄μ`),
|
| 672 |
+
h('div', { className: 'flex items-center justify-between mb-2' },
|
| 673 |
+
h('span', { className: 'text-[11.5px] text-gray-500' }, 'λ§€μ'),
|
| 674 |
+
h('div', { className: 'flex gap-1' }, [1, 2].map(n =>
|
| 675 |
+
h('button', { key: n, type: 'button', onClick: () => setGenCount(n),
|
| 676 |
+
className: `px-3 py-1 rounded-lg text-[12px] font-medium transition-colors ${genCount === n ? 'bg-brand-blue text-white' : 'bg-[#2a2a2a] text-gray-400 hover:text-gray-200'}` }, `${n}μ₯`)))),
|
| 677 |
+
h('button', { type: 'button', onClick: handleGenerate, disabled: !canGenerate,
|
| 678 |
+
className: `w-full h-12 rounded-xl font-semibold text-[14px] flex items-center justify-center gap-2 transition-colors ${canGenerate ? 'bg-brand-blue hover:bg-brand-hover text-white' : 'bg-[#2a2a2a] text-gray-500 cursor-not-allowed'}` },
|
| 679 |
+
h(Sparkles, { size: 16 }),
|
| 680 |
+
activeJobs.length > 0 ? `λ£©λΆ μμ±${genCount > 1 ? ` ${genCount}μ₯` : ''} (${activeJobs.length}건 μ§ν μ€)` : `λ£©λΆ μμ±${genCount > 1 ? ` ${genCount}μ₯` : ''}`))));
|
| 681 |
+
|
| 682 |
+
// ββ Right: result βββββββββββββββββββββββββββββββββββββββββ
|
| 683 |
+
const right = h('main', { className: 'flex-1 h-full overflow-y-auto' },
|
| 684 |
+
h('div', { className: 'max-w-5xl mx-auto p-6 lg:p-8' },
|
| 685 |
+
!health?.ok && health && h('div', { className: 'mb-5 rounded-xl border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-[13px] text-amber-200 flex gap-2' },
|
| 686 |
+
h(AlertTriangle, { size: 16, className: 'shrink-0 mt-0.5' }), h('span', null, health.error || 'Comfy λΈλ¦¬μ§ μ€μ μ νμΈν΄μ£ΌμΈμ.')),
|
| 687 |
+
health?.ok && health.loginRequired === false && h('div', { className: 'mb-5 rounded-xl border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-[13px] text-amber-200 flex gap-2' },
|
| 688 |
+
h(AlertTriangle, { size: 16, className: 'shrink-0 mt-0.5' }), h('span', null, 'HF OAuthκ° μ°κ²°λμ§ μμ λ‘κ·ΈμΈ μμ΄ λꡬλ μμ±ν μ μλ μνμ
λλ€. READMEμ hf_oauth μ€μ κ³Ό Space μ¬μμμ νμΈν΄μ£ΌμΈμ.')),
|
| 689 |
+
error && h('div', { className: 'mb-5 rounded-xl border border-red-500/40 bg-red-500/10 px-4 py-3 text-[13px] text-red-200 flex gap-2 animate-fadeIn' },
|
| 690 |
+
h(AlertTriangle, { size: 16, className: 'shrink-0 mt-0.5' }), h('span', { className: 'break-all' }, error)),
|
| 691 |
+
|
| 692 |
+
jobs.length > 0 && h('div', { className: 'mb-5 rounded-xl border border-[#2a2a2a] bg-[#202020] overflow-hidden animate-fadeIn' },
|
| 693 |
+
h('div', { className: 'px-4 py-2.5 border-b border-[#2a2a2a] text-[12.5px] font-semibold text-gray-300 flex items-center gap-2' },
|
| 694 |
+
h(RefreshCw, { size: 13, className: activeJobs.length ? 'animate-spin text-brand-blue' : 'text-gray-500' }),
|
| 695 |
+
`μ§ν μ€ ${activeJobs.length}건`, jobs.length - activeJobs.length > 0 ? h('span', { className: 'text-red-300 font-normal' }, ` Β· μ€ν¨ ${jobs.length - activeJobs.length}건`) : null),
|
| 696 |
+
jobs.map((j, i) => h('div', { key: j.id, className: `px-4 py-2.5 flex items-center gap-3 text-[12.5px] ${i > 0 ? 'border-t border-[#262626]' : ''}` },
|
| 697 |
+
h('div', { className: `w-1.5 h-1.5 rounded-full shrink-0 ${j.error ? 'bg-red-400' : 'bg-brand-blue pulse-ring relative'}` }),
|
| 698 |
+
h('div', { className: 'flex-1 min-w-0' },
|
| 699 |
+
h('div', { className: 'text-gray-100 truncate' }, `${j.meta.face} Β· ${j.meta.shot} Β· ${j.meta.angle} Β· ${j.meta.gaze}`, j.meta.prompt ? h('span', { className: 'text-gray-500' }, ` Β· "${j.meta.prompt}"`) : null),
|
| 700 |
+
h('div', { className: j.error ? 'text-red-300 break-all' : 'text-gray-400' },
|
| 701 |
+
j.error ? j.error : (j.execStartedAt ? `${j.stageLabel} Β· ${fmtSec((Date.now() - j.execStartedAt) / 1000)}` : `${j.stageLabel} Β· λκΈ° ${fmtSec((Date.now() - j.startedAt) / 1000)}`))),
|
| 702 |
+
j.error
|
| 703 |
+
? h('button', { type: 'button', title: 'μ§μ°κΈ°', onClick: () => dismissJob(j.id), className: 'text-gray-500 hover:text-white' }, h(X, { size: 14 }))
|
| 704 |
+
: h('button', { type: 'button', title: 'μμ
μ·¨μ', disabled: j.cancelling, onClick: () => cancelJob(j),
|
| 705 |
+
className: 'shrink-0 text-[11.5px] px-2.5 py-1 rounded-lg border border-[#3a3a3a] text-gray-400 hover:text-red-300 hover:border-red-400/50 disabled:opacity-50 transition-colors' },
|
| 706 |
+
j.cancelling ? 'μ·¨μ μ€β¦' : 'μ·¨μ')))),
|
| 707 |
+
|
| 708 |
+
h('div', { className: 'grid grid-cols-1 md:grid-cols-[minmax(0,1fr)_200px] gap-6' },
|
| 709 |
+
// λ©μΈ λ·°μ΄
|
| 710 |
+
h('div', { className: 'rounded-2xl bg-[#202020] border border-[#2a2a2a] overflow-hidden relative', style: { minHeight: '60vh' } },
|
| 711 |
+
!current && activeJobs.length > 0
|
| 712 |
+
? h('div', { className: 'absolute inset-0 flex flex-col items-center justify-center gap-5' },
|
| 713 |
+
h('div', { className: 'shimmer absolute inset-0 opacity-60' }),
|
| 714 |
+
h('div', { className: 'relative pulse-ring w-14 h-14 rounded-full bg-brand-blue/20 flex items-center justify-center' }, h(Sparkles, { size: 22, className: 'text-brand-blue' })),
|
| 715 |
+
h('div', { className: 'relative text-center' },
|
| 716 |
+
h('div', { className: 'text-[15px] font-semibold text-gray-100' }, activeJobs[0].stageLabel),
|
| 717 |
+
h('div', { className: 'mt-1 text-[12.5px] text-gray-400 flex items-center justify-center gap-1' }, h(Clock, { size: 12 }),
|
| 718 |
+
activeJobs[0].execStartedAt ? `${fmtSec((Date.now() - activeJobs[0].execStartedAt) / 1000)} κ²½κ³Ό Β· λ³΄ν΅ 1~2λΆ μμ` : 'μ€ν μμλ₯Ό κΈ°λ€λ¦¬λ μ€')),
|
| 719 |
+
h('p', { className: 'relative text-[11.5px] text-gray-500 max-w-xs text-center' }, 'μ΄ νμ λ«μ§ λ§μΈμ. μμ±μ΄ λλλ©΄ μ¬κΈ°μ μ΄λ―Έμ§κ° νμλ©λλ€.'))
|
| 720 |
+
: current
|
| 721 |
+
? h('div', { className: 'animate-fadeIn flex flex-col' },
|
| 722 |
+
h('div', { className: 'flex justify-center bg-[#1c1c1c]' },
|
| 723 |
+
h('div', { className: 'relative inline-block' },
|
| 724 |
+
h('img', { src: current.imageUrl, onClick: () => setLightbox(true), title: 'ν΄λ¦νλ©΄ ν¬κ² 보기',
|
| 725 |
+
className: 'max-h-[78vh] w-auto max-w-full block bg-white cursor-zoom-in', alt: 'μμ± κ²°κ³Ό' }),
|
| 726 |
+
aiLabel && h('div', { className: 'ai-label-overlay' }, AI_LABEL_TEXT),
|
| 727 |
+
h('button', { type: 'button', onClick: () => setLightbox(true), title: 'ν¬κ² 보기',
|
| 728 |
+
className: 'absolute bottom-3 right-3 w-9 h-9 rounded-lg bg-black/55 hover:bg-black/75 text-white flex items-center justify-center' }, h(Maximize2, { size: 16 })))),
|
| 729 |
+
h('div', { className: 'flex items-center justify-between gap-3 px-4 py-3 border-t border-[#2a2a2a]' },
|
| 730 |
+
h('label', { className: 'flex items-center gap-2 cursor-pointer select-none text-[12.5px] text-gray-300' },
|
| 731 |
+
h('button', { type: 'button', role: 'switch', 'aria-checked': aiLabel, onClick: () => setAiLabel(v => !v),
|
| 732 |
+
className: `relative w-9 h-5 rounded-full transition-colors ${aiLabel ? 'bg-brand-blue' : 'bg-[#3a3a3a]'}` },
|
| 733 |
+
h('span', { className: `absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${aiLabel ? 'translate-x-4' : ''}` })),
|
| 734 |
+
h('span', null, "'AI μμ± μ΄λ―Έμ§' νκΈ°"),
|
| 735 |
+
h('span', { className: 'text-gray-500' }, aiLabel ? 'νλ©΄Β·λ€μ΄λ‘λμ ν¬ν¨' : 'νκΈ° μμ')),
|
| 736 |
+
h('button', { type: 'button', onClick: () => setExportOpen(true),
|
| 737 |
+
className: 'h-10 px-4 rounded-xl bg-brand-blue hover:bg-brand-hover text-white text-[13px] font-semibold flex items-center gap-1.5' }, h(Download, { size: 15 }), 'λ€μ΄λ‘λ')))
|
| 738 |
+
: h('div', { className: 'absolute inset-0 flex flex-col items-center justify-center text-gray-500 gap-2' },
|
| 739 |
+
h(Upload, { size: 28, className: 'opacity-50' }),
|
| 740 |
+
h('p', { className: 'text-[13.5px]' }, 'μΌμͺ½μμ μΌκ΅΄Β·μμμ κ³ λ₯΄κ³ λ£©λΆ μμ±μ λλ₯΄λ©΄'),
|
| 741 |
+
h('p', { className: 'text-[13.5px]' }, 'ν λ²μ λͺ¨λΈμ»·μ΄ μμ±λ©λλ€.'))),
|
| 742 |
+
// νμ€ν 리
|
| 743 |
+
h('div', null,
|
| 744 |
+
h('h3', { className: 'text-[13px] font-semibold text-gray-300 mb-2.5' }, `μ΄λ² μΈμ
κ²°κ³Ό ${results.length ? `(${results.length})` : ''}`),
|
| 745 |
+
results.length === 0
|
| 746 |
+
? h('p', { className: 'text-[12px] text-gray-500' }, 'μμ§ μμ')
|
| 747 |
+
: h('div', { className: 'grid grid-cols-3 md:grid-cols-1 gap-2' },
|
| 748 |
+
results.map(r => h('div', { key: r.id, className: 'relative group' },
|
| 749 |
+
h('button', { type: 'button', onClick: () => setCurrent(r),
|
| 750 |
+
className: `w-full relative rounded-xl overflow-hidden border-2 ${current?.id === r.id ? 'border-brand-blue' : 'border-transparent hover:border-[#4b5563]'}` },
|
| 751 |
+
h('img', { src: r.imageUrl, className: 'w-full h-auto block bg-white' }),
|
| 752 |
+
h('div', { className: 'absolute bottom-0 inset-x-0 px-2 py-1 bg-black/65 text-[10.5px] text-left leading-tight' },
|
| 753 |
+
h('div', null, `${r.meta.face ? r.meta.face + ' Β· ' : ''}${r.meta.shot} Β· ${r.meta.angle}`),
|
| 754 |
+
h('div', { className: 'text-gray-300' }, `${r.meta.gaze} Β· ${fmtSec(r.elapsedSec)}`))),
|
| 755 |
+
h('div', { className: 'absolute top-1.5 right-1.5 hidden group-hover:flex gap-1' },
|
| 756 |
+
r.payload && h('button', { type: 'button', onClick: (e) => { e.stopPropagation(); regenFrom(r); }, title: 'μ΄ μ€μ μΌλ‘ λ€μ μμ±',
|
| 757 |
+
className: 'w-7 h-7 rounded-lg bg-black/60 hover:bg-brand-blue text-white flex items-center justify-center transition-colors' },
|
| 758 |
+
h(RefreshCw, { size: 13 })),
|
| 759 |
+
h('button', { type: 'button', onClick: (e) => { e.stopPropagation(); deleteResult(r); }, title: 'μ΄ κ²°κ³Ό μ§μ°κΈ°',
|
| 760 |
+
className: 'w-7 h-7 rounded-lg bg-black/60 hover:bg-red-500 text-white flex items-center justify-center transition-colors' },
|
| 761 |
+
h(X, { size: 13 })))))))),
|
| 762 |
+
|
| 763 |
+
current && h('div', { className: 'mt-5 text-[12px] text-gray-500' },
|
| 764 |
+
`${current.meta.age} Β· ${current.meta.shot} Β· ${current.meta.angle} Β· ${current.meta.gaze}`, current.meta.prompt ? ` Β· "${current.meta.prompt}"` : ''),
|
| 765 |
+
current && (current.garmentSpecs || current.finalPrompt || current.poseSpec) && h('div', { className: 'mt-3 rounded-xl border border-[#2a2a2a] bg-[#202020]' },
|
| 766 |
+
h('button', { type: 'button', onClick: () => setShowSpecs(v => !v), className: 'w-full flex items-center justify-between px-4 py-2.5 text-[12.5px] font-semibold text-gray-300 hover:text-white' },
|
| 767 |
+
h('span', null, 'ν¬μ¦ λΆμ Β· μμ λΆμ Β· μ΅μ’
ν둬ννΈ'), h('span', { className: 'text-gray-500 font-normal' }, showSpecs ? 'μ κΈ°' : 'νΌμΉκΈ°')),
|
| 768 |
+
showSpecs && h('div', { className: 'px-4 pb-4 space-y-3 animate-fadeIn' },
|
| 769 |
+
current.poseSpec && h('div', null,
|
| 770 |
+
h('div', { className: 'flex items-center justify-between mb-1' },
|
| 771 |
+
h('div', { className: 'text-[11px] text-gray-500' }, 'ν¬μ¦ λΆμ (λ νΌλ°μ€ β λ¬Έμ₯, ν둬ννΈ μ΅μ°μ μ§μ)'),
|
| 772 |
+
h('button', { type: 'button', onClick: () => { setPoseSpec(current.poseSpec); document.querySelector('aside')?.scrollTo({ top: 0, behavior: 'smooth' }); },
|
| 773 |
+
className: 'text-[11px] text-brand-blue hover:underline' }, 'μ΄ λ¬Έμ₯μ μμ ν΄μ λ€μ μμ±')),
|
| 774 |
+
h('pre', { className: 'text-[11.5px] text-gray-200 whitespace-pre-wrap break-words bg-[#1a1a1a] rounded-lg p-3 max-h-40 overflow-y-auto' }, current.poseSpec)),
|
| 775 |
+
current.garmentSpecs && h('div', null,
|
| 776 |
+
h('div', { className: 'text-[11px] text-gray-500 mb-1' }, 'GPT λΉμ μμ λΆμ (GARMENT SPECS)'),
|
| 777 |
+
h('pre', { className: 'text-[11.5px] text-gray-200 whitespace-pre-wrap break-words bg-[#1a1a1a] rounded-lg p-3 max-h-48 overflow-y-auto' }, current.garmentSpecs)),
|
| 778 |
+
current.finalPrompt && h('div', null,
|
| 779 |
+
h('div', { className: 'text-[11px] text-gray-500 mb-1' }, 'GPT-imageμ μ λ¬λ μ΅μ’
ν둬ννΈ'),
|
| 780 |
+
h('pre', { className: 'text-[11.5px] text-gray-300 whitespace-pre-wrap break-words bg-[#1a1a1a] rounded-lg p-3 max-h-64 overflow-y-auto' }, current.finalPrompt))))));
|
| 781 |
+
|
| 782 |
+
// ββ Header ββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 783 |
+
const header = h('header', { className: 'h-14 shrink-0 border-b border-[#2a2a2a] bg-[#1a1a1a] flex items-center justify-between px-5' },
|
| 784 |
+
h('div', { className: 'flex items-center gap-5' },
|
| 785 |
+
h('div', { className: 'flex items-center gap-3' },
|
| 786 |
+
h('div', { className: 'w-8 h-8 rounded-lg bg-brand-blue flex items-center justify-center' }, h(Sparkles, { size: 16, className: 'text-white' })),
|
| 787 |
+
h('div', { className: 'text-[15px] font-bold tracking-tight' }, 'CLOVIS AI λ£©λΆ μμ±κΈ°')),
|
| 788 |
+
user.oauth_enabled && h('div', { className: 'flex items-center gap-2 text-[12.5px] pl-5 border-l border-[#2a2a2a]' },
|
| 789 |
+
user.is_logged_in
|
| 790 |
+
? h(React.Fragment, null,
|
| 791 |
+
h('span', { className: 'text-gray-300' }, user.name || user.username),
|
| 792 |
+
h('a', { href: user.logout_url, className: 'text-gray-500 hover:text-white' }, 'λ‘κ·Έμμ'))
|
| 793 |
+
: h('a', { href: user.login_url, className: 'px-3 py-1.5 rounded-lg bg-[#2a2a2a] hover:bg-[#333] text-gray-100' }, 'π€ Hugging Faceλ‘ λ‘κ·ΈμΈ'))),
|
| 794 |
+
h('div', null,
|
| 795 |
+
health && !health.ok && h('span', { className: 'inline-flex items-center gap-1.5 text-[12.5px] text-amber-400' },
|
| 796 |
+
h('span', { className: 'w-1.5 h-1.5 rounded-full bg-amber-400' }), 'Comfy μ€μ νμ')));
|
| 797 |
+
|
| 798 |
+
const lightboxEl = lightbox && current && h('div', {
|
| 799 |
+
className: 'fixed inset-0 z-50 bg-black/90 flex items-center justify-center animate-fadeIn cursor-zoom-out',
|
| 800 |
+
onClick: () => setLightbox(false) },
|
| 801 |
+
h('img', { src: current.imageUrl, alt: 'μμ± κ²°κ³Ό νλ', onClick: e => e.stopPropagation(),
|
| 802 |
+
className: 'max-w-[96vw] max-h-[96vh] object-contain bg-white cursor-default shadow-2xl' }),
|
| 803 |
+
aiLabel && h('div', { className: 'absolute top-4 right-16 text-[12px] text-gray-300 font-light pointer-events-none' }, AI_LABEL_TEXT),
|
| 804 |
+
h('button', { type: 'button', onClick: () => setLightbox(false), title: 'λ«κΈ° (Esc)',
|
| 805 |
+
className: 'absolute top-4 right-4 w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 text-white flex items-center justify-center' }, h(X, { size: 18 })),
|
| 806 |
+
h('div', { className: 'absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2', onClick: e => e.stopPropagation() },
|
| 807 |
+
h('button', { type: 'button', onClick: () => { setLightbox(false); setExportOpen(true); },
|
| 808 |
+
className: 'h-10 px-4 rounded-xl bg-brand-blue hover:bg-brand-hover text-white text-[13px] font-semibold flex items-center gap-1.5' }, h(Download, { size: 15 }), 'λ€μ΄λ‘λ')));
|
| 809 |
+
|
| 810 |
+
const exportEl = exportOpen && current && h(ExportModal, { current, aiLabel, onClose: () => setExportOpen(false) });
|
| 811 |
+
|
| 812 |
+
return h('div', { className: 'h-screen flex flex-col bg-[#1a1a1a]' }, header,
|
| 813 |
+
h('div', { className: 'flex-1 flex flex-col lg:flex-row min-h-0' }, left, right), lightboxEl, exportEl);
|
| 814 |
+
}
|
| 815 |
+
|
| 816 |
+
ReactDOM.createRoot(document.getElementById('root')).render(h(App));
|
| 817 |
+
</script>
|
| 818 |
+
</body>
|
| 819 |
+
</html>
|