카드 번호순 정렬 + 봇 메시지 문단 분리 (표시 전용)
- 카드 팝업: card_id 오름차순 정렬 (NC26-000~008)
- 긴 봇 스크립트를 종결어미("~다."/"~요.") 경계에서 2문장씩 끊어 빈 줄 삽입 —
서버 원문·기존 줄바꿈은 유지, 90자 미만 줄은 건드리지 않음
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UFZ7JWdwCaQAwNYJErL8pP
This commit is contained in:
1 parent
7bcd7a0f39
commit
178f6daa17
2 files changed
+22
-2
No files matched your search
@@ -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)
|
||||
}
|
||||
|
||||
@@ -18,6 +18,22 @@ const STEP_LABELS: Record<string, string> = {
|
||||
}
|
||||
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}
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
|
||||
Reference in new issue
Block a user