-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: update thread and message according to new spec
Signed-off-by: James <[email protected]>
- Loading branch information
James
committed
Nov 24, 2023
1 parent
c0fb6ec
commit 5dfc501
Showing
28 changed files
with
878 additions
and
509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
import { Thread } from "../index"; | ||
import { Thread, ThreadMessage } from "../index"; | ||
import { JanPlugin } from "../plugin"; | ||
|
||
/** | ||
* Abstract class for conversational plugins. | ||
* Abstract class for Thread plugins. | ||
* @abstract | ||
* @extends JanPlugin | ||
*/ | ||
export abstract class ConversationalPlugin extends JanPlugin { | ||
/** | ||
* Returns a list of conversations. | ||
* Returns a list of thread. | ||
* @abstract | ||
* @returns {Promise<any[]>} A promise that resolves to an array of conversations. | ||
* @returns {Promise<Thread[]>} A promise that resolves to an array of threads. | ||
*/ | ||
abstract getConversations(): Promise<any[]>; | ||
abstract getThreads(): Promise<Thread[]>; | ||
|
||
/** | ||
* Saves a conversation. | ||
* Saves a thread. | ||
* @abstract | ||
* @param {Thread} conversation - The conversation to save. | ||
* @returns {Promise<void>} A promise that resolves when the conversation is saved. | ||
* @param {Thread} thread - The thread to save. | ||
* @returns {Promise<void>} A promise that resolves when the thread is saved. | ||
*/ | ||
abstract saveConversation(conversation: Thread): Promise<void>; | ||
abstract saveThread(thread: Thread): Promise<void>; | ||
|
||
/** | ||
* Deletes a conversation. | ||
* Deletes a thread. | ||
* @abstract | ||
* @param {string} conversationId - The ID of the conversation to delete. | ||
* @returns {Promise<void>} A promise that resolves when the conversation is deleted. | ||
* @param {string} threadId - The ID of the thread to delete. | ||
* @returns {Promise<void>} A promise that resolves when the thread is deleted. | ||
*/ | ||
abstract deleteConversation(conversationId: string): Promise<void>; | ||
abstract deleteThread(threadId: string): Promise<void>; | ||
|
||
abstract addNewMessage(message: ThreadMessage): Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.