Skip to content

feat(chat): add VIDEO_TRANSCRIPT context type for video-grounded chat rooms#45

Open
rivkode wants to merge 1 commit into
devfrom
feat/chat-video-transcript-context
Open

feat(chat): add VIDEO_TRANSCRIPT context type for video-grounded chat rooms#45
rivkode wants to merge 1 commit into
devfrom
feat/chat-video-transcript-context

Conversation

@rivkode
Copy link
Copy Markdown
Owner

@rivkode rivkode commented Apr 26, 2026

Summary

  • ChatContextType enum(GENERAL, VIDEO_TRANSCRIPT) + JPA AttributeConverter(autoApply) 추가
  • ChatRoom 엔티티에 contextType(NOT NULL, default GENERAL)과 nullable videoId 컬럼 추가
  • ChatRoomCommand.Register / ChatRoomDto.RegisterRequestcontextType, youtubeVideoId, optional name을 받음
  • ChatRoomInfocontextType / youtubeVideoId 노출
  • ChatServiceImpl
    • validateChatRoomCommand로 mismatch(예: VIDEO_TRANSCRIPT인데 youtubeVideoId 없음, GENERAL인데 youtubeVideoId 들어감) 거부
    • 등록 시점에 transcript 사전 조회로 invalid videoId 조기 차단
    • generateChat / greeting 흐름에서 VIDEO_TRANSCRIPT이면 transcript 컨텍스트를 빌드해 AI에 전달
  • 참고용 DDL system/db/migration/202603300001_add_chat_room_context.sql 추가
  • 테스트
    • ChatServiceTest: VIDEO_TRANSCRIPT 채팅방 generateChat 시나리오 추가
    • ChatRoomContextServiceTest: 등록 시 validation 규칙 케이스
    • ChatFixture: contextType/videoId 옵션 추가

Dependencies

이 PR는 다음 두 PR 머지 후에 머지하는 것을 권장합니다.

Migration

  • 실제 Flyway 적용은 src/main/resources/db/migration/V7__add_chat_room_context.sql 등으로 별도 PR에서 추가 권장 (이번 PR에는 참고 DDL만 포함)

Test plan

  • ./gradlew test 통과
  • POST /api/v1/chatrooms contextType=VIDEO_TRANSCRIPT + youtubeVideoId 전달 시 transcript 사전 검증 성공
  • youtubeVideoId 누락 시 400 BAD_REQUEST
  • GENERAL인데 youtubeVideoId가 들어오면 400 BAD_REQUEST
  • generateChat 시 transcript 컨텍스트가 prompt에 반영되는지 (AI 응답 톤) 확인

🤖 Generated with Claude Code

… rooms

- Add ChatContextType enum (GENERAL, VIDEO_TRANSCRIPT) and JPA
  AttributeConverter (autoApply=true)
- ChatRoom gains contextType (NOT NULL, default GENERAL) and nullable
  videoId; secondary constructor exposes the new fields with sane defaults
- ChatRoomCommand.Register / ChatRoomDto.RegisterRequest accept
  contextType, youtubeVideoId, and an optional explicit name; default
  room name is derived from contextType
- ChatRoomInfo exposes contextType and youtubeVideoId
- ChatServiceImpl wires the transcript flow:
  - validateChatRoomCommand rejects mismatched contextType/videoId combos
    and pre-fetches the transcript on registration
  - greeting/generate paths branch on VIDEO_TRANSCRIPT and call the
    transcript-aware AiChatService methods with a built prompt context
- Add reference DDL `system/db/migration/202603300001_add_chat_room_context.sql`
- Tests: extend ChatServiceTest with a VIDEO_TRANSCRIPT generateChat
  scenario, add ChatRoomContextServiceTest covering validation rules,
  extend ChatFixture with contextType/videoId knobs

Depends on:
- PR \"feat(cliplearning): slim payload + transcript endpoint\"
  (introduces ClipLearningTranscriptReader and ClipLearningTranscriptInfo)
- PR \"feat(ai): add transcript-aware chat prompts\" (introduces
  AiChatService.generateTranscriptChat / greetingTranscriptChat)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant