Class Threads
java.lang.Object
com.jackdaw.chatwithnpc.openaiapi.Threads
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
private static class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addMessage
(String threadId, String message) Add a message to the threadstatic void
createThread
(@NotNull ConversationHandler conversationHandler) Create a new thread and set the thread id to the npcstatic void
discardThread
(String threadId) Discard the thread id from the npc(package private) static String
getLastMessage
(String threadId) Get the last message from the thread
-
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
Add a message to the thread- Parameters:
threadId
- The thread idmessage
- The message- Throws:
Exception
- If the message is not sent
-
discardThread
Discard the thread id from the npc- Parameters:
threadId
- The thread id- Throws:
Exception
- If is there any error
-
getLastMessage
Get the last message from the thread- Parameters:
threadId
- The thread id- Returns:
- The last message
- Throws:
Exception
- If the message is not received
-