Skip to content

Commit 049b4a4

Browse files
committed
tour tool 프롬프트 및 전체 프롬프트 정제화 및 레디스 설정 가이드 수정
1 parent 7117614 commit 049b4a4

File tree

5 files changed

+187
-92
lines changed

5 files changed

+187
-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
@@ -81,50 +81,44 @@ components:
8181
description: 사용자 유형
8282

8383
# AI Chat Domain Schemas
84-
AiChatSession:
84+
SessionsResponse:
8585
type: object
8686
properties:
87-
id:
87+
sessionId:
8888
type: integer
8989
format: int64
9090
description: 세션 고유 식별자
91-
userId:
92-
type: integer
93-
format: int64
94-
description: 사용자 ID
9591
sessionTitle:
9692
type: string
9793
description: 세션 제목
98-
createdAt:
99-
type: string
100-
format: date-time
101-
description: 생성 일시
10294

103-
AiChatMessage:
95+
SessionMessagesResponse:
10496
type: object
10597
properties:
106-
id:
107-
type: integer
108-
format: int64
109-
description: 메시지 고유 식별자
110-
sessionId:
111-
type: integer
112-
format: int64
113-
description: 세션 ID
11498
content:
11599
type: string
116100
description: 메시지 내용
117101
senderType:
118102
type: string
119103
enum: [USER, AI]
120104
description: 발신자 유형
121-
metadata:
122-
type: object
123-
description: AI 도구 사용 정보 (WeatherTool, TourTool)
124-
createdAt:
105+
106+
AiChatResponse:
107+
type: object
108+
properties:
109+
userMessage:
125110
type: string
126-
format: date-time
127-
description: 메시지 전송 시간
111+
description: 사용자 메시지 내용
112+
aiMessage:
113+
type: string
114+
description: AI 응답 메시지 내용
115+
116+
UpdateSessionTitleResponse:
117+
type: object
118+
properties:
119+
newTitle:
120+
type: string
121+
description: 수정된 세션 제목
128122

129123
# User Chat Domain Schemas
130124
ChatRoom:
@@ -378,6 +372,14 @@ paths:
378372
- aichat
379373
summary: AI 채팅 세션 목록 조회
380374
description: 사용자의 AI 채팅 세션 목록을 최신순으로 조회
375+
parameters:
376+
- name: userId
377+
in: query
378+
required: true
379+
schema:
380+
type: integer
381+
format: int64
382+
description: 사용자 ID
381383
responses:
382384
'200':
383385
description: 세션 목록 조회 성공
@@ -391,24 +393,23 @@ paths:
391393
data:
392394
type: array
393395
items:
394-
$ref: '#/components/schemas/AiChatSession'
396+
$ref: '#/components/schemas/SessionsResponse'
395397

396398
post:
397399
tags:
398400
- aichat
399401
summary: 새 AI 채팅 세션 생성
400402
description: 새로운 AI 채팅 세션을 생성합니다
401-
requestBody:
402-
content:
403-
application/json:
404-
schema:
405-
type: object
406-
properties:
407-
sessionTitle:
408-
type: string
409-
description: 세션 제목 (선택사항)
403+
parameters:
404+
- name: userId
405+
in: query
406+
required: true
407+
schema:
408+
type: integer
409+
format: int64
410+
description: 사용자 ID
410411
responses:
411-
'201':
412+
'200':
412413
description: 세션 생성 성공
413414
content:
414415
application/json:
@@ -418,7 +419,7 @@ paths:
418419
- type: object
419420
properties:
420421
data:
421-
$ref: '#/components/schemas/AiChatSession'
422+
$ref: '#/components/schemas/SessionsResponse'
422423

423424
/api/aichat/sessions/{sessionId}:
424425
delete:
@@ -434,6 +435,13 @@ paths:
434435
type: integer
435436
format: int64
436437
description: AI 채팅 세션 ID
438+
- name: userId
439+
in: query
440+
required: true
441+
schema:
442+
type: integer
443+
format: int64
444+
description: 사용자 ID
437445
responses:
438446
'200':
439447
description: 세션 삭제 완료
@@ -458,6 +466,13 @@ paths:
458466
type: integer
459467
format: int64
460468
description: AI 채팅 세션 ID
469+
- name: userId
470+
in: query
471+
required: true
472+
schema:
473+
type: integer
474+
format: int64
475+
description: 사용자 ID
461476
responses:
462477
'200':
463478
description: 채팅 기록 조회 성공
@@ -469,14 +484,9 @@ paths:
469484
- type: object
470485
properties:
471486
data:
472-
type: object
473-
properties:
474-
session:
475-
$ref: '#/components/schemas/AiChatSession'
476-
messages:
477-
type: array
478-
items:
479-
$ref: '#/components/schemas/AiChatMessage'
487+
type: array
488+
items:
489+
$ref: '#/components/schemas/SessionMessagesResponse'
480490

481491
post:
482492
tags:
@@ -491,16 +501,23 @@ paths:
491501
type: integer
492502
format: int64
493503
description: AI 채팅 세션 ID
504+
- name: userId
505+
in: query
506+
required: true
507+
schema:
508+
type: integer
509+
format: int64
510+
description: 사용자 ID
494511
requestBody:
495512
required: true
496513
content:
497514
application/json:
498515
schema:
499516
type: object
500517
required:
501-
- content
518+
- message
502519
properties:
503-
content:
520+
message:
504521
type: string
505522
description: 사용자 메시지 내용
506523
responses:
@@ -514,12 +531,7 @@ paths:
514531
- type: object
515532
properties:
516533
data:
517-
type: object
518-
properties:
519-
userMessage:
520-
$ref: '#/components/schemas/AiChatMessage'
521-
aiMessage:
522-
$ref: '#/components/schemas/AiChatMessage'
534+
$ref: '#/components/schemas/AiChatResponse'
523535

524536
/api/aichat/sessions/{sessionId}/title:
525537
patch:
@@ -535,16 +547,23 @@ paths:
535547
type: integer
536548
format: int64
537549
description: AI 채팅 세션 ID
550+
- name: userId
551+
in: query
552+
required: true
553+
schema:
554+
type: integer
555+
format: int64
556+
description: 사용자 ID
538557
requestBody:
539558
required: true
540559
content:
541560
application/json:
542561
schema:
543562
type: object
544563
required:
545-
- title
564+
- newTitle
546565
properties:
547-
title:
566+
newTitle:
548567
type: string
549568
maxLength: 100
550569
description: 새로운 세션 제목
@@ -559,7 +578,7 @@ paths:
559578
- type: object
560579
properties:
561580
data:
562-
$ref: '#/components/schemas/AiChatSession'
581+
$ref: '#/components/schemas/UpdateSessionTitleResponse'
563582
'404':
564583
description: 세션을 찾을 수 없음
565584
'403':

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

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,21 @@ 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+
"예: 사용자가 '관광지'라고 하면 '12'를 사용하세요. " +
29+
"사용 가능한 타입 코드: ${BuildConfig.CONTENT_TYPE_CODES_DESCRIPTION}",
30+
required = true,
31+
)
2732
contentTypeId: String,
28-
@ToolParam(description = BuildConfig.AREA_CODES_DESCRIPTION, required = true)
33+
@ToolParam(
34+
description = "지역 코드를 쉼표(,)로 구분해서 사용하세요. " +
35+
"예: 사용자가 '서울 강남구'라고 하면 AREA_CODES에서 '서울-강남구: 1-1'을 찾고, " +
36+
"하이픈(-)을 쉼표(,)로 바꿔서 '1,1'을 사용하세요. " +
37+
"광역시(인천, 대전 등)는 단일 코드만 사용: 예: '인천' → '2' (쉼표 없음). " +
38+
"사용 가능한 지역 코드: ${BuildConfig.AREA_CODES_DESCRIPTION}",
39+
required = true,
40+
)
2941
areaAndSigunguCode: String,
3042
): String {
3143
log.info("🔧 [TOOL CALLED] getAreaBasedTourInfo - contentTypeId: $contentTypeId, areaAndSigunguCode: $areaAndSigunguCode")
@@ -50,15 +62,26 @@ class TourTool(
5062

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

84107
@Tool(description = "detailCommon2 : 관광정보 상세조회, 특정 관광 정보의 상세 정보 조회")
85108
fun getTourDetailInfo(
86-
@ToolParam(description = "Tour API Item에 각각 할당된 contentId", required = true)
109+
@ToolParam(
110+
description = "조회할 관광정보의 콘텐츠 ID. " +
111+
"이전 Tool 호출 결과(getAreaBasedTourInfo 또는 getLocationBasedTourInfo)에서 받은 contentId를 사용하세요.",
112+
required = true,
113+
)
87114
contentId: String = "127974",
88115
): String {
89116
log.info("🔧 [TOOL CALLED] getTourDetailInfo - contentId: $contentId")

0 commit comments

Comments
 (0)