|
|
@@ -71,6 +71,8 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
|
|
|
|
|
|
private static final long WINDOW_SIZE = 3 * 60 * 60; // 3小时窗口的秒数
|
|
|
|
|
|
+ private static final List<String> LOW_GPT_MODEL = List.of("gpt-4o-mini","text-davinci-002-render-sha");
|
|
|
+
|
|
|
private static final GlobalThreadPoolTaskExecutor TASK_EXECUTOR = GlobalThreadPoolTaskExecutor.getInstance();
|
|
|
|
|
|
private final RedisService redisService;
|
|
|
@@ -495,7 +497,7 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
|
|
|
chatgptUserConversationRecord.setModel(conversationRequest.getModel());
|
|
|
chatgptUserConversationRecordMapper.insert(chatgptUserConversationRecord);
|
|
|
|
|
|
- if(!"text-davinci-002-render-sha".equals(conversationRequest.getModel())){
|
|
|
+ if(!LOW_GPT_MODEL.contains(conversationRequest.getModel())){
|
|
|
String key = RedisService.key.CHATGPT_CONVERSATION_LIMIT.getName() + ":" + userToken;
|
|
|
long currentTimeMillis = System.currentTimeMillis();
|
|
|
|
|
|
@@ -514,7 +516,7 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(chatgptSession.getCarId())) {
|
|
|
- updateExperienceAndScore(chatgptSession.getCarId(), !"text-davinci-002-render-sha".equals(conversationRequest.getModel()), System.currentTimeMillis());
|
|
|
+ updateExperienceAndScore(chatgptSession.getCarId(), !LOW_GPT_MODEL.contains(conversationRequest.getModel()), System.currentTimeMillis());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -524,7 +526,7 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
|
|
|
public ConversationLimitResponse conversationLimit(String userToken, String model, String carId, ChatgptUser chatgptUser, Boolean isCar) {
|
|
|
ConversationLimitResponse conversationLimitResponse = new ConversationLimitResponse();
|
|
|
conversationLimitResponse.setLimited(false);
|
|
|
- if (!"text-davinci-002-render-sha".equals(model)) {
|
|
|
+ if (!LOW_GPT_MODEL.contains(model)) {
|
|
|
//如果不为车队 直接返回
|
|
|
if (chatgptUser.getIsCar()) {
|
|
|
conversationLimitResponse = isConversationAllowed(userToken, chatgptUser.getLimitNum(), chatgptUser.getLimitTime());
|