Skip to content

Conversation

@pythonstrup
Copy link
Member

@pythonstrup pythonstrup commented Aug 16, 2025

📌 관련 이슈

closes #71

📝 작업 개요

  • 채팅 프롬프트 수정

✅ 작업 사항

  • 프롬프트 단순화

💭 고민한 점들

  • 프롬프트가 길어지니 오히려 결과물의 품질이 안 좋아짐.
  • 페르소나를 작성하고 이모티아 세계관의 설정만 추가함. -> 오히려 대화가 더 자연스러움

Summary by CodeRabbit

  • New Features

    • 감정 요정 페르소나와 세계관(주요 지역·법칙·여왕 역할)을 도입해 더 몰입감 있는 대화 경험 제공
    • 배경 서사를 확장해 캐릭터 중심의 일관된 응답 톤 강화
  • Refactor

    • 과도한 안내/코칭 규칙을 정리하여 프롬프트 구조 간소화
    • 응답을 고정된 JSON 형식으로 제공하도록 정해 일관성·예측성 향상
  • Documentation

    • 출력 형식 태그에 별칭(Format 또는 Output) 사용 가능함을 문서에 반영

@pythonstrup pythonstrup added this to the 고도화 milestone Aug 16, 2025
@pythonstrup pythonstrup requested a review from hyh1016 August 16, 2025 19:05
@pythonstrup pythonstrup self-assigned this Aug 16, 2025
@pythonstrup pythonstrup added the enhancement New feature or request label Aug 16, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 16, 2025

Walkthrough

문서의 출력 태그 설명에 별칭이 추가되었고, 채팅 어시스턴트 프롬프트가 대규모로 재구성되었습니다. 기존 Role 중심 구조가 Persona/WorldBuilding/BackgroundStory로 전환되었고, 다수의 가이드 블록이 제거되었으며 Format은 고정된 JSON 스키마로 강화되었습니다. 코드 로직 변경은 없습니다.

Changes

Cohort / File(s) Summary
문서: 출력 태그 별칭 안내
prompts/READMD.md
출력 형식 태그 설명을 “ 또는 ”로 갱신(텍스트 수정).
프롬프트 구성 재설계
src/main/resources/prompts/chat-assistant.txt
<Role> 제거 및 <Persona> 도입, <WorldBuilding> 추가, <BackgroundStory>/<Context> 확장, 여러 가이드/제어 블록 일괄 제거, <Format>을 고정 JSON 계약으로 업데이트.

Sequence Diagram(s)

sequenceDiagram
  participant User as 사용자
  participant ChatApp as 채팅 엔진
  participant Prompt as 프롬프트(Persona/WorldBuilding/Format)
  participant LLM as 모델

  User->>ChatApp: 사용자 메시지 전송
  ChatApp->>Prompt: Persona/WorldBuilding/Context 로드
  ChatApp->>LLM: 구성된 프롬프트 + 사용자 메시지
  LLM-->>ChatApp: 고정된 JSON 형식 응답
  ChatApp-->>User: 응답(message 필드) 전달
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Assessment against linked issues

Objective Addressed Explanation
채팅 프롬프트 수정 (#71)
패턴 다양화: 공감 → 감정/원인 분석 → 선택지/관점 확장 (#71) 가이드/제어 블록이 제거되어 해당 패턴 강제는 불명확함.
맥락 기반 후속 질문: 유저 키워드 재활용 (#71) 프롬프트에 해당 전략을 명시적으로 유도하는 요소가 확인되지 않음.
UT 인사이트 반영 (#71) UT 인사이트의 구체 항목 반영 여부가 텍스트상으로 명확하지 않음.

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
출력 태그 별칭 문구 수정 (prompts/READMD.md) 이슈 #71은 채팅 프롬프트 고도화가 목적이며, README의 출력 태그 별칭 변경은 직접적 요구사항이 아님.

Possibly related PRs

Suggested reviewers

  • hyh1016

Poem

달빛 아래 작은 발자국,
페르소나와 세계를 꿰맨 토끼예요.
맥락 한 스푼, JSON 한 숟갈,
따뜻한 응답을 꾹꾹 담아 전해요.
오늘도 깡충깡충, 코드를 응원해요 🥕

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
prompts/READMD.md (1)

1-1: 파일명 오타: READMD.md → README.md로 변경 필요

표준 파일명(README.md)이 아닙니다. 레포 탐색성, 자동 링크(예: GitHub UI) 및 외부 툴 호환성에 영향이 있습니다. 파일명을 수정해주세요.

🧹 Nitpick comments (3)
src/main/resources/prompts/chat-assistant.txt (3)

5-5: 말투 규칙의 절대성 완화(상황/요청 기반 전환 허용)

“존댓말 절대 사용 안 함”은 사용자 요청/컨텍스트 변화에 대응 불가합니다. 기본은 반말을 유지하되, 명시 요청 시 존댓말 전환을 허용하도록 완화를 권장합니다.

적용 예시:

-말투: 항상 반말을 사용하며, 친구처럼 편안하게 대화함 (존댓말 절대 사용 안 함)
+말투: 기본은 반말로, 친구처럼 편안하게 대화함. 단, 사용자가 명시적으로 요청하거나 컨텍스트상 필요한 경우 존댓말로 전환.

31-33: 컨텍스트 가정(이미 자기소개 완료) 조건부 처리 권장

세션 재시작/신규 사용자 유입 시 해당 가정이 깨질 수 있습니다. “미완료 시 1문장 수준의 자연스러운 자기소개” 규칙을 추가해 견고성을 높이세요.

적용 예시:

 <Context>
-화자와는 이미 자기소개를 했기 때문에 서로 알고 있는 상황
+화자와는 이미 자기소개를 했기 때문에 서로 알고 있는 상황.
+단, 대화 맥락상 자기소개가 없었다면 1문장으로 짧게 자연스러운 자기소개 후 본론으로 이어가기.
 </Context>

58-66: 안전성 최소 가이드라인 보강(선택)

SafetyProtocol 제거로 민감 주제 대응이 전적으로 모델/상위 레이어에 의존합니다. 간단한 한 줄 수칙을 포맷 하단에 추가하면 리스크를 낮출 수 있습니다.

추가 제안:

 </Format>
+
+<Note>
+민감한 주제(자해·자살·학대·의료·법률 등)에는 감정적 지지와 함께 전문 도움(상담/긴급지원) 안내를 덧붙이고, 진단·법률 자문으로 오인될 수 있는 단정은 피한다.
+</Note>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 875d31e and 9ee2843.

📒 Files selected for processing (2)
  • prompts/READMD.md (1 hunks)
  • src/main/resources/prompts/chat-assistant.txt (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: pythonstrup
PR: Nexters/team-ace-backend#56
File: src/main/java/com/nexters/teamace/chat/application/ChatRoomService.java:54-59
Timestamp: 2025-08-06T14:49:03.348Z
Learning: pythonstrup prefers using HTTP 403 Forbidden over 404 Not Found for authorization failures in the chat room access control logic.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (2)
prompts/READMD.md (1)

13-13: 별칭 처리 로직 확인 필요
문서에 <Format>의 별칭으로 <Output>을 허용한다고 되어 있으나, 코드베이스상 파서나 태그 처리 로직에서 <Output>을 인식·처리하는 부분을 찾지 못했습니다.
아래 항목을 중점적으로 확인해주세요:

  • 태그 파싱/전처리 유틸리티 (예: TagParser, TemplateEngine 등)
  • 태그 enum 또는 상수 정의 파일
  • <Output><Format>과 매핑되는 alias 설정 여부
src/main/resources/prompts/chat-assistant.txt (1)

1-11: 페르소나/세계관 기반 재구성이 톤앤매너 일관성에 유익

Role 중심 구조에서 Persona로 전환하고 세계관을 추가한 점은 대화 스타일의 안정성과 몰입감 향상에 도움이 됩니다. 유지 추천합니다.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
src/main/resources/prompts/chat-assistant.txt (1)

59-67: JSON 코드블록 제거 및 ‘순수 JSON만’ 출력으로 변경, UT 구조 규칙 추가

현재 예시가 코드블록(백틱)으로 제공되어 모델이 그대로 백틱을 출력할 위험이 큽니다. 백엔드가 코드블록 제거/정규화 없이 곧장 파싱한다면 런타임 오류로 이어질 수 있습니다. 또한 UT 기대(공감→감정/원인 추정→선택지/관점 확장, 키워드 재사용)를 구조적으로 강제하는 규칙이 누락되어 있습니다.

권장 수정:

-<Format>
-응답은 다음 JSON 형식으로 제공해주세요:
-
-```json
-{
-  "message": "감정 요정으로서 자연스럽고 따뜻한 대화 응답"
-}
-```
-</Format>
+<Format>
+출력은 "순수 JSON만"이어야 해. (코드블록/백틱/주석/설명 금지)
+형식: {"message":"..."} 한 개의 JSON 객체만 출력.
+작성 규칙:
+- 1) 공감 1문장 →
+- 2) 감정/가능한 원인 추정 1문장 →
+- 3) 선택지형 질문 2~3개 또는 관점 확장형 질문 1개 포함 →
+- 4) 사용자 발화의 핵심 키워드 1~2개를 그대로 인용(“”로 감싸기) →
+- 5) 총 2~5문장, 한국어, 반말 유지
+- 6) 세계관·설정은 메타 맥락일 뿐, 메시지에 직접 노출하지 않음(사용자가 요청한 경우만 예외)
+- 7) 의료/법률/위기 상황에 대한 조언은 금지. 자/타해 위험 신호 감지 시 전문기관·긴급전화(예: 112/119 등) 안내 문장을 포함.
+</Format>

백엔드 파서가 코드블록/백틱 제거를 수행하는지 확인해 주세요. 아래 스크립트는 해당 로직 유무를 탐색합니다.

#!/bin/bash
set -euo pipefail

echo "1) 프롬프트 파일 로딩/사용 위치 탐색"
rg -n -C3 -P 'chat-assistant\.txt|ClassPathResource|ResourceLoader|Files\.readString' src || true

echo
echo "2) 모델 응답 파싱 로직에서 백틱/코드블록 제거 유무 탐색"
rg -n -C3 -P 'ObjectMapper|readTree|fromJson|parse|replace\(|strip\(|sanitize|```|backtick|code\s*fence' src || true
🧹 Nitpick comments (3)
src/main/resources/prompts/chat-assistant.txt (3)

5-5: 말투 고정(반말만) 규칙, 사용자 미러링 허용 여지 제안

존댓말 완전 금지보다 “사용자 말투 미러링(필요 시만)”을 허용하면 사용자 경험이 개선됩니다. 기본은 반말 유지하되, 상대가 일관되게 존댓말이면 약하게 상향 조정하도록 제안합니다.

다음처럼 완화해보세요:

-말투: 항상 반말을 사용하며, 친구처럼 편안하게 대화함 (존댓말 절대 사용 안 함)
+말투: 기본은 반말, 친구처럼 편안하게 대화. 단, 사용자가 일관되게 존댓말을 쓸 때는 예의를 지켜 말투를 가볍게 상향 조정(너무 딱딱하지 않게).

13-29: BackgroundStory 축약 제안 — 토큰 예산 절약 및 응답 집중도 향상

서사가 아름답지만 길이가 길어 모델의 작업 메모리를 잡아먹고 응답 품질에 영향을 줄 수 있습니다(PR 설명의 고려사항과도 부합). 핵심 메시지만 남기고 나머지는 별첨/주석 처리 혹은 주석 태그로 이동을 권장합니다.

예시(요지 압축):

-요정여왕은 ... (여러 단락)
+요정여왕은 감정이 살아있는 이모티아의 수호자다. 모든 감정은 동등한 가치를 지니며, 인간과 이모티아의 다리 역할을 한다. 길 잃은 마음에 친구처럼 다가가 이야기를 듣고 균형을 돕는다.

36-57: 세계관은 출력에 직접 드러내지 않기 — 롤플레이 누출 방지

세계관은 내적 맥락으로 훌륭하지만, 메시지에 직접 드러나면 상담적 흐름이 깨질 수 있습니다. “요정여왕/이모티아”가 응답 텍스트에 튀어나오지 않도록 제약을 명시하세요.

블록 하단에 메모를 추가:

 - 모든 존재와 동등한 위치에서 함께하는 친구
+- 출력 제약: 본 설정은 내적 맥락용이며, 사용자에게 보내는 message에는 세계관·직함·지명 등을 직접 서술하지 않음(사용자가 명시적으로 요청한 경우만 예외)
 </WorldBuilding>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9ee2843 and ed59a7f.

📒 Files selected for processing (1)
  • src/main/resources/prompts/chat-assistant.txt (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: pythonstrup
PR: Nexters/team-ace-backend#56
File: src/main/java/com/nexters/teamace/chat/application/ChatRoomService.java:54-59
Timestamp: 2025-08-06T14:49:03.348Z
Learning: pythonstrup prefers using HTTP 403 Forbidden over 404 Not Found for authorization failures in the chat room access control logic.
🔇 Additional comments (1)
src/main/resources/prompts/chat-assistant.txt (1)

1-4: 페르소나 전환 LGTM — 톤·캐릭터가 명확해졌습니다.

요정 여왕 페르소나 정의가 간결하고 일관되며, 대화 톤을 안정적으로 고정하는 데 도움이 됩니다. PR 목표(자연스러운 대화, 세계관 기반 일관성)와 잘 맞습니다.

Copy link
Collaborator

@hyh1016 hyh1016 left a comment

Choose a reason for hiding this comment

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

호 프롬프트 방향을 완전 바꿨구만 대화 포맷을 지정하기보다는 Role 설정에 좀 더 집중한 느낌이네
뭐가 더 잘 나오는지는 이것저것 테스트 해보고 고도화 하는 걸로~~

@pythonstrup pythonstrup merged commit 946b81d into Nexters:main Aug 18, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: 채팅 프롬프트 고도화

2 participants