mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 23:23:55 +08:00
fix:移除多余try和总结标题的异步
This commit is contained in:
+3
-14
@@ -151,21 +151,10 @@ public class AgentController {
|
||||
}
|
||||
|
||||
@PostMapping("/chat-title/{sessionId}/generate")
|
||||
@Operation(summary = "根据会话ID生成聊天标题(异步执行)")
|
||||
@Operation(summary = "根据会话ID生成聊天标题")
|
||||
public Result<Void> generateAndSaveChatTitle(@PathVariable String sessionId) {
|
||||
try {
|
||||
new Thread(() -> {
|
||||
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());
|
||||
}
|
||||
agentChatSummaryService.generateAndSaveChatTitle(sessionId);
|
||||
return new Result<Void>().ok(null);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
|
||||
Reference in New Issue
Block a user