Spaces:
Sleeping
Sleeping
feat: freeform product/service prompt (textarea + 10 preset chips)
Browse files- aether_ad/llm/prompts/generate_genome_from_prompt.txt +66 -0
- app.py +96 -0
- static/app.js +94 -225
- static/index.html +18 -70
- static/styles.css +47 -11
aether_ad/llm/prompts/generate_genome_from_prompt.txt
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[μν ] λΉμ μ AETHER-Ad Genesisμ Genome Generatorλ€.
|
| 2 |
+
μ¬μ©μμ μμ λ‘μ΄ ν μ€ ν둬ννΈ(μ ν λλ μλΉμ€)μμ μμ ν ProductGenome JSON κ°μ²΄ νλλ₯Ό μμ±νλ€.
|
| 3 |
+
|
| 4 |
+
[μ¬μ©μ ν둬ννΈ]
|
| 5 |
+
{prompt}
|
| 6 |
+
|
| 7 |
+
[κ³Όμ ]
|
| 8 |
+
μ ν둬ννΈμμ μλ νλλ₯Ό μ€μ€λ‘ μ μΆΒ·μ°½μνμ¬ νλμ JSONμ λ§λ λ€.
|
| 9 |
+
- brand: μ
λ ₯μ λΈλλλͺ
μ΄ λͺ
μλλ©΄ κ·Έλλ‘. μμΌλ©΄ μΉ΄ν
κ³ λ¦¬μ μ΄μΈλ¦¬λ κ°μ λΈλλλ₯Ό **μλ‘ μ°½μ**.
|
| 10 |
+
μ€μ‘΄ λΈλλλͺ
(μ€νλ²
μ€/μΌμ±/λμ΄ν€/νλ/μ ν/νμ΄νΈ λ±) μ¬μ© **μ λ κΈμ§**.
|
| 11 |
+
- category: νκ΅μ΄ μΉ΄ν
κ³ λ¦¬ (μ ν λλ μλΉμ€ λͺ¨λ κ°λ₯ β "μλ 컀νΌ", "λ¬λν", "O2O μΈν μλΉμ€", "μ¨λΌμΈ κ°μ" λ±).
|
| 12 |
+
- price_tier: budget | mid | premium | luxury μ€ νλ β ν둬ννΈμ ν€μμ μΆμ .
|
| 13 |
+
- functional_atoms: **3~6κ°**. μ
λ ₯μ λΆν/ꡬμ±μμκ° λͺ
μλλ©΄ κ·Έλλ‘ μ¬μ©. μμΌλ©΄ ν΄λΉ μ νΒ·μλΉμ€μ μ ν ν΅μ¬ μμλ₯Ό μΆμΆΒ·μ°½μ.
|
| 14 |
+
μλΉμ€ μΉ΄ν
κ³ λ¦¬λΌλ©΄ "μ μ (touchpoint)", "μΈν°νμ΄μ€", "μ½μλ μκ°" λ± μΆμ μμλ atomμΌλ‘ κ°λ₯.
|
| 15 |
+
|
| 16 |
+
[μμ κ·μΉ β νμ]
|
| 17 |
+
1. μΆλ ₯μ **μ€μ§ JSON κ°μ²΄ νλ**. λ€λ₯Έ ν
μ€νΈΒ·μ£ΌμΒ·ν΄μ€ μΌμ²΄ κΈμ§.
|
| 18 |
+
2. 첫 κΈμλ `{{`, λ§μ§λ§ κΈμλ `}}`.
|
| 19 |
+
3. Markdown μ½λ νμ€(```json β¦```) **κΈμ§** β μμ JSONλ§.
|
| 20 |
+
4. νκ΅μ΄ κΈ°λ°. μ¬κ³ κ³Όμ Β·"μ¬μ©μκ°β¦"Β·"The user isβ¦" λ± μΌμ²΄ κΈμ§.
|
| 21 |
+
|
| 22 |
+
[μμ κ·μΉ β μ€ν€λ§]
|
| 23 |
+
- κ° `functional_atom`:
|
| 24 |
+
- `id`: "F01_english_snake" νμ (F + 2μ리 μ«μ + μλ¬Έ snake_case).
|
| 25 |
+
- `name`: νκ΅μ΄ μ΄λ¦.
|
| 26 |
+
- `literal`: λ¬Έμ κ·Έλλ‘μ κΈ°λ₯/μν .
|
| 27 |
+
- `abstract_potentials`: **μ νν 3κ°** β μμ Β·μμ§Β·λ¬Ένμ ν¨μ (κΈ°λ₯ λ°λ³΅ κΈμ§, μμ μμ€).
|
| 28 |
+
- `scamper_variants`: S, C, A, M, P, E, R κ° ν€μ **μ§§μ νκ΅μ΄ 1κ°**μ©.
|
| 29 |
+
- `narrative_affordance`: "low" | "medium" | "high".
|
| 30 |
+
- `taboo_proximity`: "none" | "low" | "medium" | "high".
|
| 31 |
+
- `sensory_signatures`: visual / auditory / tactile / olfactory / kinesthetic κ° 1κ° νκ΅μ΄.
|
| 32 |
+
- `cultural_symbols.korean` 2κ°, `cultural_symbols.global` 1κ°.
|
| 33 |
+
- `ludic_potential` 2κ°.
|
| 34 |
+
- `physical_parts`: atom μ μ΄μμ μ΄λ¦ λμ΄.
|
| 35 |
+
|
| 36 |
+
[μΆλ ₯ μ€ν€λ§]
|
| 37 |
+
{{
|
| 38 |
+
"product_id": "auto_generated_slug",
|
| 39 |
+
"brand": "...",
|
| 40 |
+
"category": "...",
|
| 41 |
+
"price_tier": "premium",
|
| 42 |
+
"functional_atoms": [
|
| 43 |
+
{{
|
| 44 |
+
"id": "F01_xxx",
|
| 45 |
+
"name": "λΆνλͺ
",
|
| 46 |
+
"literal": "λ¬Έμ κΈ°λ₯",
|
| 47 |
+
"abstract_potentials": ["...", "...", "..."],
|
| 48 |
+
"scamper_variants": {{
|
| 49 |
+
"S": [".."], "C": [".."], "A": [".."],
|
| 50 |
+
"M": [".."], "P": [".."], "E": [".."], "R": [".."]
|
| 51 |
+
}},
|
| 52 |
+
"narrative_affordance": "high",
|
| 53 |
+
"taboo_proximity": "none"
|
| 54 |
+
}}
|
| 55 |
+
],
|
| 56 |
+
"physical_parts": ["...", "..."],
|
| 57 |
+
"sensory_signatures": {{
|
| 58 |
+
"visual": ["..."], "auditory": ["..."], "tactile": ["..."],
|
| 59 |
+
"olfactory": ["..."], "kinesthetic": ["..."]
|
| 60 |
+
}},
|
| 61 |
+
"cultural_symbols": {{ "korean": ["..", ".."], "global": [".."] }},
|
| 62 |
+
"ludic_potential": ["...", "..."],
|
| 63 |
+
"taboo_proximity": "none"
|
| 64 |
+
}}
|
| 65 |
+
|
| 66 |
+
JSON κ°μ²΄ νλλ§ μΆλ ₯.
|
app.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
|
|
|
| 5 |
import json
|
| 6 |
import logging
|
| 7 |
import os
|
|
@@ -49,6 +50,10 @@ CONTEXT = load_context(TENSIONS_PATH)
|
|
| 49 |
CUSTOM_PRODUCTS: dict[str, ProductGenome] = {}
|
| 50 |
_CUSTOM_LOCK = threading.Lock()
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
def _slugify(text: str) -> str:
|
| 54 |
"""Turn an arbitrary Korean/English string into a snake_case ASCII id."""
|
|
@@ -247,6 +252,97 @@ async def delete_custom(product_id: str) -> dict[str, bool]:
|
|
| 247 |
return {"removed": removed}
|
| 248 |
|
| 249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 250 |
@app.get("/api/tensions")
|
| 251 |
async def tensions() -> list[dict[str, Any]]:
|
| 252 |
return [t.model_dump() for t in CONTEXT.tension_archetypes]
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
import hashlib
|
| 6 |
import json
|
| 7 |
import logging
|
| 8 |
import os
|
|
|
|
| 50 |
CUSTOM_PRODUCTS: dict[str, ProductGenome] = {}
|
| 51 |
_CUSTOM_LOCK = threading.Lock()
|
| 52 |
|
| 53 |
+
# Prompt-hash β product_id cache so identical freeform prompts re-use expanded genomes.
|
| 54 |
+
_PROMPT_CACHE: dict[str, str] = {}
|
| 55 |
+
_PROMPT_LOCK = threading.Lock()
|
| 56 |
+
|
| 57 |
|
| 58 |
def _slugify(text: str) -> str:
|
| 59 |
"""Turn an arbitrary Korean/English string into a snake_case ASCII id."""
|
|
|
|
| 252 |
return {"removed": removed}
|
| 253 |
|
| 254 |
|
| 255 |
+
class FreeformProductPrompt(BaseModel):
|
| 256 |
+
prompt: str = Field(min_length=3, max_length=600)
|
| 257 |
+
backend: Literal["fireworks", "hf"] = "fireworks"
|
| 258 |
+
model: str | None = None
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
@app.post("/api/products/from_prompt")
|
| 262 |
+
async def from_prompt(req: FreeformProductPrompt) -> dict[str, Any]:
|
| 263 |
+
"""Take a freeform product/service prompt, expand into a ProductGenome.
|
| 264 |
+
|
| 265 |
+
Results are cached by SHA-256(prompt) so the same prompt is expanded once
|
| 266 |
+
per Space lifetime. Returns the same summary shape as /api/products.
|
| 267 |
+
"""
|
| 268 |
+
text = req.prompt.strip()
|
| 269 |
+
key = hashlib.sha256(text.encode("utf-8")).hexdigest()[:16]
|
| 270 |
+
|
| 271 |
+
with _PROMPT_LOCK:
|
| 272 |
+
cached_pid = _PROMPT_CACHE.get(key)
|
| 273 |
+
if cached_pid:
|
| 274 |
+
with _CUSTOM_LOCK:
|
| 275 |
+
genome = CUSTOM_PRODUCTS.get(cached_pid)
|
| 276 |
+
if genome is not None:
|
| 277 |
+
return _genome_summary(genome, custom=True)
|
| 278 |
+
|
| 279 |
+
if req.backend == "fireworks" and not os.getenv("FIREWORKS_API_KEY"):
|
| 280 |
+
raise HTTPException(status_code=400, detail="FIREWORKS_API_KEY not set")
|
| 281 |
+
if req.backend == "hf" and not os.getenv("HF_TOKEN"):
|
| 282 |
+
raise HTTPException(status_code=400, detail="HF_TOKEN not set")
|
| 283 |
+
try:
|
| 284 |
+
llm = (
|
| 285 |
+
FireworksKimiBackend(model=req.model or None)
|
| 286 |
+
if req.backend == "fireworks"
|
| 287 |
+
else HFInferenceBackend(model=req.model or None)
|
| 288 |
+
)
|
| 289 |
+
except Exception as e:
|
| 290 |
+
log.exception("backend init failed")
|
| 291 |
+
raise HTTPException(status_code=500, detail=f"Backend init failed: {e}") from e
|
| 292 |
+
|
| 293 |
+
prompt_tpl = _load_prompt("generate_genome_from_prompt.txt")
|
| 294 |
+
prompt = prompt_tpl.format(prompt=text)
|
| 295 |
+
|
| 296 |
+
try:
|
| 297 |
+
raw = await run_in_threadpool(llm.complete, prompt, 16384, 0.6)
|
| 298 |
+
except Exception as e:
|
| 299 |
+
log.exception("llm.complete failed for genome from_prompt")
|
| 300 |
+
raise HTTPException(status_code=502, detail=f"LLM failed: {e}") from e
|
| 301 |
+
|
| 302 |
+
cleaned, _ = strip_reasoning(raw)
|
| 303 |
+
body = cleaned or raw
|
| 304 |
+
|
| 305 |
+
try:
|
| 306 |
+
data = _extract_json_object(body)
|
| 307 |
+
except Exception as e:
|
| 308 |
+
log.warning("genome JSON parse failed: %s\n--raw--\n%s", e, raw[:2000])
|
| 309 |
+
raise HTTPException(
|
| 310 |
+
status_code=422,
|
| 311 |
+
detail="LLM did not return valid JSON. Try rephrasing the prompt "
|
| 312 |
+
"with brand Β· category Β· λΆν hints.",
|
| 313 |
+
) from e
|
| 314 |
+
|
| 315 |
+
brand_hint = str(data.get("brand") or "custom")
|
| 316 |
+
base_pid = _slugify(brand_hint)
|
| 317 |
+
pid = base_pid
|
| 318 |
+
n = 1
|
| 319 |
+
with _CUSTOM_LOCK:
|
| 320 |
+
while pid in CUSTOM_PRODUCTS:
|
| 321 |
+
n += 1
|
| 322 |
+
pid = f"{base_pid}_{n}"
|
| 323 |
+
data["product_id"] = pid
|
| 324 |
+
data.setdefault("brand", brand_hint)
|
| 325 |
+
data.setdefault("category", "custom")
|
| 326 |
+
data.setdefault("price_tier", "premium")
|
| 327 |
+
|
| 328 |
+
try:
|
| 329 |
+
genome = ProductGenome.model_validate(data)
|
| 330 |
+
except Exception as e:
|
| 331 |
+
log.warning("genome validation failed: %s\n--data--\n%s", e, json.dumps(data, ensure_ascii=False)[:2000])
|
| 332 |
+
raise HTTPException(
|
| 333 |
+
status_code=422,
|
| 334 |
+
detail=f"Expanded genome failed schema validation: {e}",
|
| 335 |
+
) from e
|
| 336 |
+
|
| 337 |
+
with _CUSTOM_LOCK:
|
| 338 |
+
CUSTOM_PRODUCTS[pid] = genome
|
| 339 |
+
with _PROMPT_LOCK:
|
| 340 |
+
_PROMPT_CACHE[key] = pid
|
| 341 |
+
|
| 342 |
+
log.info("registered custom product %s (from prompt, %d atoms)", pid, len(genome.functional_atoms))
|
| 343 |
+
return _genome_summary(genome, custom=True)
|
| 344 |
+
|
| 345 |
+
|
| 346 |
@app.get("/api/tensions")
|
| 347 |
async def tensions() -> list[dict[str, Any]]:
|
| 348 |
return [t.model_dump() for t in CONTEXT.tension_archetypes]
|
static/app.js
CHANGED
|
@@ -16,87 +16,38 @@ const _post = (url, body) => fetch(url, {
|
|
| 16 |
});
|
| 17 |
|
| 18 |
const API = {
|
| 19 |
-
meta:
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
expand: (body) => _post('/api/products/expand', body),
|
| 25 |
};
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
brand: 'AETHER-Phone', category: 'μ€λ§νΈν°', price_tier: 'premium',
|
| 40 |
-
parts: [
|
| 41 |
-
{ name: 'λμ€νλ μ΄', description: '6.3μΈμΉ OLED ν°μΉ ν¨λ' },
|
| 42 |
-
{ name: 'μΉ΄λ©λΌ', description: 'νλ©΄ νΈλ¦¬ν μΉ΄λ©λΌ' },
|
| 43 |
-
{ name: 'λ°°ν°λ¦¬', description: '4500mAh 리ν¬μ΄μ¨ λ°°ν°λ¦¬' },
|
| 44 |
-
{ name: 'νλ‘μΈμ', description: 'μ체 μ€κ³ AI μΉ©μ
' },
|
| 45 |
-
{ name: 'μ§λλͺ¨ν°', description: 'ν
ν± νΌλλ°±μ© λ―Έλ λͺ¨ν°' },
|
| 46 |
-
],
|
| 47 |
-
},
|
| 48 |
-
sneaker: {
|
| 49 |
-
brand: 'PULSE-Run', category: 'λ¬λν', price_tier: 'mid',
|
| 50 |
-
parts: [
|
| 51 |
-
{ name: 'λ―Έλμ', description: 'λ°ν¬νΌ μμΆ©μ¬' },
|
| 52 |
-
{ name: 'μμμ', description: 'κ³ λ¬΄ μ μ§λ©΄' },
|
| 53 |
-
{ name: 'μ΄νΌ', description: 'ν΅κΈ°μ± λνΈ μ§λ¬Ό' },
|
| 54 |
-
{ name: 'λ', description: 'λΌμ΄λ λ μ΄μ€' },
|
| 55 |
-
{ name: 'λ€κΏμΉμ»΅', description: 'μν¬λ μ€λ₯Ό κ°μΈλ TPU' },
|
| 56 |
-
],
|
| 57 |
-
},
|
| 58 |
-
beer: {
|
| 59 |
-
brand: 'HOP-Haru', category: 'μμ λ§₯μ£Ό IPA', price_tier: 'mid',
|
| 60 |
-
parts: [
|
| 61 |
-
{ name: 'λ³', description: 'κ°μ μ 리 330ml' },
|
| 62 |
-
{ name: 'λκ»', description: 'ν¬λΌμ΄ μΊ‘' },
|
| 63 |
-
{ name: 'κ±°ν', description: 'μλΆ νμ ν€λ' },
|
| 64 |
-
{ name: 'λΌλ²¨', description: 'κ°μ λΈλλ λ ν°λ§' },
|
| 65 |
-
{ name: 'ν', description: 'μ΄λ§κ³Ό μνΈλ¬μ€ ν₯' },
|
| 66 |
-
],
|
| 67 |
-
},
|
| 68 |
-
cosmetic: {
|
| 69 |
-
brand: 'GLOW-Han', category: 'μ€ν¨μΌμ΄ μ°ν', price_tier: 'luxury',
|
| 70 |
-
parts: [
|
| 71 |
-
{ name: 'μ€ν¬μ΄λ', description: 'μ 리 λλ‘νΌ' },
|
| 72 |
-
{ name: 'λ³', description: 'κ°μ μμΈμ μ°¨λ¨ μ 리' },
|
| 73 |
-
{ name: 'μΈλΌ', description: 'μ μ± μλ ν¬λͺ
μ‘체' },
|
| 74 |
-
{ name: 'ν₯', description: 'νλ°© νλΈ λ
ΈνΈ' },
|
| 75 |
-
{ name: 'μΌμ΄μ€', description: 'νμ§ μ§κ° μΈκ³½ λ°μ€' },
|
| 76 |
-
],
|
| 77 |
-
},
|
| 78 |
-
car: {
|
| 79 |
-
brand: 'SPIRA-EV', category: 'μ κΈ°μ°¨', price_tier: 'luxury',
|
| 80 |
-
parts: [
|
| 81 |
-
{ name: 'λ°°ν°λ¦¬ν©', description: '차체 λ°λ₯ μΌμ²΄ν' },
|
| 82 |
-
{ name: 'λͺ¨ν°', description: 'λμΌ νΌλ¨ΈλνΈ λ§κ·Έλ·' },
|
| 83 |
-
{ name: 'μ€ν¬λ¦°', description: '17μΈμΉ μ€μ ν°μΉ' },
|
| 84 |
-
{ name: 'νΈλ€', description: 'μν¬ ν μ€ν°μ΄λ§' },
|
| 85 |
-
{ name: 'μΆ©μ ν¬νΈ', description: '800V κΈμ μΆ©μ ' },
|
| 86 |
-
],
|
| 87 |
-
},
|
| 88 |
};
|
| 89 |
|
| 90 |
let TENSIONS = [];
|
| 91 |
-
let PRODUCTS = [];
|
| 92 |
let CHARTS = [];
|
| 93 |
let PIPELINE_TIMER = null;
|
|
|
|
|
|
|
| 94 |
|
| 95 |
document.addEventListener('DOMContentLoaded', init);
|
| 96 |
|
| 97 |
async function init() {
|
| 98 |
wireInputs();
|
| 99 |
-
await Promise.all([loadMeta(),
|
| 100 |
}
|
| 101 |
|
| 102 |
async function loadMeta() {
|
|
@@ -117,29 +68,6 @@ async function loadMeta() {
|
|
| 117 |
} catch (e) { console.error('meta failed', e); }
|
| 118 |
}
|
| 119 |
|
| 120 |
-
async function loadProducts() {
|
| 121 |
-
PRODUCTS = await API.products();
|
| 122 |
-
const sel = $('#productSel'); sel.innerHTML = '';
|
| 123 |
-
PRODUCTS.forEach(p => {
|
| 124 |
-
const o = document.createElement('option');
|
| 125 |
-
o.value = p.product_id;
|
| 126 |
-
o.textContent = `${p.brand} Β· ${p.category}`;
|
| 127 |
-
sel.appendChild(o);
|
| 128 |
-
});
|
| 129 |
-
updateProductMeta();
|
| 130 |
-
}
|
| 131 |
-
|
| 132 |
-
function updateProductMeta() {
|
| 133 |
-
const pid = $('#productSel').value;
|
| 134 |
-
const p = PRODUCTS.find(x => x.product_id === pid);
|
| 135 |
-
if (!p) return;
|
| 136 |
-
const atomList = (p.atoms || []).map(a => a.name).join(' Β· ');
|
| 137 |
-
$('#productMeta').innerHTML = `
|
| 138 |
-
<strong>${p.product_id}</strong> Β· tier: <strong>${p.price_tier || 'β'}</strong> Β· ${p.atom_count} functional atoms
|
| 139 |
-
<br/><span style="color: var(--text-subtle);">${atomList}</span>
|
| 140 |
-
`;
|
| 141 |
-
}
|
| 142 |
-
|
| 143 |
async function loadTensions() {
|
| 144 |
TENSIONS = await API.tensions();
|
| 145 |
const sel = $('#tensionSel'); sel.innerHTML = '';
|
|
@@ -160,7 +88,8 @@ function updateGreimas() {
|
|
| 160 |
$('[data-pos="s2"]').textContent = sq.S2;
|
| 161 |
$('[data-pos="ns1"]').textContent = sq.not_S1;
|
| 162 |
$('[data-pos="ns2"]').textContent = sq.not_S2;
|
| 163 |
-
$('#tensionPayoff').innerHTML =
|
|
|
|
| 164 |
}
|
| 165 |
|
| 166 |
async function loadRules() {
|
|
@@ -183,145 +112,85 @@ async function loadRules() {
|
|
| 183 |
}
|
| 184 |
|
| 185 |
function wireInputs() {
|
| 186 |
-
$('#productSel').addEventListener('change', updateProductMeta);
|
| 187 |
$('#tensionSel').addEventListener('change', updateGreimas);
|
| 188 |
$('#nSeeds').addEventListener('input', e => $('#nSeedsVal').textContent = e.target.value);
|
| 189 |
$('#topK').addEventListener('input', e => $('#topKVal').textContent = e.target.value);
|
| 190 |
$('#backendSel').addEventListener('change', syncBackendPlaceholder);
|
| 191 |
$('#genBtn').addEventListener('click', runGenerate);
|
| 192 |
-
wireModal();
|
| 193 |
-
}
|
| 194 |
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
$('#productModal').querySelectorAll('[data-close]').forEach(el => {
|
| 200 |
-
el.addEventListener('click', closeModal);
|
| 201 |
-
});
|
| 202 |
-
document.addEventListener('keydown', e => {
|
| 203 |
-
if (e.key === 'Escape' && !$('#productModal').hidden) closeModal();
|
| 204 |
-
});
|
| 205 |
-
$('#npAddPart').addEventListener('click', () => addPartRow('', ''));
|
| 206 |
-
$('#npSubmit').addEventListener('click', submitCustomProduct);
|
| 207 |
-
$$('.preset-chip').forEach(btn => {
|
| 208 |
-
btn.addEventListener('click', () => applyPreset(btn.dataset.preset));
|
| 209 |
});
|
| 210 |
-
// Seed with 2 empty rows
|
| 211 |
-
addPartRow('', '');
|
| 212 |
-
addPartRow('', '');
|
| 213 |
-
}
|
| 214 |
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
}
|
| 226 |
-
|
| 227 |
-
function addPartRow(name, desc) {
|
| 228 |
-
const rows = $$('#npParts .part-row');
|
| 229 |
-
if (rows.length >= 8) return;
|
| 230 |
-
const row = document.createElement('div');
|
| 231 |
-
row.className = 'part-row';
|
| 232 |
-
row.innerHTML = `
|
| 233 |
-
<input type="text" class="part-name" placeholder="λΆν μ΄λ¦" value="${escapeAttr(name)}" maxlength="30" />
|
| 234 |
-
<input type="text" class="part-desc" placeholder="ν μ€ μ€λͺ
(μ ν)" value="${escapeAttr(desc)}" maxlength="80" />
|
| 235 |
-
<button type="button" class="part-del" title="μμ ">β</button>
|
| 236 |
-
`;
|
| 237 |
-
row.querySelector('.part-del').addEventListener('click', () => {
|
| 238 |
-
if ($$('#npParts .part-row').length > 2) row.remove();
|
| 239 |
-
updatePartCount();
|
| 240 |
});
|
| 241 |
-
$('#npParts').appendChild(row);
|
| 242 |
-
updatePartCount();
|
| 243 |
}
|
| 244 |
|
| 245 |
-
function
|
| 246 |
-
const
|
| 247 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
}
|
| 249 |
|
| 250 |
-
function
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
$('#npBrand').value = p.brand;
|
| 254 |
-
$('#npCategory').value = p.category;
|
| 255 |
-
$('#npTier').value = p.price_tier;
|
| 256 |
-
$('#npParts').innerHTML = '';
|
| 257 |
-
p.parts.forEach(pt => addPartRow(pt.name, pt.description));
|
| 258 |
-
$('#npErr').hidden = true;
|
| 259 |
}
|
| 260 |
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
const
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
name: row.querySelector('.part-name').value.trim(),
|
| 267 |
-
description: row.querySelector('.part-desc').value.trim(),
|
| 268 |
-
})).filter(p => p.name);
|
| 269 |
-
|
| 270 |
-
if (!brand) return showModalErr('λΈλλλ₯Ό μ
λ ₯νμΈμ. (κ°μ λΈλλλ§)');
|
| 271 |
-
if (!category) return showModalErr('μΉ΄ν
κ³ λ¦¬λ₯Ό μ
λ ₯νμΈμ.');
|
| 272 |
-
if (parts.length < 2) return showModalErr('λΆνμ 2κ° μ΄μ μ
λ ₯νμΈμ.');
|
| 273 |
|
| 274 |
const backend = $('#backendSel').value === 'none' ? 'fireworks' : $('#backendSel').value;
|
| 275 |
-
|
| 276 |
-
$('#npSubmit').disabled = true;
|
| 277 |
-
$('#npSubmit .btn-spinner').hidden = false;
|
| 278 |
-
$('#npSubmit .btn-label').textContent = 'LLM νμ₯ μ€β¦ (30~60s)';
|
| 279 |
-
$('#npErr').hidden = true;
|
| 280 |
|
| 281 |
try {
|
| 282 |
-
const
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
const
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
showModalErr(`β νμ₯ μ€ν¨: ${msg}`);
|
| 295 |
-
} finally {
|
| 296 |
-
$('#npSubmit').disabled = false;
|
| 297 |
-
$('#npSubmit .btn-spinner').hidden = true;
|
| 298 |
-
$('#npSubmit .btn-label').textContent = 'β LLMμΌλ‘ νμ₯';
|
| 299 |
}
|
| 300 |
}
|
| 301 |
|
| 302 |
-
function
|
| 303 |
-
|
| 304 |
-
box.hidden = false;
|
| 305 |
-
box.textContent = msg;
|
| 306 |
-
}
|
| 307 |
-
|
| 308 |
-
function escapeAttr(s) {
|
| 309 |
-
return String(s || '').replace(/"/g, '"');
|
| 310 |
-
}
|
| 311 |
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
}
|
| 321 |
|
| 322 |
-
async function runGenerate() {
|
| 323 |
const body = {
|
| 324 |
-
product_id:
|
| 325 |
tension_id: $('#tensionSel').value,
|
| 326 |
persona: $('#personaIn').value.trim() || 'μΌλ° μλΉμ',
|
| 327 |
duration: parseInt($$('input[name="duration"]').find(r => r.checked).value, 10),
|
|
@@ -333,7 +202,6 @@ async function runGenerate() {
|
|
| 333 |
};
|
| 334 |
|
| 335 |
setRunning(true);
|
| 336 |
-
$('#errBox').hidden = true;
|
| 337 |
$('#emptyState').style.display = 'none';
|
| 338 |
animatePipeline();
|
| 339 |
|
|
@@ -346,8 +214,7 @@ async function runGenerate() {
|
|
| 346 |
const msg = err && err.message ? err.message : String(err);
|
| 347 |
$('#errBox').hidden = false;
|
| 348 |
$('#errBox').textContent = `β ${msg}`;
|
| 349 |
-
if (
|
| 350 |
-
else $('#emptyState').style.display = '';
|
| 351 |
console.error(err);
|
| 352 |
} finally {
|
| 353 |
setRunning(false);
|
|
@@ -393,7 +260,9 @@ function renderResults(data) {
|
|
| 393 |
$('#sumCount').textContent = data.summary.count;
|
| 394 |
$('#sumAvg').textContent = (data.summary.avg_final || 0).toFixed(3);
|
| 395 |
$('#sumTop').textContent = (data.summary.top_final || 0).toFixed(3);
|
| 396 |
-
$('#sumBackend').textContent =
|
|
|
|
|
|
|
| 397 |
|
| 398 |
CHARTS.forEach(c => { try { c.destroy(); } catch(_){} });
|
| 399 |
CHARTS = [];
|
|
@@ -470,14 +339,14 @@ function renderSeedCard(s, rank) {
|
|
| 470 |
<div class="scores-section">
|
| 471 |
<div class="radar-wrap"><canvas></canvas></div>
|
| 472 |
<div class="scores-table">
|
| 473 |
-
${scoreItem('Novelty',
|
| 474 |
-
${scoreItem('Utility',
|
| 475 |
-
${scoreItem('Affect',
|
| 476 |
-
${scoreItem('Humor/Pathos',
|
| 477 |
-
${scoreItem('Surprise',
|
| 478 |
-
${scoreItem('Risk',
|
| 479 |
-
${scoreItem('Gating',
|
| 480 |
-
${scoreItem('Final',
|
| 481 |
</div>
|
| 482 |
</div>
|
| 483 |
`;
|
|
@@ -506,10 +375,10 @@ function renderSeedCard(s, rank) {
|
|
| 506 |
scales: {
|
| 507 |
r: {
|
| 508 |
suggestedMin: 0, suggestedMax: 1,
|
| 509 |
-
ticks:
|
| 510 |
-
grid:
|
| 511 |
-
angleLines:
|
| 512 |
-
pointLabels:{ font: { size: 10, weight: '600' }, color: '#475569' },
|
| 513 |
},
|
| 514 |
},
|
| 515 |
},
|
|
@@ -564,8 +433,8 @@ function renderTicks(duration) {
|
|
| 564 |
function scoreItem(label, val, opts = {}) {
|
| 565 |
const v = opts.raw ? val : (typeof val === 'number' ? val.toFixed(3) : val);
|
| 566 |
const style = [];
|
| 567 |
-
if (opts.risk && Number(val) > 0)
|
| 568 |
-
if (opts.bold)
|
| 569 |
return `
|
| 570 |
<div class="score-item">
|
| 571 |
<span class="score-item-label">${label}</span>
|
|
|
|
| 16 |
});
|
| 17 |
|
| 18 |
const API = {
|
| 19 |
+
meta: () => fetch('/api/meta').then(r => r.json()),
|
| 20 |
+
tensions: () => fetch('/api/tensions').then(r => r.json()),
|
| 21 |
+
rules: () => fetch('/api/rules').then(r => r.json()),
|
| 22 |
+
generate: (body) => _post('/api/generate', body),
|
| 23 |
+
fromPrompt: (body) => _post('/api/products/from_prompt', body),
|
|
|
|
| 24 |
};
|
| 25 |
|
| 26 |
+
/* Preset prompt strings β one-liners for the textarea. */
|
| 27 |
+
const PROMPT_PRESETS = {
|
| 28 |
+
watch: 'μλ λ‘κ·Έ μλͺ©μκ³ AETHER-A Β· μ©λ, μ΄μΉ¨, μ¬νμ΄μ΄ ν¬λ¦¬μ€ν, λ°©μ, κ°μ£½ μ€νΈλ©',
|
| 29 |
+
coffee: 'μμ λ‘μ€ν
μλ μ»€νΌ NOVA-Bean Β· μλ, κ·ΈλΌμΈλ, νν°, μΆμΆμ, μΈλΌλ―Ή μ',
|
| 30 |
+
phone: 'μ€λ§νΈν° AETHER-Phone Β· OLED λμ€νλ μ΄, νΈλ¦¬ν μΉ΄λ©λΌ, λ°°ν°λ¦¬, AI μΉ©μ
, μ§λλͺ¨ν°',
|
| 31 |
+
sneaker: 'λ¬λν PULSE-Run Β· λ―Έλμ νΌ, μμμ κ³ λ¬΄, λνΈ μ΄νΌ, λ μ΄μ€, TPU λ€κΏμΉμ»΅',
|
| 32 |
+
beer: 'μμ IPA λ§₯μ£Ό HOP-Haru Β· κ°μ λ³, ν¬λΌμ΄ μΊ‘, ν€λ κ±°ν, λΌλ²¨, ν',
|
| 33 |
+
cosmetic: 'μ€ν¨μΌμ΄ μ°ν GLOW-Han Β· μ 리 μ€ν¬μ΄λ, κ°μ μμΈμ λ³, μΈλΌ, νλ°© νλΈ ν₯, νμ§ λ°μ€',
|
| 34 |
+
car: 'μ κΈ°μ°¨ SPIRA-EV Β· λ°λ₯ λ°°ν°λ¦¬ν©, λμΌ λ§κ·Έλ· λͺ¨ν°, 17μΈμΉ μ€ν¬λ¦°, μν¬ νΈλ€, 800V μΆ©μ ν¬νΈ',
|
| 35 |
+
laundry: 'O2O ν리미μ μΈν μλΉμ€ MOON-Fold Β· μκ±°κΈ°μ¬, μ± μ€μκ° μλ¦Ό, λΉλ 컀λ², ν₯κΈ° μΊ‘μ, μ·κ±Έμ΄',
|
| 36 |
+
edu: 'μ¨λΌμΈ μ½λ© λΆνΈμΊ ν CODE-Muze Β· μμ κ°μ, κ³Όμ νΌλλ°±, 1:1 μ½λ리뷰, μ¬λ λ°©, μλ£μ¦',
|
| 37 |
+
banking: 'λͺ¨λ°μΌ μν μ± HANA-Flow Β· ν νλ©΄ μμ ―, μ‘κΈ λ²νΌ, μ체 μΈμ¦, μλ¦Ό λ°°λ, μ±λ΄',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
};
|
| 39 |
|
| 40 |
let TENSIONS = [];
|
|
|
|
| 41 |
let CHARTS = [];
|
| 42 |
let PIPELINE_TIMER = null;
|
| 43 |
+
let CURRENT_PRODUCT = null; // {product_id, brand, category, price_tier, atom_count, atoms}
|
| 44 |
+
let LAST_PROMPT = null; // string for which CURRENT_PRODUCT was expanded
|
| 45 |
|
| 46 |
document.addEventListener('DOMContentLoaded', init);
|
| 47 |
|
| 48 |
async function init() {
|
| 49 |
wireInputs();
|
| 50 |
+
await Promise.all([loadMeta(), loadTensions(), loadRules()]);
|
| 51 |
}
|
| 52 |
|
| 53 |
async function loadMeta() {
|
|
|
|
| 68 |
} catch (e) { console.error('meta failed', e); }
|
| 69 |
}
|
| 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
async function loadTensions() {
|
| 72 |
TENSIONS = await API.tensions();
|
| 73 |
const sel = $('#tensionSel'); sel.innerHTML = '';
|
|
|
|
| 88 |
$('[data-pos="s2"]').textContent = sq.S2;
|
| 89 |
$('[data-pos="ns1"]').textContent = sq.not_S1;
|
| 90 |
$('[data-pos="ns2"]').textContent = sq.not_S2;
|
| 91 |
+
$('#tensionPayoff').innerHTML =
|
| 92 |
+
`${escapeHtml(t.description || '')}<br/><strong>payoff:</strong> ${escapeHtml(t.emotional_payoff)}`;
|
| 93 |
}
|
| 94 |
|
| 95 |
async function loadRules() {
|
|
|
|
| 112 |
}
|
| 113 |
|
| 114 |
function wireInputs() {
|
|
|
|
| 115 |
$('#tensionSel').addEventListener('change', updateGreimas);
|
| 116 |
$('#nSeeds').addEventListener('input', e => $('#nSeedsVal').textContent = e.target.value);
|
| 117 |
$('#topK').addEventListener('input', e => $('#topKVal').textContent = e.target.value);
|
| 118 |
$('#backendSel').addEventListener('change', syncBackendPlaceholder);
|
| 119 |
$('#genBtn').addEventListener('click', runGenerate);
|
|
|
|
|
|
|
| 120 |
|
| 121 |
+
$('#productPrompt').addEventListener('input', () => {
|
| 122 |
+
if ($('#productPrompt').value.trim() !== LAST_PROMPT) {
|
| 123 |
+
setStatus('idle', 'Generateλ₯Ό λλ₯΄λ©΄ Kimi-K2P6κ° genomeμ νμ₯ν©λλ€.');
|
| 124 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
+
$$('.preset-chip-inline').forEach(btn => {
|
| 128 |
+
btn.addEventListener('click', () => {
|
| 129 |
+
const key = btn.dataset.preset;
|
| 130 |
+
const val = PROMPT_PRESETS[key];
|
| 131 |
+
if (val) {
|
| 132 |
+
$('#productPrompt').value = val;
|
| 133 |
+
$('#productPrompt').dispatchEvent(new Event('input'));
|
| 134 |
+
$('#productPrompt').focus();
|
| 135 |
+
}
|
| 136 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
});
|
|
|
|
|
|
|
| 138 |
}
|
| 139 |
|
| 140 |
+
function syncBackendPlaceholder() {
|
| 141 |
+
const v = $('#backendSel').value;
|
| 142 |
+
const placeholders = {
|
| 143 |
+
fireworks: 'accounts/fireworks/models/kimi-k2p6',
|
| 144 |
+
hf: 'Qwen/Qwen2.5-72B-Instruct',
|
| 145 |
+
none: '(not used)',
|
| 146 |
+
};
|
| 147 |
+
$('#modelIn').placeholder = placeholders[v] || '';
|
| 148 |
}
|
| 149 |
|
| 150 |
+
function setStatus(kind, html) {
|
| 151 |
+
$('#productStatus .status-dot').className = `status-dot status-${kind}`;
|
| 152 |
+
$('#productStatus .status-text').innerHTML = html;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
}
|
| 154 |
|
| 155 |
+
/** Expand the prompt into a ProductGenome via LLM. Cached by (prompt text) locally. */
|
| 156 |
+
async function ensureProductReady() {
|
| 157 |
+
const text = $('#productPrompt').value.trim();
|
| 158 |
+
if (!text) throw new Error('μ ν λλ μλΉμ€ μ€λͺ
μ μ
λ ₯νμΈμ.');
|
| 159 |
+
if (CURRENT_PRODUCT && LAST_PROMPT === text) return CURRENT_PRODUCT;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
|
| 161 |
const backend = $('#backendSel').value === 'none' ? 'fireworks' : $('#backendSel').value;
|
| 162 |
+
setStatus('loading', '𧬠Kimi-K2P6κ° genomeμ νμ₯ μ€β¦ (30~60μ΄)');
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
|
| 164 |
try {
|
| 165 |
+
const product = await API.fromPrompt({ prompt: text, backend });
|
| 166 |
+
CURRENT_PRODUCT = product;
|
| 167 |
+
LAST_PROMPT = text;
|
| 168 |
+
const atoms = (product.atoms || []).map(a => a.name).join(' Β· ');
|
| 169 |
+
setStatus('ready',
|
| 170 |
+
`β <strong>${escapeHtml(product.brand)}</strong> Β· ${escapeHtml(product.category)} Β· ${product.atom_count} atoms` +
|
| 171 |
+
(atoms ? `<br/><span style="color: var(--text-subtle); font-size: 11px;">${escapeHtml(atoms)}</span>` : '')
|
| 172 |
+
);
|
| 173 |
+
return product;
|
| 174 |
+
} catch (e) {
|
| 175 |
+
setStatus('error', `β νμ₯ μ€ν¨: ${escapeHtml(e.message || String(e))}`);
|
| 176 |
+
throw e;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
}
|
| 178 |
}
|
| 179 |
|
| 180 |
+
async function runGenerate() {
|
| 181 |
+
$('#errBox').hidden = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
|
| 183 |
+
let product;
|
| 184 |
+
try {
|
| 185 |
+
product = await ensureProductReady();
|
| 186 |
+
} catch (err) {
|
| 187 |
+
$('#errBox').hidden = false;
|
| 188 |
+
$('#errBox').textContent = `β ${err.message || err}`;
|
| 189 |
+
return;
|
| 190 |
+
}
|
|
|
|
| 191 |
|
|
|
|
| 192 |
const body = {
|
| 193 |
+
product_id: product.product_id,
|
| 194 |
tension_id: $('#tensionSel').value,
|
| 195 |
persona: $('#personaIn').value.trim() || 'μΌλ° μλΉμ',
|
| 196 |
duration: parseInt($$('input[name="duration"]').find(r => r.checked).value, 10),
|
|
|
|
| 202 |
};
|
| 203 |
|
| 204 |
setRunning(true);
|
|
|
|
| 205 |
$('#emptyState').style.display = 'none';
|
| 206 |
animatePipeline();
|
| 207 |
|
|
|
|
| 214 |
const msg = err && err.message ? err.message : String(err);
|
| 215 |
$('#errBox').hidden = false;
|
| 216 |
$('#errBox').textContent = `β ${msg}`;
|
| 217 |
+
if ($('#summaryBar').hidden) $('#emptyState').style.display = '';
|
|
|
|
| 218 |
console.error(err);
|
| 219 |
} finally {
|
| 220 |
setRunning(false);
|
|
|
|
| 260 |
$('#sumCount').textContent = data.summary.count;
|
| 261 |
$('#sumAvg').textContent = (data.summary.avg_final || 0).toFixed(3);
|
| 262 |
$('#sumTop').textContent = (data.summary.top_final || 0).toFixed(3);
|
| 263 |
+
$('#sumBackend').textContent =
|
| 264 |
+
data.summary.backend +
|
| 265 |
+
(data.summary.model ? ' Β· ' + data.summary.model.split('/').pop() : '');
|
| 266 |
|
| 267 |
CHARTS.forEach(c => { try { c.destroy(); } catch(_){} });
|
| 268 |
CHARTS = [];
|
|
|
|
| 339 |
<div class="scores-section">
|
| 340 |
<div class="radar-wrap"><canvas></canvas></div>
|
| 341 |
<div class="scores-table">
|
| 342 |
+
${scoreItem('Novelty', score.novelty)}
|
| 343 |
+
${scoreItem('Utility', score.utility)}
|
| 344 |
+
${scoreItem('Affect', score.affect)}
|
| 345 |
+
${scoreItem('Humor/Pathos', score.humor_or_pathos)}
|
| 346 |
+
${scoreItem('Surprise', score.surprise)}
|
| 347 |
+
${scoreItem('Risk', score.risk, { risk: true })}
|
| 348 |
+
${scoreItem('Gating', (score.gating_passed || 0) + '/5', { raw: true })}
|
| 349 |
+
${scoreItem('Final', score.final, { bold: true })}
|
| 350 |
</div>
|
| 351 |
</div>
|
| 352 |
`;
|
|
|
|
| 375 |
scales: {
|
| 376 |
r: {
|
| 377 |
suggestedMin: 0, suggestedMax: 1,
|
| 378 |
+
ticks: { display: false, stepSize: 0.25 },
|
| 379 |
+
grid: { color: '#e6e9f0' },
|
| 380 |
+
angleLines: { color: '#e6e9f0' },
|
| 381 |
+
pointLabels: { font: { size: 10, weight: '600' }, color: '#475569' },
|
| 382 |
},
|
| 383 |
},
|
| 384 |
},
|
|
|
|
| 433 |
function scoreItem(label, val, opts = {}) {
|
| 434 |
const v = opts.raw ? val : (typeof val === 'number' ? val.toFixed(3) : val);
|
| 435 |
const style = [];
|
| 436 |
+
if (opts.risk && Number(val) > 0) style.push('color: var(--danger);');
|
| 437 |
+
if (opts.bold) style.push('color: var(--primary); font-size: 15px;');
|
| 438 |
return `
|
| 439 |
<div class="score-item">
|
| 440 |
<span class="score-item-label">${label}</span>
|
static/index.html
CHANGED
|
@@ -37,15 +37,27 @@
|
|
| 37 |
<aside class="sidebar">
|
| 38 |
<div class="card">
|
| 39 |
<div class="card-header">
|
| 40 |
-
<h2><span class="step">1</span>Product
|
| 41 |
</div>
|
| 42 |
<div class="field">
|
| 43 |
-
<label for="
|
| 44 |
-
<
|
| 45 |
-
|
| 46 |
-
<button type="button"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
</div>
|
| 48 |
-
<div id="productMeta" class="meta"></div>
|
| 49 |
</div>
|
| 50 |
</div>
|
| 51 |
|
|
@@ -187,70 +199,6 @@
|
|
| 187 |
</div>
|
| 188 |
</footer>
|
| 189 |
|
| 190 |
-
<!-- Custom product modal -->
|
| 191 |
-
<div id="productModal" class="modal" hidden>
|
| 192 |
-
<div class="modal-backdrop" data-close></div>
|
| 193 |
-
<div class="modal-panel">
|
| 194 |
-
<header class="modal-head">
|
| 195 |
-
<h3>𧬠μ μ ν μΆκ° <small>β LLMμ΄ μ μ¬λ ₯Β·SCAMPER λ³μ£ΌκΉμ§ νμ₯ν©λλ€</small></h3>
|
| 196 |
-
<button type="button" class="modal-x" data-close aria-label="λ«κΈ°">β</button>
|
| 197 |
-
</header>
|
| 198 |
-
|
| 199 |
-
<div class="modal-body">
|
| 200 |
-
<div class="form-row">
|
| 201 |
-
<div class="field">
|
| 202 |
-
<label for="npBrand">λΈλλ (κ°μ λΈλλλ§, μ€μ‘΄ λΈλλ κΈμ§)</label>
|
| 203 |
-
<input type="text" id="npBrand" placeholder="μ: NOVA-Bean, AETHER-Phone, HAN-Cha" maxlength="40" />
|
| 204 |
-
</div>
|
| 205 |
-
<div class="field">
|
| 206 |
-
<label for="npTier">κ°κ²©λ</label>
|
| 207 |
-
<select id="npTier">
|
| 208 |
-
<option value="budget">budget</option>
|
| 209 |
-
<option value="mid">mid</option>
|
| 210 |
-
<option value="premium" selected>premium</option>
|
| 211 |
-
<option value="luxury">luxury</option>
|
| 212 |
-
</select>
|
| 213 |
-
</div>
|
| 214 |
-
</div>
|
| 215 |
-
<div class="field">
|
| 216 |
-
<label for="npCategory">μΉ΄ν
κ³ λ¦¬ (νκ΅μ΄)</label>
|
| 217 |
-
<input type="text" id="npCategory" placeholder="μ: μλ 컀νΌ, νλΈλ¦Ώ, λ¬λν, λ§₯μ£Ό, νμ₯ν" maxlength="60" />
|
| 218 |
-
</div>
|
| 219 |
-
|
| 220 |
-
<div class="field">
|
| 221 |
-
<label>
|
| 222 |
-
λΆν/κ΅¬μ± μμ <span id="npPartCount">(2/8)</span>
|
| 223 |
-
<small>Β· 2~8κ° Β· μ΄λ¦ + ν μ€ μ€λͺ
</small>
|
| 224 |
-
</label>
|
| 225 |
-
<div id="npParts" class="parts-list"></div>
|
| 226 |
-
<button type="button" id="npAddPart" class="btn-ghost">οΌ λΆν μΆκ°</button>
|
| 227 |
-
</div>
|
| 228 |
-
|
| 229 |
-
<details class="preset-details">
|
| 230 |
-
<summary>π‘ λΉ λ₯Έ ν리μ
β ν λ²μ μ±μ°κΈ°</summary>
|
| 231 |
-
<div class="preset-grid">
|
| 232 |
-
<button type="button" class="preset-chip" data-preset="coffee">β μλ μ»€νΌ NOVA-Bean</button>
|
| 233 |
-
<button type="button" class="preset-chip" data-preset="phone">π± μ€λ§νΈν° AETHER-Phone</button>
|
| 234 |
-
<button type="button" class="preset-chip" data-preset="sneaker">π λ¬λν PULSE-Run</button>
|
| 235 |
-
<button type="button" class="preset-chip" data-preset="beer">πΊ μμ λ§₯μ£Ό HOP-Haru</button>
|
| 236 |
-
<button type="button" class="preset-chip" data-preset="cosmetic">π νμ₯ν GLOW-Han</button>
|
| 237 |
-
<button type="button" class="preset-chip" data-preset="car">π μ κΈ°μ°¨ SPIRA-EV</button>
|
| 238 |
-
</div>
|
| 239 |
-
</details>
|
| 240 |
-
|
| 241 |
-
<div id="npErr" class="err" hidden></div>
|
| 242 |
-
</div>
|
| 243 |
-
|
| 244 |
-
<footer class="modal-foot">
|
| 245 |
-
<button type="button" class="btn-ghost" data-close>μ·¨μ</button>
|
| 246 |
-
<button type="button" id="npSubmit" class="btn-primary">
|
| 247 |
-
<span class="btn-spinner" hidden></span>
|
| 248 |
-
<span class="btn-label">β LLMμΌλ‘ νμ₯</span>
|
| 249 |
-
</button>
|
| 250 |
-
</footer>
|
| 251 |
-
</div>
|
| 252 |
-
</div>
|
| 253 |
-
|
| 254 |
<script src="/static/app.js"></script>
|
| 255 |
</body>
|
| 256 |
</html>
|
|
|
|
| 37 |
<aside class="sidebar">
|
| 38 |
<div class="card">
|
| 39 |
<div class="card-header">
|
| 40 |
+
<h2><span class="step">1</span>Product / Service <small>Β· μμ ν둬ννΈ</small></h2>
|
| 41 |
</div>
|
| 42 |
<div class="field">
|
| 43 |
+
<label for="productPrompt">μ ν λλ μλΉμ€λ₯Ό μμ λ‘κ² μ
λ ₯νμΈμ</label>
|
| 44 |
+
<textarea id="productPrompt" rows="3" placeholder="μ: μμ λ§₯μ£Ό HOP-Haru Β· λ³, ν¬λΌμ΄ μΊ‘, ν€λ κ±°ν, λΌλ²¨, ν μ: μ κΈ°μ°¨ SPIRA-EV Β· λ°°ν°λ¦¬ν©, λμΌ λͺ¨ν°, 17μΈμΉ μ€ν¬λ¦°, μν¬ νΈλ€ μ: O2O μΈν μλΉμ€ MOON-Fold Β· μκ±°κΈ°μ¬, μ± μλ¦Ό, λΉλ 컀λ², ν₯κΈ° μΊ‘μ μ: μ¨λΌμΈ μ½λ© κ°μ CODE-Muze Β· μμ, κ³Όμ , μ½λ리뷰, μ¬λ λ°©, μλ£μ¦"></textarea>
|
| 45 |
+
<div class="product-presets">
|
| 46 |
+
<button type="button" class="preset-chip-inline" data-preset="watch">β μκ³</button>
|
| 47 |
+
<button type="button" class="preset-chip-inline" data-preset="coffee">β 컀νΌ</button>
|
| 48 |
+
<button type="button" class="preset-chip-inline" data-preset="phone">π± ν°</button>
|
| 49 |
+
<button type="button" class="preset-chip-inline" data-preset="sneaker">π λ¬λν</button>
|
| 50 |
+
<button type="button" class="preset-chip-inline" data-preset="beer">πΊ λ§₯μ£Ό</button>
|
| 51 |
+
<button type="button" class="preset-chip-inline" data-preset="cosmetic">π νμ₯ν</button>
|
| 52 |
+
<button type="button" class="preset-chip-inline" data-preset="car">π μ κΈ°μ°¨</button>
|
| 53 |
+
<button type="button" class="preset-chip-inline" data-preset="laundry">π§Ί μΈνμλΉμ€</button>
|
| 54 |
+
<button type="button" class="preset-chip-inline" data-preset="edu">π μ¨λΌμΈκ°μ</button>
|
| 55 |
+
<button type="button" class="preset-chip-inline" data-preset="banking">π¦ μνμ±</button>
|
| 56 |
+
</div>
|
| 57 |
+
<div id="productStatus" class="product-status">
|
| 58 |
+
<span class="status-dot status-idle"></span>
|
| 59 |
+
<span class="status-text">Generateλ₯Ό λλ₯΄λ©΄ Kimi-K2P6κ° genomeμ νμ₯ν©λλ€.</span>
|
| 60 |
</div>
|
|
|
|
| 61 |
</div>
|
| 62 |
</div>
|
| 63 |
|
|
|
|
| 199 |
</div>
|
| 200 |
</footer>
|
| 201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
<script src="/static/app.js"></script>
|
| 203 |
</body>
|
| 204 |
</html>
|
static/styles.css
CHANGED
|
@@ -538,25 +538,61 @@ input[type="range"] { padding: 0; width: 100%; accent-color: var(--primary); }
|
|
| 538 |
font-variant-numeric: tabular-nums;
|
| 539 |
}
|
| 540 |
|
| 541 |
-
/* ββ PRODUCT
|
| 542 |
-
|
| 543 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 544 |
}
|
| 545 |
-
.
|
| 546 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 547 |
border: 1px solid var(--border);
|
| 548 |
-
border-radius:
|
| 549 |
-
background: white;
|
| 550 |
-
|
| 551 |
-
|
|
|
|
| 552 |
transition: all 0.15s;
|
| 553 |
-
display: grid; place-items: center;
|
| 554 |
font-family: inherit;
|
| 555 |
}
|
| 556 |
-
.
|
| 557 |
border-color: var(--primary);
|
| 558 |
background: var(--primary-light);
|
|
|
|
|
|
|
| 559 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 560 |
|
| 561 |
/* ββ MODAL ββββββββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 562 |
.modal {
|
|
|
|
| 538 |
font-variant-numeric: tabular-nums;
|
| 539 |
}
|
| 540 |
|
| 541 |
+
/* ββ PRODUCT PROMPT βββββββββββββββββββββββββββββββββββββββββββ */
|
| 542 |
+
#productPrompt {
|
| 543 |
+
font-family: inherit;
|
| 544 |
+
min-height: 86px;
|
| 545 |
+
line-height: 1.55;
|
| 546 |
+
}
|
| 547 |
+
#productPrompt::placeholder {
|
| 548 |
+
color: var(--text-subtle);
|
| 549 |
+
font-size: 12.5px;
|
| 550 |
+
line-height: 1.6;
|
| 551 |
}
|
| 552 |
+
.product-presets {
|
| 553 |
+
display: flex; flex-wrap: wrap; gap: 6px;
|
| 554 |
+
margin-top: 10px;
|
| 555 |
+
}
|
| 556 |
+
.preset-chip-inline {
|
| 557 |
+
padding: 6px 10px;
|
| 558 |
border: 1px solid var(--border);
|
| 559 |
+
border-radius: 999px;
|
| 560 |
+
background: white;
|
| 561 |
+
color: var(--text);
|
| 562 |
+
font-size: 12px; font-weight: 600;
|
| 563 |
+
cursor: pointer;
|
| 564 |
transition: all 0.15s;
|
|
|
|
| 565 |
font-family: inherit;
|
| 566 |
}
|
| 567 |
+
.preset-chip-inline:hover {
|
| 568 |
border-color: var(--primary);
|
| 569 |
background: var(--primary-light);
|
| 570 |
+
color: var(--primary);
|
| 571 |
+
transform: translateY(-1px);
|
| 572 |
}
|
| 573 |
+
.product-status {
|
| 574 |
+
display: flex; align-items: center; gap: 8px;
|
| 575 |
+
margin-top: 12px;
|
| 576 |
+
padding: 9px 12px;
|
| 577 |
+
background: var(--surface);
|
| 578 |
+
border: 1px solid var(--border);
|
| 579 |
+
border-radius: var(--radius-sm);
|
| 580 |
+
font-size: 12px;
|
| 581 |
+
}
|
| 582 |
+
.status-dot {
|
| 583 |
+
width: 8px; height: 8px; border-radius: 50%;
|
| 584 |
+
flex-shrink: 0;
|
| 585 |
+
}
|
| 586 |
+
.status-dot.status-idle { background: var(--text-subtle); }
|
| 587 |
+
.status-dot.status-loading { background: var(--warn); animation: pulse-dot 1.2s ease-in-out infinite; }
|
| 588 |
+
.status-dot.status-ready { background: var(--success); }
|
| 589 |
+
.status-dot.status-error { background: var(--danger); }
|
| 590 |
+
@keyframes pulse-dot {
|
| 591 |
+
0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.45); }
|
| 592 |
+
50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
|
| 593 |
+
}
|
| 594 |
+
.status-text { color: var(--text); line-height: 1.45; }
|
| 595 |
+
.status-text strong { color: var(--primary); }
|
| 596 |
|
| 597 |
/* ββ MODAL ββββββββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 598 |
.modal {
|