| 
 | 1 | +import { SendChatMessageRequest, SendChatMessageResponse } from '@/chat/apis/sendChatMessage';  | 
 | 2 | +import { NextRequest, NextResponse } from 'next/server';  | 
 | 3 | + | 
 | 4 | +export async function POST(request: NextRequest) {  | 
 | 5 | +  const body: SendChatMessageRequest = await request.json();  | 
 | 6 | + | 
 | 7 | +  console.log(body);  | 
 | 8 | + | 
 | 9 | +  const normalReplyMockData: SendChatMessageResponse = {  | 
 | 10 | +    messageId: 1,  | 
 | 11 | +    type: 'SYSTEM_NORMAL_REPLY',  | 
 | 12 | +    sender: 'SYSTEM',  | 
 | 13 | +    answers: ['안녕 내담자', '따듯한 마룻바닥이 그리운 겨울 밤이야', '오늘은 어떤게 궁금해서 찾어왔어냥?'],  | 
 | 14 | +  };  | 
 | 15 | + | 
 | 16 | +  const invalidQuestionReplyMockData: SendChatMessageResponse = {  | 
 | 17 | +    messageId: 1,  | 
 | 18 | +    type: 'SYSTEM_INVALID_QUESTION_REPLY',  | 
 | 19 | +    sender: 'SYSTEM',  | 
 | 20 | +    answers: ['잘못된 질문이네냥!', '다시 질문해보라냥!'],  | 
 | 21 | +  };  | 
 | 22 | + | 
 | 23 | +  const questionReplyMockData: SendChatMessageResponse = {  | 
 | 24 | +    messageId: 1,  | 
 | 25 | +    type: 'SYSTEM_TAROT_QUESTION_REPLY',  | 
 | 26 | +    sender: 'SYSTEM',  | 
 | 27 | +    answers: ['전남친이 아직 미련이 남았는지 궁금하구낭!', '타로카드로 그 사람의 마음을 함계 들여다 볼까냥?'],  | 
 | 28 | +  };  | 
 | 29 | + | 
 | 30 | +  const questionAcceptanceReplyMockData: SendChatMessageResponse = {  | 
 | 31 | +    messageId: 1,  | 
 | 32 | +    type: 'SYSTEM_TAROT_QUESTION_ACCEPTANCE_REPLY',  | 
 | 33 | +    sender: 'SYSTEM',  | 
 | 34 | +    answers: ['너의 고민에 집중하면서', '카드를 한 장 뽑아봐!'],  | 
 | 35 | +  };  | 
 | 36 | + | 
 | 37 | +  if (body.intent === 'NORMAL') {  | 
 | 38 | +    return NextResponse.json({ data: normalReplyMockData });  | 
 | 39 | +  }  | 
 | 40 | + | 
 | 41 | +  if (body.intent === 'TAROT_ACCEPT') {  | 
 | 42 | +    if (Math.random() < 0.2) {  | 
 | 43 | +      return NextResponse.json({ data: invalidQuestionReplyMockData });  | 
 | 44 | +    }  | 
 | 45 | + | 
 | 46 | +    return NextResponse.json({ data: questionAcceptanceReplyMockData });  | 
 | 47 | +  }  | 
 | 48 | + | 
 | 49 | +  if (body.intent === 'TAROT_DECLINE') {  | 
 | 50 | +    return NextResponse.json({ data: normalReplyMockData });  | 
 | 51 | +  }  | 
 | 52 | + | 
 | 53 | +  if (body.intent === 'RECOMMEND_QUESTION') {  | 
 | 54 | +    return NextResponse.json({ data: questionReplyMockData });  | 
 | 55 | +  }  | 
 | 56 | + | 
 | 57 | +  return NextResponse.json({ error: 'Invalid intent' }, { status: 400 });  | 
 | 58 | +}  | 
0 commit comments