Repository navigation
[Feat/#235] 챗봇 답변을 글자 단위로 자연스럽게 보여주기 - #236
Merged
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
github-actions
Bot
requested review from
jjunh33,
leegain1,
sangrae2325,
tnals0924 and
xeoxxn
November 17, 2026 16:13
sangrae2325
reviewed
Nov 24, 2026
| setIsAnswering(true); | ||
|
|
||
| // 받은 조각은 대기열에 쌓고, 대기열이 일정한 속도로 꺼내 줄 때 말풍선에 붙인다(utils/typingQueue) | ||
| const typingQueue = createTypingQueue((text, opensBubble) => { |
Collaborator
There was a problem hiding this comment.
이제 프레임마다 setMessages가 불려서 답변 중에는 대화 전체가 초당 60번 정도 다시 그려질 것 같습니다. ChatBotMessageBubble에 memo가 없어서 이전 말풍선도 매번 다시 그려지고 스크롤도 매 프레임 맨 아래로 내려가서, 저사양 안드로이드 웹뷰에서 대화가 길어지면 버벅일 수도 있을 것 같습니다. ChatBotMessageBubble을 memo로 감싸면 어떨까요?
Contributor
Author
There was a problem hiding this comment.
감사합니다! ChatBotMessageBubble을 memo로 감쌌습니다. 끝난 답변은 bubbles 배열이 그대로라 다시 그리지 않고, 답변 중에는 자라는 말풍선 하나만 다시 그려집니다. 527ee5b
…-reveal # Conflicts: # src/features/chat/components/ChatBotMessageBubble.tsx # src/features/chat/hooks/useChatStream.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#️⃣연관된 이슈
🎯 해결하려는 문제가 무엇인가요?
챗봇 답변이 흘러가듯 나오지 않고 몇 줄씩 뚝뚝 끊겨서 나온다.
❓ 왜 해결해야 하나요?
AI 서버를 로컬에서 재 보니 학교 AI 게이트웨이(gpt-oss-120b)가 답변을 14~63자씩 0.2초마다 몰아서 보낸다(첫 조각까지 2.5초, 7조각이 0.8초 안에 도착). 우리 서버와 프론트는 받은 대로 바로 붙이므로 화면에서는 문장이 덩어리째 튀어나온다. 발표 시연에서 가장 먼저 눈에 띄는 부분이다.
⭐ 어떻게 해결했나요?
features/chat/utils/typingQueue.ts: 받은 조각을 대기열에 쌓고, 화면이 새로 그려질 때마다(requestAnimationFrame, 초당 약 60번) 1~3글자씩 꺼내 준다(기본 초당 70자,BASE_CHARS_PER_SECOND).CATCH_UP_SECONDS). 남은 글자가 줄수록 다시 느려져 끝으로 갈수록 자연스럽게 감속한다. 받은 것보다 1초 넘게 늦게 보이지 않는다.**…**)와 링크([제목](/notices/1))는 닫는 표시가 올 때까지 기다렸다가 한 번에 꺼낸다. 한 글자씩 꺼내면**·[가 잠깐 글자 그대로 보였다가 바뀌며 번쩍인다.[취소]처럼 링크가 아닌 대괄호는 그냥 글자로 흐른다.useChatStream:onDelta가 말풍선에 바로 붙이던 코드를 대기열의 콜백으로 옮겼다. 말풍선을 붙이는 로직 자체는 그대로다.isAnswering을 내려 입력창을 연다.🧩 이 PR의 한계 & 트레이드오프
**가 있으면 스트림이 끝날 때까지 그 뒤 글자가 멈춰 있다가 한 번에 나온다. 모델이 굵게를 열고 안 닫는 경우는 아직 못 봤다.⛓️ 기존 기능에 미치는 영향
useChatStream)만 바뀐다. 말풍선 나누기·실패 시 질문 되살리기·화면 떠날 때 끊기는 그대로다.useChatStream.ts)을 고치지만 겹치는 줄이 다르다. 먼저 머지되는 쪽에 맞춰 나머지를 맞춘다.🔀 Edge Case & 실패 시나리오
event: error·끊김·40초 무응답): 대기열을 비우고 멈춘 뒤 기존처럼 말풍선을 걷고 질문을 입력창에 되살린다.bubble): 앞 말풍선 글자를 다 꺼낸 뒤에 새 말풍선을 연다.📋 검토한 대안과 선택 이유
💬 리뷰 포인트
[c]속도 상수(BASE_CHARS_PER_SECOND = 70·CATCH_UP_SECONDS = 0.6) 체감이 괜찮은지. 같은 답변을 원래 방식·빠르게(70/0.6)·느리게(45/1.5)로 나란히 돌려 팀에 물어봤고 빠르게(70/0.6)로 정했다.pnpm check(기존main.tsx경고 1건 외 통과),tsc -b통과.