Skip to content

Commit 5b204c6

Browse files
authored
Merge pull request #16 from RappyLabyAddons/feat/improveErrorHandling
Improve error handling
2 parents cf31eaa + 1c689ca commit 5b204c6

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

build.gradle.kts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ labyMod {
2121
author = "RappyTV"
2222
description = "Communicate with ChatGPT right in your Chat. Powered by OpenAI."
2323
minecraftVersion = "*"
24-
version = System.getenv().getOrDefault("VERSION", "1.1.1")
24+
version = System.getenv().getOrDefault("VERSION", "1.1.2")
2525
}
2626

2727
minecraft {
@@ -34,7 +34,9 @@ labyMod {
3434
"1.19.2",
3535
"1.19.3",
3636
"1.19.4",
37-
"1.20.1"
37+
"1.20.1",
38+
"1.20.2",
39+
"1.20.4"
3840
) { version, provider ->
3941
configureRun(provider, version)
4042
}

core/src/main/java/com/rappytv/labygpt/api/GPTRequest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,15 @@ public CompletableFuture<Void> sendRequestAsync(String query, String key, String
5757
}
5858

5959
future.complete(null);
60+
}).exceptionally((e) -> {
61+
future.completeExceptionally(e);
62+
error = e.getMessage();
63+
return null;
6064
});
6165
} catch (Exception e) {
6266
e.printStackTrace();
6367
future.completeExceptionally(e);
68+
error = e.getMessage();
6469
}
6570

6671
return future;

core/src/main/java/com/rappytv/labygpt/commands/GPTCommand.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public boolean execute(String prefix, String[] arguments) {
5757
displayMessage(Component.empty().append(GPTAddon.prefix)
5858
.append(Component.text(request.getOutput(), NamedTextColor.WHITE)));
5959
}
60+
}).exceptionally((e) -> {
61+
displayMessage(Component.empty().append(GPTAddon.prefix)
62+
.append(Component.text(e.getMessage(), NamedTextColor.RED)));
63+
return null;
6064
});
6165

6266
return true;

core/src/main/java/com/rappytv/labygpt/config/GPTSubConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import net.labymod.api.client.gui.screen.widget.widgets.input.dropdown.DropdownWidget;
66
import net.labymod.api.client.gui.screen.widget.widgets.input.dropdown.DropdownWidget.DropdownSetting;
77
import net.labymod.api.configuration.loader.Config;
8+
import net.labymod.api.configuration.loader.annotation.Exclude;
89
import net.labymod.api.configuration.loader.annotation.SpriteSlot;
910
import net.labymod.api.configuration.loader.property.ConfigProperty;
1011
import net.labymod.api.configuration.settings.annotation.SettingListener;
@@ -14,6 +15,7 @@
1415

1516
public class GPTSubConfig extends Config {
1617

18+
@Exclude
1719
private final String[] models = new String[]{"GPT-3.5-Turbo", "GPT-3.5-Turbo-16k", "GPT-4", "GPT-4-32k"};
1820

1921
@DropdownSetting

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
rootProject.name = "LabyGPT"
22

33
pluginManagement {
4-
val labyGradlePluginVersion = "0.3.28"
4+
val labyGradlePluginVersion = "0.3.43"
55
plugins {
66
id("net.labymod.gradle") version (labyGradlePluginVersion)
77
}

0 commit comments

Comments
 (0)