|
@@ -53,7 +53,6 @@ public class MirrorController {
|
|
|
private final BeanSearcher beanSearcher;
|
|
private final BeanSearcher beanSearcher;
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* GPT车票跳转登录
|
|
* GPT车票跳转登录
|
|
|
*
|
|
*
|
|
@@ -107,12 +106,14 @@ public class MirrorController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/gpt/genTitleSync")
|
|
@GetMapping("/gpt/genTitleSync")
|
|
|
- public Result<String> genTitleSync(String messageId){
|
|
|
|
|
|
|
+ public Result<String> genTitleSync(String messageId) {
|
|
|
//1.从request获取请求头Authorization 并取 值内 'Bearer ' 后的值为usertoken
|
|
//1.从request获取请求头Authorization 并取 值内 'Bearer ' 后的值为usertoken
|
|
|
String authorization = request.getHeader("Authorization");
|
|
String authorization = request.getHeader("Authorization");
|
|
|
String carid = request.getHeader("Carid");
|
|
String carid = request.getHeader("Carid");
|
|
|
String userToken = authorization.substring(7);
|
|
String userToken = authorization.substring(7);
|
|
|
- chatGptAccountService.genTitleSync(messageId, carid, userToken);
|
|
|
|
|
|
|
+ TASK_EXECUTOR.execute(() -> {
|
|
|
|
|
+ chatGptAccountService.genTitleSync(messageId, carid, userToken);
|
|
|
|
|
+ });
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -137,7 +138,7 @@ public class MirrorController {
|
|
|
//text-davinci-002-render-sha 3.5
|
|
//text-davinci-002-render-sha 3.5
|
|
|
ConversationLimitResponse conversationLimitResponse = chatGptAccountService.conversationLimit(userToken, conversationRequest.getModel(), conversationRequest.getCarId(), user);
|
|
ConversationLimitResponse conversationLimitResponse = chatGptAccountService.conversationLimit(userToken, conversationRequest.getModel(), conversationRequest.getCarId(), user);
|
|
|
//记录提问时间,车次,标题和模型
|
|
//记录提问时间,车次,标题和模型
|
|
|
- TASK_EXECUTOR.execute(()->{
|
|
|
|
|
|
|
+ TASK_EXECUTOR.execute(() -> {
|
|
|
chatGptAccountService.saveConversationRecord(userToken, conversationRequest);
|
|
chatGptAccountService.saveConversationRecord(userToken, conversationRequest);
|
|
|
});
|
|
});
|
|
|
OutputStream out = null;
|
|
OutputStream out = null;
|
|
@@ -146,7 +147,7 @@ public class MirrorController {
|
|
|
response.setStatus(429);
|
|
response.setStatus(429);
|
|
|
String json = "{\"detail\":{\"message\":\"您的账号已达到GPT-4的使用上限。您现在可以继续使用默认模型,或者重试在\",\"code\":\"model_cap_exceeded\",\"clears_in\":2687}}";
|
|
String json = "{\"detail\":{\"message\":\"您的账号已达到GPT-4的使用上限。您现在可以继续使用默认模型,或者重试在\",\"code\":\"model_cap_exceeded\",\"clears_in\":2687}}";
|
|
|
JSONObject res = new JSONObject(json);
|
|
JSONObject res = new JSONObject(json);
|
|
|
- res.putOpt("clears_in",conversationLimitResponse.getNextAvailableTime()/1000);
|
|
|
|
|
|
|
+ res.putOpt("clears_in", conversationLimitResponse.getNextAvailableTime() / 1000);
|
|
|
messgae = res.toString();
|
|
messgae = res.toString();
|
|
|
} else {
|
|
} else {
|
|
|
response.setStatus(200);
|
|
response.setStatus(200);
|
|
@@ -167,6 +168,7 @@ public class MirrorController {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取车队列表
|
|
* 获取车队列表
|
|
|
|
|
+ *
|
|
|
* @param relationId
|
|
* @param relationId
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
@@ -201,7 +203,7 @@ public class MirrorController {
|
|
|
public Result<SearchResult<ChatGptUserConversationRecordHistoryView>> getCarHistory(Long relationId) {
|
|
public Result<SearchResult<ChatGptUserConversationRecordHistoryView>> getCarHistory(Long relationId) {
|
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
ChatgptUser carChatGptUser = chatGptAccountService.getCarChatGptUser(userId, relationId);
|
|
ChatgptUser carChatGptUser = chatGptAccountService.getCarChatGptUser(userId, relationId);
|
|
|
- if(carChatGptUser == null){
|
|
|
|
|
|
|
+ if (carChatGptUser == null) {
|
|
|
throw BusinessRuntimeException.getInstance("车票出现了异常.");
|
|
throw BusinessRuntimeException.getInstance("车票出现了异常.");
|
|
|
}
|
|
}
|
|
|
MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap()).field("r.user_token", carChatGptUser.getUserToken());
|
|
MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap()).field("r.user_token", carChatGptUser.getUserToken());
|