From 5efb47538406c2d7e44c10ee616575a7e87f241b Mon Sep 17 00:00:00 2001 From: JaehongDev Date: Mon, 8 Jul 2024 21:24:43 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20suspense=20query=20=EB=A6=AC?= =?UTF-8?q?=EB=9E=9C=EB=8D=94=EB=A7=81=20=EB=A7=89=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/QuestionSetItem/QuestionSetItem.tsx | 1 - .../api/interview/useInterviewQuestionLoadQuery.ts | 14 ++++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/QuestionSetItem/QuestionSetItem.tsx b/frontend/src/components/QuestionSetItem/QuestionSetItem.tsx index 2d97770..e2664ba 100644 --- a/frontend/src/components/QuestionSetItem/QuestionSetItem.tsx +++ b/frontend/src/components/QuestionSetItem/QuestionSetItem.tsx @@ -10,7 +10,6 @@ interface QuestionSetItemProps { } const QuestionSetItem = ({questionSet:{questionSetId, title, description, tailQuestionDepth, count, thumbnailUrl}, openInterviewSetting}: QuestionSetItemProps) => { - const handleOpenSettings = useCallback(() => { openInterviewSetting({ questionSetId, diff --git a/frontend/src/hooks/api/interview/useInterviewQuestionLoadQuery.ts b/frontend/src/hooks/api/interview/useInterviewQuestionLoadQuery.ts index e5aa062..447eeb9 100644 --- a/frontend/src/hooks/api/interview/useInterviewQuestionLoadQuery.ts +++ b/frontend/src/hooks/api/interview/useInterviewQuestionLoadQuery.ts @@ -4,14 +4,20 @@ import {loadByCurrentInterviewQuestion} from "@/api/interview/LoadByCurrentInter export const useInterviewQuestionLoadQuery = (interviewId: number) => { // TODO: 변수명 바꾸기 - const {data: interview, refetch, error, isFetching} = useSuspenseQuery({ + const { data: interview, refetch, error, isFetching } = useSuspenseQuery({ queryKey: ['loadInterviewQuestion', interviewId], queryFn: () => loadByCurrentInterviewQuestion(interviewId), - gcTime: 60 * 60 * 10, - staleTime: 60* 60 * 10 + refetchOnWindowFocus:false, + gcTime: Infinity, + staleTime: Infinity }); - return {interview, refetch, error, isLoading: isFetching} + return { + interview, + refetch, + error, + isLoading: isFetching + }; } From 75b90a751fbba979b21b24716165aa1f09a9ed14 Mon Sep 17 00:00:00 2001 From: JaehongDev Date: Mon, 8 Jul 2024 23:51:32 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=EC=82=AC=EC=9A=A9=EC=9E=90=20?= =?UTF-8?q?=EC=BF=A0=ED=82=A4=20=EC=82=AD=EC=A0=9C=EC=8B=9C=20=EB=AF=B8?= =?UTF-8?q?=EC=9D=B8=EC=A6=9D=20=EC=82=AC=EC=9A=A9=EC=9E=90=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/Interceptors.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/api/Interceptors.ts b/frontend/src/api/Interceptors.ts index 308535d..779d182 100644 --- a/frontend/src/api/Interceptors.ts +++ b/frontend/src/api/Interceptors.ts @@ -46,7 +46,8 @@ export const handleTokenError = async(error: AxiosError) => { } if ( - status === 400 && (data.code >= 10000 && data.code <= 10006) + (status === 401 || status === 400) && + (data.code >= 10000 && data.code <= 10007) ) { localStorage.removeItem(TOKEN.ACCESS); window.location.href = PATH.AUTH; From 080417bba52bf4c2c1c52b9f6c5a47b512312204 Mon Sep 17 00:00:00 2001 From: JaehongDev Date: Tue, 9 Jul 2024 01:36:43 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=EC=B0=B8=EA=B3=A0=EB=A7=81?= =?UTF-8?q?=ED=81=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InterviewForm/useInterviewForm.tsx | 13 +++++++----- .../InterviewResultView.tsx | 20 ++++++++++++++++--- frontend/src/types/interview.ts | 9 +++++---- frontend/src/types/tailQuestion.ts | 5 +++++ 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/frontend/src/components/InterviewForm/useInterviewForm.tsx b/frontend/src/components/InterviewForm/useInterviewForm.tsx index 74c7bfd..5c292eb 100644 --- a/frontend/src/components/InterviewForm/useInterviewForm.tsx +++ b/frontend/src/components/InterviewForm/useInterviewForm.tsx @@ -129,10 +129,12 @@ export const useInterviewForm = (interviewId: number) => { return ; } if(interviewForm.submitType === 'TailQuestion'){ + handleAppendUserChat({answer:interviewForm.answer}) requestAiFeedback({answer: interviewForm.answer, question: interviewForm.currentTailQuestion,}, { - onSuccess: ({tailQuestion, feedback,score}) => { + onSuccess: ({tailQuestion, feedback,score, referenceLinks}) => { + if(interviewForm.tailQuestionId === undefined) { throw Error("알 수 없는 에러가 발생했습니다") } @@ -142,6 +144,7 @@ export const useInterviewForm = (interviewId: number) => { answerContent: interviewForm.answer, answerState: "COMPLETE", interviewQuestionId: interview.interviewQuestionId, + referenceLinks, tailQuestion: tailQuestion, tailQuestionId: interviewForm.tailQuestionId, timeToAnswer: 1, @@ -162,16 +165,14 @@ export const useInterviewForm = (interviewId: number) => { if(interviewForm.submitType === 'Question') { handleAppendUserChat({answer: interviewForm.answer}); - requestAiFeedback({ answer: interviewForm.answer, question: interview.question }, { - onSuccess: ({ tailQuestion, feedback,score }) => { - - + onSuccess: ({ tailQuestion, feedback,score , referenceLinks}) => { interviewSubmitMutation.mutate({ ...interview, + referenceLinks, answerState: "COMPLETE", answerContent: interviewForm.answer, timeToAnswer: 0, @@ -204,6 +205,7 @@ export const useInterviewForm = (interviewId: number) => { answerContent: "", timeToAnswer: 0, aiFeedback: "", + referenceLinks: [], currentIndex: interview.index, tailQuestion: "", score: 0 @@ -227,6 +229,7 @@ export const useInterviewForm = (interviewId: number) => { answerContent: interviewForm.answer, answerState: "PASS", interviewQuestionId: interview.interviewQuestionId, + referenceLinks: [], tailQuestion: "", tailQuestionId: interviewForm.tailQuestionId, timeToAnswer: 0, diff --git a/frontend/src/components/InterviewResultView/InterviewResultView.tsx b/frontend/src/components/InterviewResultView/InterviewResultView.tsx index 9e01277..242a626 100644 --- a/frontend/src/components/InterviewResultView/InterviewResultView.tsx +++ b/frontend/src/components/InterviewResultView/InterviewResultView.tsx @@ -1,5 +1,5 @@ import {useInterviewResultQuery} from "@/hooks/api/interview/useInterviewResultQuery"; -import {Chip, Spacer} from "@nextui-org/react"; +import {Chip, Link, Snippet, Spacer} from "@nextui-org/react"; import {Fragment} from "react"; @@ -8,12 +8,12 @@ interface InterviewItemBlockProps { answerState: "INIT" | "PASS" | "COMPLETE", question: string; answer: string; - referenceLinks?: string; + referenceLinks: string[]; feedback: string; score: number; } -const InterviewItemBlock = ({id, answer, question, answerState, feedback, score}: InterviewItemBlockProps) => { +const InterviewItemBlock = ({id, answer, question, answerState, feedback, score, referenceLinks}: InterviewItemBlockProps) => { return

{question} @@ -28,6 +28,19 @@ const InterviewItemBlock = ({id, answer, question, answerState, feedback, score} AI 피드백
{feedback}

} +

+ 참고링크 +
+ 해당 링크가 유효하지 않을 수 있습니다. +
+

+ {referenceLinks.map((link, key) => + 참고링크{key+1} + {link} + ) + } +
+

} @@ -45,6 +58,7 @@ const InterviewResultView = ({interviewId}: InterviewResultViewProps) => {

질문목록

    {interviewResult.interviewQuestions.map(({interviewQuestionId, question, tailQuestions}) => ( +
  • {question}
      diff --git a/frontend/src/types/interview.ts b/frontend/src/types/interview.ts index c0a0cac..5ec02e7 100644 --- a/frontend/src/types/interview.ts +++ b/frontend/src/types/interview.ts @@ -62,7 +62,6 @@ export interface InterviewSubmitRequest { */ tailQuestion: string; - /** * 답변에 걸린 시간 */ @@ -72,12 +71,12 @@ export interface InterviewSubmitRequest { * 내가 작성한 답변 */ answerContent: string; - - /** * 몇점인지 */ score: number; + + referenceLinks: string[]; } export interface InterviewSubmitResponse { @@ -143,7 +142,7 @@ export interface InterviewQuestionDetail { answerState: "INIT" | "PASS" | "COMPLETE", question: string; answer: string; - referenceLinks: string; + referenceLinks: string[]; feedback: string; remainTailQuestionCount: number; score: number; @@ -157,6 +156,7 @@ export interface TailQuestionDetail { answer: string; score: number; feedback: string; + referenceLinks: string[] } @@ -171,4 +171,5 @@ export interface FeedbackResponse { score: number; feedback: string; tailQuestion: string; + referenceLinks: string[]; } diff --git a/frontend/src/types/tailQuestion.ts b/frontend/src/types/tailQuestion.ts index 0e4dc86..cabd0d2 100644 --- a/frontend/src/types/tailQuestion.ts +++ b/frontend/src/types/tailQuestion.ts @@ -41,6 +41,11 @@ export interface TailQuestionSubmitRequest { * 내 답변에 대한 점수 */ score: number; + + /** + * 참고 링크 + */ + referenceLinks: string[]; } export interface TailQuestionSubmitResponse {