jan icon indicating copy to clipboard operation
jan copied to clipboard

refactor: refactor `/extensions` implementations to be cleaner

Open freelerobot opened this issue 1 year ago • 1 comments

Motivation:

  • We are conflating some impl logic in root/extensions that should go in root/core/extensions

Example 1:

  type(): ExtensionType {
    return ExtensionType.Assistant;
  }

Should probably be in codeblock:

/**
 * Assistant extension for managing assistants.
 * @extends BaseExtension
 */
export abstract class AssistantExtension extends BaseExtension implements AssistantInterface {
  abstract createAssistant(assistant: Assistant): Promise<void>
  abstract deleteAssistant(assistant: Assistant): Promise<void>
  abstract getAssistants(): Promise<Assistant[]>
}

Exmaple 2: This is quite redundant, and should import the actual typing.

  private async createJanAssistant(): Promise<void> {
    const janAssistant: Assistant = {
      avatar: "",
      thread_location: undefined,
      id: "jan",
      object: "assistant",
      created_at: Date.now(),
      name: "Jan",
      description: "A default assistant that can use all downloaded models",
      model: "*",
      instructions: "",
      tools: undefined,
      file_ids: [],
      metadata: undefined,
    };

Similar issues exist that could lead to small edge cases and bugs.

Success criteria:

  • Refactor all extensions implementations to have cleaner architecture.

freelerobot avatar Dec 13 '23 07:12 freelerobot

@0xSage I solved some related issues of example 1 in the pull request #1094 . I still confuse on the example 2, could you give me more details about example 2. Thanks!

0xHieu01 avatar Dec 19 '23 06:12 0xHieu01

deprecated issue

freelerobot avatar Jan 05 '24 09:01 freelerobot