Class Threads

java.lang.Object
com.jackdaw.chatwithnpc.openaiapi.Threads

public class Threads extends Object
  • Constructor Details

    • Threads

      public Threads()
  • Method Details

    • createThread

      public static void createThread(@NotNull @NotNull ConversationHandler conversationHandler) throws Exception
      Create a new thread and set the thread id to the npc
      Parameters:
      conversationHandler - The conversation handler
      Throws:
      Exception - If the thread id is null
    • addMessage

      public static void addMessage(String threadId, String message) throws Exception
      Add a message to the thread
      Parameters:
      threadId - The thread id
      message - The message
      Throws:
      Exception - If the message is not sent
    • discardThread

      public static void discardThread(String threadId) throws Exception
      Discard the thread id from the npc
      Parameters:
      threadId - The thread id
      Throws:
      Exception - If is there any error