fix(mobile): proxy review audio downloads
This commit is contained in:
+18
-6
@@ -1,6 +1,7 @@
|
||||
package org.dromara.aihr.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.aihr.domain.AihrPracticeDto.AnnotationResponse;
|
||||
import org.dromara.aihr.domain.AihrPracticeDto.CompetencyResponse;
|
||||
@@ -19,6 +20,7 @@ import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.domain.model.LoginUser;
|
||||
import org.dromara.common.core.enums.UserType;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -27,6 +29,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -40,6 +43,7 @@ import java.util.Map;
|
||||
public class AihrMobileController {
|
||||
|
||||
private final AihrMobileSeedService mobileSeedService;
|
||||
private final ISysOssService ossService;
|
||||
|
||||
@SaIgnore
|
||||
@GetMapping("/home/{role}")
|
||||
@@ -65,6 +69,11 @@ public class AihrMobileController {
|
||||
return detail == null ? R.fail("复盘记录不存在") : R.ok(reviewDetailPayload(detail));
|
||||
}
|
||||
|
||||
@GetMapping("/oss/{ossId}")
|
||||
public void oss(@PathVariable Long ossId, HttpServletResponse response) throws IOException {
|
||||
ossService.download(ossId, response);
|
||||
}
|
||||
|
||||
@PostMapping("/practice/reviews/{id}/reviewed")
|
||||
public R<Void> markReviewed(@PathVariable Long id, @RequestBody(required = false) ReviewAdviceRequest request) {
|
||||
return mobileSeedService.markReviewed(id, request, currentAppUsername()) ? R.ok() : R.fail("复盘记录不存在");
|
||||
@@ -142,12 +151,15 @@ public class AihrMobileController {
|
||||
"value", item.value(),
|
||||
"note", item.note()
|
||||
)).toList());
|
||||
data.put("dialogue", detail.dialogue().stream().map(turn -> Map.of(
|
||||
"role", turn.role(),
|
||||
"label", turn.label(),
|
||||
"text", turn.text(),
|
||||
"audioUrl", turn.audioUrl()
|
||||
)).toList());
|
||||
data.put("dialogue", detail.dialogue().stream().map(turn -> {
|
||||
Map<String, Object> item = new LinkedHashMap<>();
|
||||
item.put("role", turn.role());
|
||||
item.put("label", turn.label());
|
||||
item.put("text", turn.text());
|
||||
item.put("audioUrl", turn.audioUrl());
|
||||
item.put("audioOssId", turn.audioOssId());
|
||||
return item;
|
||||
}).toList());
|
||||
data.put("annotations", detail.annotations().stream().map(AihrMobileController::annotationPayload).toList());
|
||||
return data;
|
||||
}
|
||||
|
||||
+3
-3
@@ -116,13 +116,13 @@ public final class AihrPracticeDto {
|
||||
public record RecordResponse(Long id, String sessionId, String time, String trainee, String scene, Integer score, String status, String summary, String extPartyId) {
|
||||
}
|
||||
|
||||
public record DialogueResponse(String role, String label, String text, String audioUrl, Integer emotion, Integer trust, Boolean redFlag, String coachHint) {
|
||||
public record DialogueResponse(String role, String label, String text, String audioUrl, Long audioOssId, Integer emotion, Integer trust, Boolean redFlag, String coachHint) {
|
||||
public DialogueResponse(String role, String label, String text) {
|
||||
this(role, label, text, "", null, null, null, "");
|
||||
this(role, label, text, "", null, null, null, null, "");
|
||||
}
|
||||
|
||||
public DialogueResponse(String role, String label, String text, String audioUrl) {
|
||||
this(role, label, text, audioUrl, null, null, null, "");
|
||||
this(role, label, text, audioUrl, null, null, null, null, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -2111,6 +2111,7 @@ public class AihrPracticeSeedService {
|
||||
item.path("label").asText(),
|
||||
item.path("text").asText(),
|
||||
item.path("audioUrl").asText(""),
|
||||
item.hasNonNull("audioOssId") ? item.path("audioOssId").asLong() : null,
|
||||
item.hasNonNull("emotion") ? item.path("emotion").asInt() : null,
|
||||
item.hasNonNull("trust") ? item.path("trust").asInt() : null,
|
||||
item.hasNonNull("redFlag") ? item.path("redFlag").asBoolean() : null,
|
||||
@@ -2132,6 +2133,7 @@ public class AihrPracticeSeedService {
|
||||
List<DialogueResponse> turns = new ArrayList<>();
|
||||
List<String> replies = snapshot(activeSession == null ? null : activeSession.traineeReplies());
|
||||
List<String> audioUrls = snapshot(activeSession == null ? null : activeSession.traineeAudioUrls());
|
||||
List<Long> audioOssIds = snapshotLong(activeSession == null ? null : activeSession.traineeAudioOssIds());
|
||||
List<String> customerLines = snapshot(activeSession == null ? null : activeSession.customerLines());
|
||||
List<TurnEvidence> evidenceList = snapshotEvidence(activeSession == null ? null : activeSession.turnEvidence());
|
||||
for (int i = 0; i < scenario.rounds().size(); i++) {
|
||||
@@ -2145,6 +2147,7 @@ public class AihrPracticeSeedService {
|
||||
"员工话术",
|
||||
replies.get(i),
|
||||
i < audioUrls.size() ? audioUrls.get(i) : "",
|
||||
i < audioOssIds.size() ? audioOssIds.get(i) : null,
|
||||
evidence == null ? null : evidence.emotion(),
|
||||
evidence == null ? null : evidence.trust(),
|
||||
evidence == null ? null : evidence.redFlag(),
|
||||
@@ -2157,6 +2160,7 @@ public class AihrPracticeSeedService {
|
||||
"AI教练",
|
||||
coachHint,
|
||||
"",
|
||||
null,
|
||||
evidence == null ? null : evidence.emotion(),
|
||||
evidence == null ? null : evidence.trust(),
|
||||
evidence == null ? null : evidence.redFlag(),
|
||||
@@ -2201,6 +2205,7 @@ public class AihrPracticeSeedService {
|
||||
turn.label(),
|
||||
maskSensitiveText(turn.text()),
|
||||
firstNonBlank(turn.audioUrl(), ""),
|
||||
turn.audioOssId(),
|
||||
turn.emotion(),
|
||||
turn.trust(),
|
||||
turn.redFlag(),
|
||||
|
||||
Reference in New Issue
Block a user