|
|
@@ -2,6 +2,7 @@ package com.cyksj.web.controller.mirror;
|
|
|
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
+import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
|
|
|
import com.cyksj.common.util.IoKit;
|
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
@@ -41,6 +42,8 @@ import java.util.Set;
|
|
|
@RequestMapping("/applets/mirror")
|
|
|
public class MirrorController {
|
|
|
|
|
|
+ private static final GlobalThreadPoolTaskExecutor TASK_EXECUTOR = GlobalThreadPoolTaskExecutor.getInstance();
|
|
|
+
|
|
|
private final ChatGptAccountService chatGptAccountService;
|
|
|
|
|
|
private final HttpServletResponse response;
|
|
|
@@ -132,9 +135,11 @@ public class MirrorController {
|
|
|
}
|
|
|
//4.获取gpt-4 的规则限制
|
|
|
//text-davinci-002-render-sha 3.5
|
|
|
- ConversationLimitResponse conversationLimitResponse = chatGptAccountService.conversationLimit(userToken, conversationRequest.getModel(), conversationRequest.getCarId());
|
|
|
+ ConversationLimitResponse conversationLimitResponse = chatGptAccountService.conversationLimit(userToken, conversationRequest.getModel(), conversationRequest.getCarId(), user);
|
|
|
//记录提问时间,车次,标题和模型
|
|
|
- chatGptAccountService.saveConversationRecord(userToken, conversationRequest);
|
|
|
+ TASK_EXECUTOR.execute(()->{
|
|
|
+ chatGptAccountService.saveConversationRecord(userToken, conversationRequest);
|
|
|
+ });
|
|
|
OutputStream out = null;
|
|
|
String messgae = "";
|
|
|
if (conversationLimitResponse.isLimited()) {
|