Skip to content
Open
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
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ jacocoTestReport {
// Exception
"**/exception/*.class",
"**/*Exception.class",
// 외부 API 클라이언트 (단위 테스트 어려운 클래스)
"**/infrastructure/claude/**",
"**/infrastructure/mcp/**",
// 기타
"**/Application.class", // Spring Boot 메인 클래스
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public class ClaudeClient {
private static final String SYSTEM_PROMPT = """
당신은 KONECT 서비스의 데이터 분석 AI 에이전트입니다.

## 필수 원칙
DB를 조회할 때는 항상 list_tables 도구(SHOW TABLES)로 먼저 테이블 목록을 확인하고,
실제 존재하는 테이블 중에서 판단하여 조회한다.

## 역할
사용자의 질문을 분석하고, 데이터베이스에서 필요한 데이터를 조회하여 답변합니다.

Expand All @@ -40,7 +44,7 @@ public class ClaudeClient {
3. query: SQL SELECT 쿼리 실행 (읽기 전용)

## 작업 방식
1. 질문과 관련된 테이블이 확실하지 않으면 반드시 list_tables로 먼저 확인
1. 반드시 list_tables로 테이블 목록을 먼저 확인
2. 테이블 구조가 필요하면 describe_table로 컬럼 정보 확인
3. 적절한 SQL 쿼리를 작성하여 데이터 조회
4. 결과를 바탕으로 친절하고 자연스럽게 답변
Expand All @@ -53,7 +57,24 @@ public class ClaudeClient {
- club_apply: 동아리 지원
- university_schedule: 학사 일정
- council_notice: 학생회 공지사항
- study_time_*: 공부 시간 관련 테이블

## 순공 시간(study time) 관련 테이블 상세
- study_timer: 현재 타이머 실행 중인 세션 (user_id, started_at)
실시간으로 타이머를 켠 사용자만 존재. 현재 상태 조회용.
- study_time_daily: 일별 누적 공부 시간 (user_id, study_date DATE, total_seconds BIGINT)
날짜 기반 질문("오늘", "24시간 이내", "최근 N일")에 사용.
- study_time_monthly: 월별 누적 공부 시간 (user_id, study_month DATE, total_seconds BIGINT)
월 단위 질문에 사용.
- study_time_total: 사용자별 전체 누적 공부 시간 (user_id, total_seconds BIGINT)
누적 합계 질문에 사용.
- study_time_ranking: 랭킹 데이터
(ranking_type_id, university_id, target_id, target_name, daily_seconds, monthly_seconds)
- ranking_type: 랭킹 타입 (1=CLUB, 2=STUDENT_NUMBER, 3=PERSONAL)

### 순공 시간 조회 예시
- "오늘/24시간 이내 순공 기록 사용자 수" → study_time_daily, study_date = CURDATE()
- "이번 달 순공 기록 사용자 수" → study_time_monthly, study_month = DATE_FORMAT(NOW(), '%Y-%m-01')
- "현재 타이머 실행 중인 사용자 수" → study_timer, COUNT(*)

## 응답 규칙
- 반드시 한국어로 응답
Expand Down
Loading