|
|
@@ -456,13 +456,7 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
|
|
|
if(!"text-davinci-002-render-sha".equals(conversationRequest.getModel())){
|
|
|
String key = RedisService.key.CHATGPT_CONVERSATION_LIMIT.getName() + ":" + userToken;
|
|
|
long currentTimeMillis = System.currentTimeMillis();
|
|
|
- // 如果未超过限制,记录当前请求的时间戳
|
|
|
- redisService.zAdd(key, currentTimeMillis, currentTimeMillis);
|
|
|
- // 设置ZSet的过期时间,窗口大小加上一段冗余时间
|
|
|
- redisService.expire(key, (chatgptUser.getLimitTime() * 60 * 60) + 20);
|
|
|
- }
|
|
|
|
|
|
- if (StringUtils.isNotBlank(chatgptSession.getCarId())) {
|
|
|
redisService.del();
|
|
|
if(redisService.hasKey("chatgpt:team:clears_in:" + chatgptSession.getCarId())){
|
|
|
redisService.del("chatgpt:team:clears_in:" + chatgptSession.getCarId());
|
|
|
@@ -470,6 +464,14 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
|
|
|
if (redisService.hasKey("chatgpt:clears_in:" + chatgptSession.getCarId())) {
|
|
|
redisService.del("chatgpt:clears_in:" + chatgptSession.getCarId());
|
|
|
}
|
|
|
+
|
|
|
+ // 如果未超过限制,记录当前请求的时间戳
|
|
|
+ redisService.zAdd(key, currentTimeMillis, currentTimeMillis);
|
|
|
+ // 设置ZSet的过期时间,窗口大小加上一段冗余时间
|
|
|
+ redisService.expire(key, (chatgptUser.getLimitTime() * 60 * 60) + 20);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(chatgptSession.getCarId())) {
|
|
|
updateExperienceAndScore(chatgptSession.getCarId(), !"text-davinci-002-render-sha".equals(conversationRequest.getModel()), System.currentTimeMillis());
|
|
|
}
|
|
|
|