Skip to content

Commit

Permalink
Fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kylelin1998 committed Aug 9, 2023
1 parent 23f560f commit 2b71aa9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/java/code/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/code/handler/Handler.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,14 @@ public static void init() {
if (response.isOk()) {
break;
}
GptTokenStore.handle(token, response);
try {
TimeUnit.SECONDS.sleep(i + 1);
} catch (InterruptedException e) {}
}

if (!response.isOk()) {
log.warn(JSON.toJSONString(response));
GptTokenStore.handle(token, response);

int statusCode = response.getStatusCode();
if (statusCode == 400) {
Expand Down Expand Up @@ -363,14 +363,14 @@ public static void init() {
if (response.isOk()) {
break;
}
GptTokenStore.handle(token, response);
try {
TimeUnit.SECONDS.sleep(i + 1);
} catch (InterruptedException e) {}
}

if (!response.isOk()) {
log.warn(JSON.toJSONString(response));
GptTokenStore.handle(token, response);

int statusCode = response.getStatusCode();
if (statusCode == 400) {
Expand Down Expand Up @@ -485,14 +485,14 @@ public static void init() {
if (response.isOk()) {
break;
}
GptTokenStore.handle(token, response);
try {
TimeUnit.SECONDS.sleep(i + 1);
} catch (InterruptedException e) {}
}

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();
Expand Down Expand Up @@ -599,14 +599,14 @@ public static void init() {
if (response.isOk()) {
break;
}
GptTokenStore.handle(token, response);
try {
TimeUnit.SECONDS.sleep(i + 1);
} catch (InterruptedException e) {}
}

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();
Expand Down Expand Up @@ -711,14 +711,14 @@ public static void init() {
if (response.isOk()) {
break;
}
GptTokenStore.handle(token, response);
try {
TimeUnit.SECONDS.sleep(i + 1);
} catch (InterruptedException e) {}
}

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();
Expand Down Expand Up @@ -865,14 +865,14 @@ public static void init() {
if (response.isOk()) {
break;
}
GptTokenStore.handle(token, response);
try {
TimeUnit.SECONDS.sleep(i + 1);
} catch (InterruptedException e) {}
}

if (!response.isOk()) {
log.warn(JSON.toJSONString(response));
GptTokenStore.handle(token, response);

int statusCode = response.getStatusCode();
if (statusCode == 400) {
Expand Down

0 comments on commit 2b71aa9

Please sign in to comment.