-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInterviewController.java
More file actions
52 lines (45 loc) · 2.05 KB
/
InterviewController.java
File metadata and controls
52 lines (45 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.example.skillboost.interview.controller;
import com.example.skillboost.interview.dto.InterviewFeedbackRequest;
import com.example.skillboost.interview.dto.InterviewFeedbackResponse;
import com.example.skillboost.interview.dto.InterviewStartRequest;
import com.example.skillboost.interview.dto.InterviewStartResponse;
import com.example.skillboost.interview.service.InterviewFeedbackService;
import com.example.skillboost.interview.service.InterviewService;
import com.example.skillboost.interview.service.SpeechToTextService;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Profile;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.Map;
@Profile({"local", "prod"})
@RestController
@RequestMapping("/api/interview")
@RequiredArgsConstructor
public class InterviewController {
private final InterviewService interviewService;
private final InterviewFeedbackService feedbackService;
private final SpeechToTextService speechToTextService;
// 1) 면접 시작 + 질문 생성
@PostMapping("/start")
public ResponseEntity<InterviewStartResponse> start(@RequestBody InterviewStartRequest request) {
InterviewStartResponse response = interviewService.startInterview(request);
return ResponseEntity.ok(response);
}
// 2) (텍스트 기반) 전체 답변 평가
@PostMapping("/feedback")
public ResponseEntity<InterviewFeedbackResponse> feedback(
@RequestBody InterviewFeedbackRequest request
) {
InterviewFeedbackResponse response = feedbackService.createFeedback(request);
return ResponseEntity.ok(response);
}
// 3) 🔊 음성 → 텍스트(STT)만 담당
@PostMapping("/stt")
public ResponseEntity<Map<String, String>> stt(
@RequestPart("audio") MultipartFile audioFile
) {
String text = speechToTextService.transcribe(audioFile);
return ResponseEntity.ok(Map.of("text", text));
}
}