From 2b71aa987f4ffa399ce53b29b8265aca6fd8047f Mon Sep 17 00:00:00 2001 From: kylelin1998 Date: Wed, 9 Aug 2023 18:27:10 +0800 Subject: [PATCH] Fix a bug --- src/main/java/code/config/Config.java | 2 +- src/main/java/code/handler/Handler.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/code/config/Config.java b/src/main/java/code/config/Config.java index 67d52d8..cca52ca 100644 --- a/src/main/java/code/config/Config.java +++ b/src/main/java/code/config/Config.java @@ -39,7 +39,7 @@ public class Config { private static ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock(); public static class MetaData { - public final static String CurrentVersion = "1.0.50"; + public final static String CurrentVersion = "1.0.52"; public final static String GitOwner = "kylelin1998"; public final static String GitRepo = "ChatGPTForTelegram"; public final static String ProcessName = "ChatGPTForTelegram-universal.jar"; diff --git a/src/main/java/code/handler/Handler.java b/src/main/java/code/handler/Handler.java index 6f8c9c6..f584063 100644 --- a/src/main/java/code/handler/Handler.java +++ b/src/main/java/code/handler/Handler.java @@ -193,6 +193,7 @@ public static void init() { if (response.isOk()) { break; } + GptTokenStore.handle(token, response); try { TimeUnit.SECONDS.sleep(i + 1); } catch (InterruptedException e) {} @@ -200,7 +201,6 @@ public static void init() { if (!response.isOk()) { log.warn(JSON.toJSONString(response)); - GptTokenStore.handle(token, response); int statusCode = response.getStatusCode(); if (statusCode == 400) { @@ -363,6 +363,7 @@ public static void init() { if (response.isOk()) { break; } + GptTokenStore.handle(token, response); try { TimeUnit.SECONDS.sleep(i + 1); } catch (InterruptedException e) {} @@ -370,7 +371,6 @@ public static void init() { if (!response.isOk()) { log.warn(JSON.toJSONString(response)); - GptTokenStore.handle(token, response); int statusCode = response.getStatusCode(); if (statusCode == 400) { @@ -485,6 +485,7 @@ public static void init() { if (response.isOk()) { break; } + GptTokenStore.handle(token, response); try { TimeUnit.SECONDS.sleep(i + 1); } catch (InterruptedException e) {} @@ -492,7 +493,6 @@ public static void init() { if (!response.isOk()) { log.warn(JSON.toJSONString(response)); - GptTokenStore.handle(token, response); MessageHandle.editMessage(message, I18nHandle.getText(session.getFromId(), I18nEnum.AnErrorOccurredOfRequestingOpenAiApiFailed, response.getStatusCode())); return StepResult.end(); @@ -599,6 +599,7 @@ public static void init() { if (response.isOk()) { break; } + GptTokenStore.handle(token, response); try { TimeUnit.SECONDS.sleep(i + 1); } catch (InterruptedException e) {} @@ -606,7 +607,6 @@ public static void init() { if (!response.isOk()) { log.warn(JSON.toJSONString(response)); - GptTokenStore.handle(token, response); MessageHandle.editMessage(message, I18nHandle.getText(session.getFromId(), I18nEnum.AnErrorOccurredOfRequestingOpenAiApiFailed, response.getStatusCode())); return StepResult.reject(); @@ -711,6 +711,7 @@ public static void init() { if (response.isOk()) { break; } + GptTokenStore.handle(token, response); try { TimeUnit.SECONDS.sleep(i + 1); } catch (InterruptedException e) {} @@ -718,7 +719,6 @@ public static void init() { if (!response.isOk()) { log.warn(JSON.toJSONString(response)); - GptTokenStore.handle(token, response); MessageHandle.editMessage(message, I18nHandle.getText(session.getFromId(), I18nEnum.AnErrorOccurredOfRequestingOpenAiApiFailed, response.getStatusCode())); return StepResult.reject(); @@ -865,6 +865,7 @@ public static void init() { if (response.isOk()) { break; } + GptTokenStore.handle(token, response); try { TimeUnit.SECONDS.sleep(i + 1); } catch (InterruptedException e) {} @@ -872,7 +873,6 @@ public static void init() { if (!response.isOk()) { log.warn(JSON.toJSONString(response)); - GptTokenStore.handle(token, response); int statusCode = response.getStatusCode(); if (statusCode == 400) {