Преглед на файлове

fix 4o-mini不计算次数

chenbiao преди 2 години
родител
ревизия
8f3c9a08ef

+ 5 - 3
netflix-service/src/main/java/com/cyksj/service/chatgpt/impl/ChatGptAccountServiceImpl.java

@@ -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());

+ 1 - 1
netflix-web/src/main/java/com/cyksj/web/controller/mirror/MirrorController.java

@@ -167,7 +167,7 @@ public class MirrorController {
                 String url = "[点击此处升级](https://nf.video/ticket?relationId=%d&pType=pay)";
 
                 String format = String.format(url, user.getRelationId());
-                detail.setMessage("您目前的套餐已达到GPT-4的使用上限。您可以继续使用3.5,预计 " + DateUtil.format(new Date(conversationLimitResponse.getNextAvailableTime()), "yyyy-MM-dd HH:mm:ss") + " 恢复" + ",如需增加滚动时间内可询问次数," + format);
+                detail.setMessage("您目前的套餐已达到GPT-4的使用上限。您可以继续使用3.5或4o-mini,预计 " + DateUtil.format(new Date(conversationLimitResponse.getNextAvailableTime()), "yyyy-MM-dd HH:mm:ss") + " 恢复" + ",如需增加滚动时间内可询问次数," + format);
                 chatgptConversionLimitView.setDetail(detail);
                 return chatgptConversionLimitView;
             } else {