fix:移除多余try和总结标题的异步

This commit is contained in:
rainv123
2026-04-16 14:43:16 +08:00
parent 2daf492e00
commit fbaf28de5c
@@ -151,21 +151,10 @@ public class AgentController {
} }
@PostMapping("/chat-title/{sessionId}/generate") @PostMapping("/chat-title/{sessionId}/generate")
@Operation(summary = "根据会话ID生成聊天标题(异步执行)") @Operation(summary = "根据会话ID生成聊天标题")
public Result<Void> generateAndSaveChatTitle(@PathVariable String sessionId) { public Result<Void> generateAndSaveChatTitle(@PathVariable String sessionId) {
try { agentChatSummaryService.generateAndSaveChatTitle(sessionId);
new Thread(() -> { return new Result<Void>().ok(null);
try {
agentChatSummaryService.generateAndSaveChatTitle(sessionId);
System.out.println("异步执行会话 " + sessionId + " 的标题生成完成");
} catch (Exception e) {
System.err.println("异步执行会话 " + sessionId + " 的标题生成失败: " + e.getMessage());
}
}).start();
return new Result<Void>().ok(null);
} catch (Exception e) {
return new Result<Void>().error("启动异步标题生成任务失败: " + e.getMessage());
}
} }
@PutMapping("/{id}") @PutMapping("/{id}")