Skip to content

Commit 080417b

Browse files
committed
feat: 참고링크 추가
1 parent 75b90a7 commit 080417b

File tree

4 files changed

+35
-12
lines changed

4 files changed

+35
-12
lines changed

frontend/src/components/InterviewForm/useInterviewForm.tsx

+8-5
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,12 @@ export const useInterviewForm = (interviewId: number) => {
129129
return ;
130130
}
131131
if(interviewForm.submitType === 'TailQuestion'){
132+
132133
handleAppendUserChat({answer:interviewForm.answer})
133134

134135
requestAiFeedback({answer: interviewForm.answer, question: interviewForm.currentTailQuestion,}, {
135-
onSuccess: ({tailQuestion, feedback,score}) => {
136+
onSuccess: ({tailQuestion, feedback,score, referenceLinks}) => {
137+
136138
if(interviewForm.tailQuestionId === undefined) {
137139
throw Error("알 수 없는 에러가 발생했습니다")
138140
}
@@ -142,6 +144,7 @@ export const useInterviewForm = (interviewId: number) => {
142144
answerContent: interviewForm.answer,
143145
answerState: "COMPLETE",
144146
interviewQuestionId: interview.interviewQuestionId,
147+
referenceLinks,
145148
tailQuestion: tailQuestion,
146149
tailQuestionId: interviewForm.tailQuestionId,
147150
timeToAnswer: 1,
@@ -162,16 +165,14 @@ export const useInterviewForm = (interviewId: number) => {
162165

163166
if(interviewForm.submitType === 'Question') {
164167
handleAppendUserChat({answer: interviewForm.answer});
165-
166168
requestAiFeedback({
167169
answer: interviewForm.answer,
168170
question: interview.question
169171
}, {
170-
onSuccess: ({ tailQuestion, feedback,score }) => {
171-
172-
172+
onSuccess: ({ tailQuestion, feedback,score , referenceLinks}) => {
173173
interviewSubmitMutation.mutate({
174174
...interview,
175+
referenceLinks,
175176
answerState: "COMPLETE",
176177
answerContent: interviewForm.answer,
177178
timeToAnswer: 0,
@@ -204,6 +205,7 @@ export const useInterviewForm = (interviewId: number) => {
204205
answerContent: "",
205206
timeToAnswer: 0,
206207
aiFeedback: "",
208+
referenceLinks: [],
207209
currentIndex: interview.index,
208210
tailQuestion: "",
209211
score: 0
@@ -227,6 +229,7 @@ export const useInterviewForm = (interviewId: number) => {
227229
answerContent: interviewForm.answer,
228230
answerState: "PASS",
229231
interviewQuestionId: interview.interviewQuestionId,
232+
referenceLinks: [],
230233
tailQuestion: "",
231234
tailQuestionId: interviewForm.tailQuestionId,
232235
timeToAnswer: 0,

frontend/src/components/InterviewResultView/InterviewResultView.tsx

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {useInterviewResultQuery} from "@/hooks/api/interview/useInterviewResultQuery";
2-
import {Chip, Spacer} from "@nextui-org/react";
2+
import {Chip, Link, Snippet, Spacer} from "@nextui-org/react";
33
import {Fragment} from "react";
44

55

@@ -8,12 +8,12 @@ interface InterviewItemBlockProps {
88
answerState: "INIT" | "PASS" | "COMPLETE",
99
question: string;
1010
answer: string;
11-
referenceLinks?: string;
11+
referenceLinks: string[];
1212
feedback: string;
1313
score: number;
1414
}
1515

16-
const InterviewItemBlock = ({id, answer, question, answerState, feedback, score}: InterviewItemBlockProps) => {
16+
const InterviewItemBlock = ({id, answer, question, answerState, feedback, score, referenceLinks}: InterviewItemBlockProps) => {
1717
return <section id={question} key={id} className='mb-8'>
1818
<h2 className='text-3xl font-semibold mb-3 flex items-center gap-1'>
1919
<span>{question}</span>
@@ -28,6 +28,19 @@ const InterviewItemBlock = ({id, answer, question, answerState, feedback, score}
2828
<span className="text-2xl">AI 피드백</span>
2929
<br/>{feedback}</p>
3030
}
31+
<p className="mb-4">
32+
<span className='text-2xl'>참고링크</span>
33+
<br/>
34+
<span className='text-sm text-danger'>해당 링크가 유효하지 않을 수 있습니다.</span>
35+
<br/>
36+
<div className="flex flex-col">
37+
{referenceLinks.map((link, key) => <Fragment key={key}>
38+
<Link href={link} key={key}>참고링크{key+1}</Link>
39+
<Snippet>{link}</Snippet>
40+
</Fragment>)
41+
}
42+
</div>
43+
</p>
3144
</section>
3245
}
3346

@@ -45,6 +58,7 @@ const InterviewResultView = ({interviewId}: InterviewResultViewProps) => {
4558
<h2 className='text-2xl font-semibold mb-2'>질문목록</h2>
4659
<ul className='list-disc list-inside'>
4760
{interviewResult.interviewQuestions.map(({interviewQuestionId, question, tailQuestions}) => (
61+
4862
<li key={interviewQuestionId}>
4963
<a href={`#${question}`} className='text-blue-500 hover:underline'>{question}</a>
5064
<ul className='list-disc list-inside ml-4'>

frontend/src/types/interview.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export interface InterviewSubmitRequest {
6262
*/
6363
tailQuestion: string;
6464

65-
6665
/**
6766
* 답변에 걸린 시간
6867
*/
@@ -72,12 +71,12 @@ export interface InterviewSubmitRequest {
7271
* 내가 작성한 답변
7372
*/
7473
answerContent: string;
75-
76-
7774
/**
7875
* 몇점인지
7976
*/
8077
score: number;
78+
79+
referenceLinks: string[];
8180
}
8281

8382
export interface InterviewSubmitResponse {
@@ -143,7 +142,7 @@ export interface InterviewQuestionDetail {
143142
answerState: "INIT" | "PASS" | "COMPLETE",
144143
question: string;
145144
answer: string;
146-
referenceLinks: string;
145+
referenceLinks: string[];
147146
feedback: string;
148147
remainTailQuestionCount: number;
149148
score: number;
@@ -157,6 +156,7 @@ export interface TailQuestionDetail {
157156
answer: string;
158157
score: number;
159158
feedback: string;
159+
referenceLinks: string[]
160160
}
161161

162162

@@ -171,4 +171,5 @@ export interface FeedbackResponse {
171171
score: number;
172172
feedback: string;
173173
tailQuestion: string;
174+
referenceLinks: string[];
174175
}

frontend/src/types/tailQuestion.ts

+5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ export interface TailQuestionSubmitRequest {
4141
* 내 답변에 대한 점수
4242
*/
4343
score: number;
44+
45+
/**
46+
* 참고 링크
47+
*/
48+
referenceLinks: string[];
4449
}
4550

4651
export interface TailQuestionSubmitResponse {

0 commit comments

Comments
 (0)