Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ public class ClaudeClient {

## 응답 규칙
- 반드시 한국어로 응답
- 이모지를 적절히 사용하여 친근하게
- 간결하게 2-3문장으로 답변
- 답변은 질문한 것에 대해서만 할 것
- 모르는 테이블이 있으면 먼저 탐색 후 답변
- 예측/미래 추론 질문은 현재까지의 데이터만 제공하고 예측은 어렵다고 안내
- 데이터베이스에 정말 없는 정보만 정중히 거절
Comment on lines 58 to 63
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public class SlackAIService {
private static final Pattern MENTION_PATTERN = Pattern.compile("^<@[^>]+>\\s*");
private static final Pattern MARKDOWN_BOLD_PATTERN =
Pattern.compile("\\*\\*(.+?)\\*\\*", Pattern.DOTALL);
private static final Pattern MARKDOWN_ITALIC_PATTERN =
Pattern.compile("(?<!\\*)\\*(?!\\*)([^\\n*]+?)(?<!\\*)\\*(?!\\*)");
private static final String AI_RESPONSE_PREFIX = ":robot_face: *AI 응답*\n";
private static final int MAX_HISTORY_MESSAGES = 10;
private static final String EMPTY_QUERY_MESSAGE =
Expand Down Expand Up @@ -175,7 +177,8 @@ private String convertMarkdownToSlack(String text) {
if (text == null) {
return null;
}
return MARKDOWN_BOLD_PATTERN.matcher(text).replaceAll("*$1*");
String result = MARKDOWN_BOLD_PATTERN.matcher(text).replaceAll("*$1*");
return MARKDOWN_ITALIC_PATTERN.matcher(result).replaceAll("*$1*");
Comment on lines +180 to +181
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

[LEVEL: medium]
문제: Line 181의 단일 별표 변환은 *text*를 다시 *text*로 치환하는 no-op이라 실제 변환 동작이 없습니다.
영향: CAM-208 재현 케이스에서 입력/출력이 동일해 Slack 렌더링 문제가 그대로 남을 수 있습니다.
제안: 실제 실패 입력(예: 이스케이프된 \*text\* 등)을 기준으로 변환 규칙을 수정하고, convertMarkdownToSlack*text*/**text**/\*text\* 케이스 단위 테스트를 추가해 기대 결과를 고정해 주세요.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/gg/agit/konect/infrastructure/slack/ai/SlackAIService.java`
around lines 180 - 181, The single-asterisk replace at MARKDOWN_ITALIC_PATTERN
is a no-op for already-unescaped "*text*" and doesn't handle escaped forms like
"\*text\*"; update convertMarkdownToSlack to first unescape escaped asterisks
(replace "\\*([\\s\\S]+?)\\*" -> "*$1*"), then apply MARKDOWN_BOLD_PATTERN
replacement to produce "**$1**", then apply MARKDOWN_ITALIC_PATTERN to produce
"*$1*" (ensuring the regexes match unescaped forms only and order is bold ->
italic), and add unit tests for convertMarkdownToSlack covering "*text*",
"**text**", and "\*text\*" inputs to assert expected Slack-formatted outputs.

}

private String formatSlackResponse(String response) {
Expand Down
Loading