Skip to content

Commit

Permalink
Changed openServices to a List instead of a Set.
Browse files Browse the repository at this point in the history
Bumped ver 1.2.2
  • Loading branch information
ArcticRaven committed Mar 31, 2024
1 parent adf15ff commit b660da2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/main/java/dev/arctic/aicore/AiCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public final class AiCore extends JavaPlugin {

public static AiCore plugin;
public static AiCore AICORE_PLUGIN;
/**
* A List of all open services, iterable for updating, viewing, and closing services
*/
Expand All @@ -18,7 +18,7 @@ public final class AiCore extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
plugin = this;
AICORE_PLUGIN = this;

// Register the CommandManager and TabComplete classes
Objects.requireNonNull(this.getCommand("aicore")).setExecutor(new CommandManager());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package dev.arctic.aicore.assistants;

import com.theokanning.openai.OpenAiResponse;
import com.theokanning.openai.assistants.Assistant;
import com.theokanning.openai.messages.Message;
import com.theokanning.openai.messages.MessageRequest;
Expand All @@ -16,7 +15,7 @@
import java.util.HashMap;
import java.util.UUID;

import static dev.arctic.aicore.AiCore.plugin;
import static dev.arctic.aicore.AiCore.AICORE_PLUGIN;

/**
* The AssistantService class is responsible for managing the interactions with the OpenAI service.
Expand Down Expand Up @@ -127,12 +126,12 @@ public void run() {
public void run() {
createRunCompletion(trackedRun);
}
}.runTaskLaterAsynchronously(plugin, 20);
}.runTaskLaterAsynchronously(AICORE_PLUGIN, 20);
return;
}
trackedRun.setOutput(service.listMessages(trackedRun.getThreadID()));
trackedRun.setLastUpdated(new Date());
}
}.runTaskAsynchronously(plugin);
}.runTaskAsynchronously(AICORE_PLUGIN);
}
}
6 changes: 3 additions & 3 deletions src/main/java/dev/arctic/aicore/chat/ChatService.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.concurrent.CompletableFuture;
import java.util.List;

import static dev.arctic.aicore.AiCore.plugin;
import static dev.arctic.aicore.AiCore.AICORE_PLUGIN;

/**
* Provides chat services by interfacing with the OpenAI API to generate responses to prompts.
Expand Down Expand Up @@ -61,7 +61,7 @@ public void run() {

future.complete(response);
}
}.runTaskAsynchronously(plugin);
}.runTaskAsynchronously(AICORE_PLUGIN);

return future;
}
Expand Down Expand Up @@ -92,7 +92,7 @@ public void run() {

future.complete(results);
}
}.runTaskAsynchronously(plugin);
}.runTaskAsynchronously(AICORE_PLUGIN);

return future;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/dev/arctic/aicore/objects/AiCoreService.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ public class AiCoreService {
@Getter
private AssistantService assistantService;
/**
* The name of the service or plugin
* The name of the service or AICORE_PLUGIN
*/
@Getter
public String name;

/**
* Constructs a new AiCoreService instance. Intended 1 key per plugin
* Constructs a new AiCoreService instance. Intended 1 key per AICORE_PLUGIN
*
* @param apiKey The API key used for making OpenAI API requests.
*/
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/dev/arctic/aicore/utils/CommandManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import java.util.logging.Level;

import static dev.arctic.aicore.AiCore.plugin;
import static dev.arctic.aicore.AiCore.AICORE_PLUGIN;

public class CommandManager implements CommandExecutor {
@Override
Expand All @@ -35,10 +35,10 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command

} else {
String names = "";
for (AiCoreService service : plugin.openServices) {
for (AiCoreService service : AICORE_PLUGIN.openServices) {
names += service.getName() + ", ";
}
plugin.getLogger().log(Level.WARNING, "Open Services: " + names);
AICORE_PLUGIN.getLogger().log(Level.WARNING, "Open Services: " + names);
}
return true;
}
Expand Down

0 comments on commit b660da2

Please sign in to comment.