Skip to content

Commit

Permalink
refactor: 답변에 대한 피드백을 받을 떄 이전 질문도 보내도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeHongDev committed Jul 4, 2024
1 parent 1d9c159 commit 77c6756
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
18 changes: 13 additions & 5 deletions frontend/src/components/InterviewForm/useInterviewForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,16 @@ export const useInterviewForm = (interviewId: number) => {
}

const requestAiFeedback = async ({answer, question} : {answer: string, question: string}) => {
return await answerFeedbackMutation.mutateAsync({
answer, question
return await answerFeedbackMutation.mutateAsync({
answer,
question,
tailQuestions: [
interview.question === question ? "" : interview.question,
...interviewForm.chatList
.filter(chat => chat.type === "TailQuestion")
.map(chat => chat.content)
.filter((_, index, arr) => arr.length - 1 !== index)]
.filter(str => str.length !== 0)
})
}

Expand Down Expand Up @@ -134,9 +142,9 @@ export const useInterviewForm = (interviewId: number) => {
appendChat({type: 'Answer', content: interviewForm.answer});

const {tailQuestion, feedback, score} = await requestAiFeedback({
answer: interviewForm.answer,
question: interviewForm.currentTailQuestion
});
answer: interviewForm.answer,
question: interviewForm.currentTailQuestion
});

appendChat({type: 'TailQuestion', content: tailQuestion});
registerTailQuestion(tailQuestion);
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types/interview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export interface TailQuestionDetail {
export interface FeedbackRequest{
question: string;
answer: string;
tailQuestions: string[];
}

export interface FeedbackResponse {
Expand Down

0 comments on commit 77c6756

Please sign in to comment.