Skip to content

Commit 5ee84fa

Browse files
authored
Feat/be/76 "tour tool 프롬프트 및 전체 프롬프트 정제화 및 레디스 설정 가이드 수정" (#84)
* tour tool 프롬프트 및 전체 프롬프트 정제화 및 레디스 설정 가이드 수정 * tour tool 프롬프트 및 전체 프롬프트 정제화 및 레디스 설정 가이드 수정
1 parent d31a640 commit 5ee84fa

File tree

5 files changed

+193
-92
lines changed

5 files changed

+193
-92
lines changed

docs/REDIS_GUIDE.md

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,32 @@
44

55
### 1. Redis 서버 실행 (Docker 추천)
66
```bash
7-
# Redis 서버 시작
7+
# Redis 서버 시작 (비밀번호 설정 + 데이터 영속화) - 한 줄 복붙
8+
docker run -d --name redis --restart unless-stopped -p 6379:6379 -e TZ=Asia/Seoul -v redis_data:/data redis:alpine --requirepass 'your_password_here'
9+
10+
# 간단 버전 (비밀번호 없음)
811
docker run -d -p 6379:6379 --name redis redis:alpine
912

1013
# Redis 중지
1114
docker stop redis
1215

1316
# Redis 재시작
1417
docker start redis
18+
19+
# Redis 로그 확인
20+
docker logs redis
21+
22+
# Redis 완전 삭제 (데이터 포함)
23+
docker rm -f redis && docker volume rm redis_data
1524
```
1625

1726
### 2. 환경변수 설정
1827
```bash
1928
# .env 파일 생성 (.env.example 복사)
2029
REDIS_HOST=localhost
2130
REDIS_PORT=6379
22-
REDIS_PASSWORD=
31+
REDIS_PASSWORD=your_password_here # 비밀번호 설정한 경우
32+
# REDIS_PASSWORD= # 비밀번호 없으면 빈 값
2333
```
2434

2535
## 💾 캐시 사용법
@@ -129,18 +139,29 @@ GET http://localhost:8080/actuator/health
129139

130140
### Redis CLI 접속
131141
```bash
132-
# Docker 컨테이너 접속
142+
# Docker 컨테이너 접속 (비밀번호 없는 경우)
143+
docker exec -it redis redis-cli
144+
145+
# Docker 컨테이너 접속 (비밀번호 있는 경우)
146+
docker exec -it redis redis-cli -a 'your_password_here'
147+
148+
# 또는 접속 후 인증
133149
docker exec -it redis redis-cli
150+
> AUTH your_password_here
134151

135152
# 캐시 확인
136153
> KEYS *
137154
> GET "weather::서울"
138-
> TTL "weather::서울" # 남은 시간 확인
155+
> TTL "weather::서울" # 남은 시간 확인 (초 단위)
156+
> DEL "weather::서울" # 특정 캐시 삭제
157+
> FLUSHALL # 모든 캐시 삭제
139158
```
140159

141160
## 🚨 주의사항
142161

143162
1. **개발용**: Redis 없어도 실행됨 (`session.store-type: none`)
144-
2. **캐시 키**: 특수문자 주의 (`::` 구분자 사용)
145-
3. **TTL**: 적절한 캐시 시간 설정 (API 호출량 고려)
146-
4. **메모리**: Redis 메모리 사용량 모니터링 필요
163+
2. **비밀번호**: 운영 환경에서는 반드시 강력한 비밀번호 설정 권장
164+
3. **데이터 영속화**: `-v redis_data:/data` 옵션으로 컨테이너 재시작 시에도 데이터 보존
165+
4. **캐시 키**: 특수문자 주의 (`::` 구분자 사용)
166+
5. **TTL**: 적절한 캐시 시간 설정 (API 호출량 고려)
167+
6. **메모리**: Redis 메모리 사용량 모니터링 필요

docs/api-specification.yaml

Lines changed: 75 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -133,50 +133,44 @@ components:
133133
nullable: true
134134

135135
# AI Chat Domain Schemas
136-
AiChatSession:
136+
SessionsResponse:
137137
type: object
138138
properties:
139-
id:
139+
sessionId:
140140
type: integer
141141
format: int64
142142
description: 세션 고유 식별자
143-
userId:
144-
type: integer
145-
format: int64
146-
description: 사용자 ID
147143
sessionTitle:
148144
type: string
149145
description: 세션 제목
150-
createdAt:
151-
type: string
152-
format: date-time
153-
description: 생성 일시
154146

155-
AiChatMessage:
147+
SessionMessagesResponse:
156148
type: object
157149
properties:
158-
id:
159-
type: integer
160-
format: int64
161-
description: 메시지 고유 식별자
162-
sessionId:
163-
type: integer
164-
format: int64
165-
description: 세션 ID
166150
content:
167151
type: string
168152
description: 메시지 내용
169153
senderType:
170154
type: string
171155
enum: [USER, AI]
172156
description: 발신자 유형
173-
metadata:
174-
type: object
175-
description: AI 도구 사용 정보 (WeatherTool, TourTool)
176-
createdAt:
157+
158+
AiChatResponse:
159+
type: object
160+
properties:
161+
userMessage:
177162
type: string
178-
format: date-time
179-
description: 메시지 전송 시간
163+
description: 사용자 메시지 내용
164+
aiMessage:
165+
type: string
166+
description: AI 응답 메시지 내용
167+
168+
UpdateSessionTitleResponse:
169+
type: object
170+
properties:
171+
newTitle:
172+
type: string
173+
description: 수정된 세션 제목
180174

181175
# User Chat Domain Schemas
182176
ChatRoomResponse:
@@ -485,6 +479,14 @@ paths:
485479
- aichat
486480
summary: AI 채팅 세션 목록 조회
487481
description: 사용자의 AI 채팅 세션 목록을 최신순으로 조회
482+
parameters:
483+
- name: userId
484+
in: query
485+
required: true
486+
schema:
487+
type: integer
488+
format: int64
489+
description: 사용자 ID
488490
responses:
489491
'200':
490492
description: 세션 목록 조회 성공
@@ -498,24 +500,23 @@ paths:
498500
data:
499501
type: array
500502
items:
501-
$ref: '#/components/schemas/AiChatSession'
503+
$ref: '#/components/schemas/SessionsResponse'
502504

503505
post:
504506
tags:
505507
- aichat
506508
summary: 새 AI 채팅 세션 생성
507509
description: 새로운 AI 채팅 세션을 생성합니다
508-
requestBody:
509-
content:
510-
application/json:
511-
schema:
512-
type: object
513-
properties:
514-
sessionTitle:
515-
type: string
516-
description: 세션 제목 (선택사항)
510+
parameters:
511+
- name: userId
512+
in: query
513+
required: true
514+
schema:
515+
type: integer
516+
format: int64
517+
description: 사용자 ID
517518
responses:
518-
'201':
519+
'200':
519520
description: 세션 생성 성공
520521
content:
521522
application/json:
@@ -525,7 +526,7 @@ paths:
525526
- type: object
526527
properties:
527528
data:
528-
$ref: '#/components/schemas/AiChatSession'
529+
$ref: '#/components/schemas/SessionsResponse'
529530

530531
/api/aichat/sessions/{sessionId}:
531532
delete:
@@ -541,6 +542,13 @@ paths:
541542
type: integer
542543
format: int64
543544
description: AI 채팅 세션 ID
545+
- name: userId
546+
in: query
547+
required: true
548+
schema:
549+
type: integer
550+
format: int64
551+
description: 사용자 ID
544552
responses:
545553
'200':
546554
description: 세션 삭제 완료
@@ -565,6 +573,13 @@ paths:
565573
type: integer
566574
format: int64
567575
description: AI 채팅 세션 ID
576+
- name: userId
577+
in: query
578+
required: true
579+
schema:
580+
type: integer
581+
format: int64
582+
description: 사용자 ID
568583
responses:
569584
'200':
570585
description: 채팅 기록 조회 성공
@@ -576,14 +591,9 @@ paths:
576591
- type: object
577592
properties:
578593
data:
579-
type: object
580-
properties:
581-
session:
582-
$ref: '#/components/schemas/AiChatSession'
583-
messages:
584-
type: array
585-
items:
586-
$ref: '#/components/schemas/AiChatMessage'
594+
type: array
595+
items:
596+
$ref: '#/components/schemas/SessionMessagesResponse'
587597

588598
post:
589599
tags:
@@ -598,16 +608,23 @@ paths:
598608
type: integer
599609
format: int64
600610
description: AI 채팅 세션 ID
611+
- name: userId
612+
in: query
613+
required: true
614+
schema:
615+
type: integer
616+
format: int64
617+
description: 사용자 ID
601618
requestBody:
602619
required: true
603620
content:
604621
application/json:
605622
schema:
606623
type: object
607624
required:
608-
- content
625+
- message
609626
properties:
610-
content:
627+
message:
611628
type: string
612629
description: 사용자 메시지 내용
613630
responses:
@@ -621,12 +638,7 @@ paths:
621638
- type: object
622639
properties:
623640
data:
624-
type: object
625-
properties:
626-
userMessage:
627-
$ref: '#/components/schemas/AiChatMessage'
628-
aiMessage:
629-
$ref: '#/components/schemas/AiChatMessage'
641+
$ref: '#/components/schemas/AiChatResponse'
630642

631643
/api/aichat/sessions/{sessionId}/title:
632644
patch:
@@ -642,16 +654,23 @@ paths:
642654
type: integer
643655
format: int64
644656
description: AI 채팅 세션 ID
657+
- name: userId
658+
in: query
659+
required: true
660+
schema:
661+
type: integer
662+
format: int64
663+
description: 사용자 ID
645664
requestBody:
646665
required: true
647666
content:
648667
application/json:
649668
schema:
650669
type: object
651670
required:
652-
- title
671+
- newTitle
653672
properties:
654-
title:
673+
newTitle:
655674
type: string
656675
maxLength: 100
657676
description: 새로운 세션 제목
@@ -666,7 +685,7 @@ paths:
666685
- type: object
667686
properties:
668687
data:
669-
$ref: '#/components/schemas/AiChatSession'
688+
$ref: '#/components/schemas/UpdateSessionTitleResponse'
670689
'404':
671690
description: 세션을 찾을 수 없음
672691
'403':

src/main/kotlin/com/back/koreaTravelGuide/domain/ai/aiChat/tool/TourTool.kt

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,23 @@ class TourTool(
2323

2424
@Tool(description = "areaBasedList2 : 지역기반 관광정보 조회, 특정 지역의 관광 정보 조회")
2525
fun getAreaBasedTourInfo(
26-
@ToolParam(description = BuildConfig.CONTENT_TYPE_CODES_DESCRIPTION, required = true)
26+
@ToolParam(
27+
description =
28+
"관광 타입 코드를 사용하세요. 사용자가 타입 이름을 말하면 해당하는 코드를 찾아서 사용해야 합니다. " +
29+
"예: 사용자가 '관광지'라고 하면 '12'를 사용하세요. " +
30+
"사용 가능한 타입 코드: ${BuildConfig.CONTENT_TYPE_CODES_DESCRIPTION}",
31+
required = true,
32+
)
2733
contentTypeId: String,
28-
@ToolParam(description = BuildConfig.AREA_CODES_DESCRIPTION, required = true)
34+
@ToolParam(
35+
description =
36+
"지역 코드를 쉼표(,)로 구분해서 사용하세요. " +
37+
"예: 사용자가 '서울 강남구'라고 하면 AREA_CODES에서 '서울-강남구: 1-1'을 찾고, " +
38+
"하이픈(-)을 쉼표(,)로 바꿔서 '1,1'을 사용하세요. " +
39+
"광역시(인천, 대전 등)는 단일 코드만 사용: 예: '인천' → '2' (쉼표 없음). " +
40+
"사용 가능한 지역 코드: ${BuildConfig.AREA_CODES_DESCRIPTION}",
41+
required = true,
42+
)
2943
areaAndSigunguCode: String,
3044
): String {
3145
log.info("🔧 [TOOL CALLED] getAreaBasedTourInfo - contentTypeId: $contentTypeId, areaAndSigunguCode: $areaAndSigunguCode")
@@ -50,15 +64,28 @@ class TourTool(
5064

5165
@Tool(description = "locationBasedList2 : 위치기반 관광정보 조회, 특정 위치 기반의 관광 정보 조회")
5266
fun getLocationBasedTourInfo(
53-
@ToolParam(description = BuildConfig.CONTENT_TYPE_CODES_DESCRIPTION, required = true)
67+
@ToolParam(
68+
description =
69+
"관광 타입 코드를 사용하세요. 사용자가 타입 이름을 말하면 해당하는 코드를 찾아서 사용해야 합니다. " +
70+
"예: 사용자가 '음식점'이라고 하면 '39'를 사용하세요. " +
71+
"사용 가능한 타입 코드: ${BuildConfig.CONTENT_TYPE_CODES_DESCRIPTION}",
72+
required = true,
73+
)
5474
contentTypeId: String,
55-
@ToolParam(description = BuildConfig.AREA_CODES_DESCRIPTION, required = true)
75+
@ToolParam(
76+
description =
77+
"지역 코드를 쉼표(,)로 구분해서 사용하세요. " +
78+
"예: 사용자가 '서울 중구'라고 하면 AREA_CODES에서 '서울-중구: 1-24'를 찾고, " +
79+
"하이픈(-)을 쉼표(,)로 바꿔서 '1,24'를 사용하세요. " +
80+
"사용 가능한 지역 코드: ${BuildConfig.AREA_CODES_DESCRIPTION}",
81+
required = true,
82+
)
5683
areaAndSigunguCode: String,
57-
@ToolParam(description = "WGS84 경도", required = true)
84+
@ToolParam(description = "WGS84 경도 좌표", required = true)
5885
mapX: String = "126.98375",
59-
@ToolParam(description = "WGS84 위도", required = true)
86+
@ToolParam(description = "WGS84 위도 좌표", required = true)
6087
mapY: String = "37.563446",
61-
@ToolParam(description = "검색 반경(m)", required = true)
88+
@ToolParam(description = "검색 반경(미터 단위)", required = true)
6289
radius: String = "100",
6390
): String {
6491
log.info(
@@ -83,7 +110,12 @@ class TourTool(
83110

84111
@Tool(description = "detailCommon2 : 관광정보 상세조회, 특정 관광 정보의 상세 정보 조회")
85112
fun getTourDetailInfo(
86-
@ToolParam(description = "Tour API Item에 각각 할당된 contentId", required = true)
113+
@ToolParam(
114+
description =
115+
"조회할 관광정보의 콘텐츠 ID. " +
116+
"이전 Tool 호출 결과(getAreaBasedTourInfo 또는 getLocationBasedTourInfo)에서 받은 contentId를 사용하세요.",
117+
required = true,
118+
)
87119
contentId: String = "127974",
88120
): String {
89121
log.info("🔧 [TOOL CALLED] getTourDetailInfo - contentId: $contentId")

0 commit comments

Comments
 (0)