优化调整

This commit is contained in:
2025-07-26 00:37:18 +08:00
parent 08bbd4df0f
commit 0dfabc35d7
90 changed files with 3594 additions and 2294 deletions
@@ -8,7 +8,8 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.scheduling.annotation.Async;
import java.util.concurrent.CompletableFuture;
import java.util.Map;
/**
@@ -29,16 +30,11 @@ public class EmotionSummaryController {
@Operation(summary = "生成用户当天的情绪记录总结", description = "基于用户当天的聊天记录生成情绪分析和记录")
@PostMapping("/generate")
public Result<Map<String, Object>> generateEmotionSummary() {
try {
// 从上下文中获取当前用户ID
String userId = CurrentUserUtil.requireCurrentUserId();
log.info("收到生成情绪记录总结请求: userId={}", userId);
// 调用AI服务生成情绪总结
Map<String, Object> result = aiChatService.generateEmotionSummary(userId);
// 调用AI服务异步生成情绪总结(阻塞获取结果)
Map<String, Object> result = aiChatService.generateEmotionSummaryAsync(userId).get();
if ((Boolean) result.get("success")) {
log.info("情绪记录总结生成成功: userId={}", userId);
return Result.success("情绪记录总结生成成功", result);
@@ -47,7 +43,6 @@ public class EmotionSummaryController {
log.warn("情绪记录总结生成失败: userId={}, message={}", userId, message);
return Result.error(message);
}
} catch (IllegalStateException e) {
log.warn("用户认证失败: {}", e.getMessage());
return Result.error(e.getMessage());