fix: add cancellation keyword handling in server consultation
- Add cancel logic for selecting/ordering states - Keywords: 취소, 다시, 처음 - Delete session and return to normal conversation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -391,6 +391,14 @@ export async function processServerConsultation(
|
|||||||
status: session.status
|
status: session.status
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 취소 키워드 처리 (selecting 또는 ordering 상태에서)
|
||||||
|
if ((session.status === 'selecting' || session.status === 'ordering') &&
|
||||||
|
/취소|다시|처음/.test(userMessage)) {
|
||||||
|
await deleteServerSession(env.SESSION_KV, session.telegramUserId);
|
||||||
|
logger.info('사용자 요청으로 상담 취소', { userId: session.telegramUserId });
|
||||||
|
return '상담이 취소되었습니다. 다시 시작하려면 "서버 추천"이라고 말씀해주세요.';
|
||||||
|
}
|
||||||
|
|
||||||
// 선택 단계 처리
|
// 선택 단계 처리
|
||||||
if (session.status === 'selecting' && session.lastRecommendation) {
|
if (session.status === 'selecting' && session.lastRecommendation) {
|
||||||
const selectionMatch = userMessage.match(/(\d+)(?:번|번째)?|첫\s*번째|두\s*번째|세\s*번째/);
|
const selectionMatch = userMessage.match(/(\d+)(?:번|번째)?|첫\s*번째|두\s*번째|세\s*번째/);
|
||||||
|
|||||||
Reference in New Issue
Block a user