Skip to content

feat: add global chatbot UI - #512

Open
yhi9839 wants to merge 1 commit into
mainfrom
feat-511-chatbot-ui
Open

feat: add global chatbot UI#512
yhi9839 wants to merge 1 commit into
mainfrom
feat-511-chatbot-ui

Conversation

@yhi9839

@yhi9839 yhi9839 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

📌 개요 (Summary)

  • 변경 사항에 대한 간략한 요약을 적어주세요.
  • 관련 이슈가 있다면 링크를 걸어주세요 (예: [fix] cicd / build 문제 #123).

🛠️ 변경 사항 (Changes)

  • 새로운 기능 추가
  • 버그 수정
  • 코드 리팩토링
  • 문서 업데이트
  • 기타 (설명: )

📸 스크린샷 (Screenshots)

(UI 변경 사항이 있다면 첨부해주세요)

✅ 체크리스트 (Checklist)

  • 빌드가 성공적으로 수행되었나요? (pnpm build)
  • 린트 에러가 없나요? (pnpm lint)
  • 불필요한 콘솔 로그나 주석을 제거했나요?

Summary by CodeRabbit

  • New Features
    • Added a global chatbot with responsive chat panel and floating launch button.
    • Supports session-based conversations, loading states, retries, expired sessions, support links, and escalation guidance.
    • Added keyboard controls, auto-scrolling, adjustable message input, and accessible interactions.
  • Bug Fixes
    • Prevents the chatbot button from overlapping the app-open prompt.
    • Hides the chatbot on unsupported routes and locks background scrolling on mobile while open.
  • Validation
    • Verified responsive behavior, builds, linting, and type checks.

@yhi9839 yhi9839 linked an issue Aug 8, 2026 that may be closed by this pull request
4 tasks
@vercel

vercel Bot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
checkmo Ready Ready Preview Aug 8, 2026 11:28am

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Added a responsive client-side chatbot with session-aware API messaging, retry and expired-session handling, accessibility controls, collision-aware positioning, and global overlay integration.

Changes

Chatbot overlay

Layer / File(s) Summary
Chatbot API contract and transport
src/types/chatbot.ts, src/lib/api/endpoints/..., src/services/chatbotService.ts, src/hooks/mutations/useChatbotMutation.ts
Defines chatbot request and reply types. Adds the messages endpoint, service request handling, and React Query mutation integration.
Chatbot state and message flow
src/components/common/Chatbot/ChatbotWidget.tsx
Adds session state, message submission, loading states, failure classification, retry handling, and conversation reset behavior.
Responsive chatbot interface
src/components/base-ui/Float.tsx, src/components/common/Chatbot/ChatbotWidget.tsx
Adds the floating trigger, collision-aware positioning, responsive panel, transcript, keyboard controls, and message form.
Global overlay wiring
src/components/common/AppOpenCta.tsx, src/components/common/GlobalAppOpenCta.tsx, src/components/common/GlobalMainOverlays.tsx, src/app/(main)/layout.tsx, docs/agent/agent-log.md
Tracks app CTA visibility and passes it to the chatbot. Renders both overlays from the main layout and records the implementation log.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ChatbotWidget
  participant useChatbotMessageMutation
  participant chatbotService
  participant ChatbotMessagesAPI
  User->>ChatbotWidget: Submit message
  ChatbotWidget->>useChatbotMessageMutation: Send request
  useChatbotMessageMutation->>chatbotService: Call sendMessage
  chatbotService->>ChatbotMessagesAPI: POST chatbot message
  ChatbotMessagesAPI-->>chatbotService: Return chatbot reply
  chatbotService-->>ChatbotWidget: Update conversation
Loading

Suggested labels: ✨ feat

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a global chatbot UI.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-511-chatbot-ui

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/common/Chatbot/ChatbotWidget.tsx`:
- Around line 282-290: The mobile panel in ChatbotWidget’s checkmo-chatbot-panel
dialog needs a real keyboard focus trap whenever isTabletUp is false, so Tab and
Shift+Tab remain within the modal rather than reaching page controls behind it.
Use the project’s dialog primitive if available, otherwise add the established
tested focus-trap mechanism, while preserving focus restoration when
isPanelVisible changes to false.

In `@src/types/chatbot.ts`:
- Around line 1-4: Extend ChatbotMessageRequest with a clientMessageId field,
then update ChatbotWidget to generate one identifier per user submission and
reuse it across retries for Request timeout, CHATBOT_502, and CHATBOT_503.
Ensure the /v1/chatbot/messages handler uses sessionToken plus clientMessageId
to deduplicate repeated requests or return the previously cached result.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 769d1fea-31ca-4da2-8abf-5f305486a63b

📥 Commits

Reviewing files that changed from the base of the PR and between bdad799 and 06e2fc6.

📒 Files selected for processing (12)
  • docs/agent/agent-log.md
  • src/app/(main)/layout.tsx
  • src/components/base-ui/Float.tsx
  • src/components/common/AppOpenCta.tsx
  • src/components/common/Chatbot/ChatbotWidget.tsx
  • src/components/common/GlobalAppOpenCta.tsx
  • src/components/common/GlobalMainOverlays.tsx
  • src/hooks/mutations/useChatbotMutation.ts
  • src/lib/api/endpoints/chatbot.ts
  • src/lib/api/endpoints/index.ts
  • src/services/chatbotService.ts
  • src/types/chatbot.ts

Comment on lines +282 to +290
{isPanelVisible && (
<div className="fixed inset-0 z-[80] bg-Black/10 t:pointer-events-none t:bg-transparent">
<section
id="checkmo-chatbot-panel"
role="dialog"
aria-label="책모 도우미"
aria-modal={!isTabletUp}
className="pointer-events-auto fixed inset-0 flex h-[100dvh] flex-col overflow-hidden bg-background shadow-[0_3px_12px_rgba(61,52,46,0.2)] t:inset-auto t:right-[43px] t:bottom-[54px] t:h-[640px] t:max-h-[calc(100dvh-108px)] t:w-[426px] t:rounded-[8px] t:border t:border-Subbrown-4"
>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Trap keyboard focus while the mobile dialog is modal.

Line 288 sets aria-modal on mobile, but the dialog does not contain Tab or Shift+Tab focus. Keyboard users can move from the chatbot input to Header and page controls behind the overlay.

Use the project dialog primitive or add a tested focus trap for the mobile panel. Keep focus restoration when the dialog closes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/common/Chatbot/ChatbotWidget.tsx` around lines 282 - 290, The
mobile panel in ChatbotWidget’s checkmo-chatbot-panel dialog needs a real
keyboard focus trap whenever isTabletUp is false, so Tab and Shift+Tab remain
within the modal rather than reaching page controls behind it. Use the project’s
dialog primitive if available, otherwise add the established tested focus-trap
mechanism, while preserving focus restoration when isPanelVisible changes to
false.

Comment thread src/types/chatbot.ts
Comment on lines +1 to +4
export interface ChatbotMessageRequest {
sessionToken?: string | null;
message: string;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

# Trace the client payload, retry path, and any available API schema or route contract.
rg -n -C 6 \
  'ChatbotMessageRequest|/v1/chatbot/messages|clientMessageId|idempotency|Request timeout|CHATBOT_502|CHATBOT_503' \
  src

# Locate repository-local API specifications, mocks, or backend contract documents.
fd -t f . | rg -i '(chatbot|openapi|swagger|api.*(schema|contract)|schema.*api|route)'

Repository: checkmo2025/FE

Length of output: 5288


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "## chatbot types"
cat -n src/types/chatbot.ts

echo "## chatbot service"
cat -n src/services/chatbotService.ts

echo "## chatbot mutation"
cat -n src/hooks/mutations/useChatbotMutation.ts

echo "## chatbot widget relevant section"
sed -n '1,180p' src/components/common/Chatbot/ChatbotWidget.tsx | cat -n

echo "## api client timeout/error helpers"
sed -n '60,125p' src/lib/api/client.ts | cat -n

Repository: checkmo2025/FE

Length of output: 11131


Add a client-side message id before retrying chatbot messages.

ChatbotMessageRequest only sends sessionToken and message. On Request timeout, CHATBOT_502, and CHATBOT_503, ChatbotWidget allows retrying the same submit. Add a clientMessageId to ChatbotMessageRequest, generate it once per user submit, and reuse it for retries. Ensure /v1/chatbot/messages deduplicates or returns the cached result when the same sessionToken and clientMessageId are retried.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/types/chatbot.ts` around lines 1 - 4, Extend ChatbotMessageRequest with a
clientMessageId field, then update ChatbotWidget to generate one identifier per
user submission and reuse it across retries for Request timeout, CHATBOT_502,
and CHATBOT_503. Ensure the /v1/chatbot/messages handler uses sessionToken plus
clientMessageId to deduplicate repeated requests or return the previously cached
result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: 챗봇 UI 구현

1 participant