From 178f6daa17c846f7805373befb93d6d75a81779e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=AF=BC=ED=97=8C?= Date: Mon, 31 Aug 2026 15:11:22 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B9=B4=EB=93=9C=20=EB=B2=88=ED=98=B8?= =?UTF-8?q?=EC=88=9C=20=EC=A0=95=EB=A0=AC=20+=20=EB=B4=87=20=EB=A9=94?= =?UTF-8?q?=EC=8B=9C=EC=A7=80=20=EB=AC=B8=EB=8B=A8=20=EB=B6=84=EB=A6=AC=20?= =?UTF-8?q?(=ED=91=9C=EC=8B=9C=20=EC=A0=84=EC=9A=A9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 카드 팝업: card_id 오름차순 정렬 (NC26-000~008) - 긴 봇 스크립트를 종결어미("~다."/"~요.") 경계에서 2문장씩 끊어 빈 줄 삽입 — 서버 원문·기존 줄바꿈은 유지, 90자 미만 줄은 건드리지 않음 Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01UFZ7JWdwCaQAwNYJErL8pP --- frontend/src/components/CardCatalog.tsx | 6 +++++- frontend/src/components/ChatPanel.tsx | 18 +++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/CardCatalog.tsx b/frontend/src/components/CardCatalog.tsx index 86eda4b..dd22223 100644 --- a/frontend/src/components/CardCatalog.tsx +++ b/frontend/src/components/CardCatalog.tsx @@ -15,7 +15,11 @@ export function CardCatalog({ activeCardId }: { activeCardId: string | null }) { if (data) return try { setFailed(false) - setData(await fetchCards()) + const res = await fetchCards() + setData({ + cards: [...res.cards].sort((a, b) => a.card_id.localeCompare(b.card_id)), + wild_cards: res.wild_cards, + }) } catch { setFailed(true) } diff --git a/frontend/src/components/ChatPanel.tsx b/frontend/src/components/ChatPanel.tsx index b3e1a99..2582752 100644 --- a/frontend/src/components/ChatPanel.tsx +++ b/frontend/src/components/ChatPanel.tsx @@ -18,6 +18,22 @@ const STEP_LABELS: Record = { } const stepLabel = (s: string) => STEP_LABELS[s] ?? s +// 봇 스크립트가 한 덩어리 문단일 때 가독성을 위해 2문장씩 끊는다 (표시 전용). +// 서버가 이미 넣어둔 줄바꿈은 유지하고, 긴 줄만 종결어미("~다."/"~요.") 경계에서 나눈다. +function paragraphize(text: string): string { + return text + .split('\n') + .map((line) => { + if (line.length < 90) return line + const sentences = line.split(/(?<=[다요]\.)\s+/) + if (sentences.length < 3) return line + const chunks: string[] = [] + for (let i = 0; i < sentences.length; i += 2) chunks.push(sentences.slice(i, i + 2).join(' ')) + return chunks.join('\n\n') + }) + .join('\n') +} + export function ChatPanel({ messages, nego, busy, started, error, demoCase, cases, finalPrice, onAnswer, onOffer, onRestart, onSelect, }: { @@ -143,7 +159,7 @@ export function ChatPanel({ : 'bg-base-200 text-base-content' }`} > - {m.text} + {m.role === 'bot' ? paragraphize(m.text) : m.text} ))}