-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: deprecate extension type implementation (janhq#1677)
* refactor: deprecate extension type implementation * chore: update README.md * refactor: EventName to use the events defined in /types
- Loading branch information
Showing
34 changed files
with
242 additions
and
627 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
import { Assistant, AssistantInterface } from '../index' | ||
import { BaseExtension } from '../extension' | ||
import { Assistant, AssistantInterface } from "../index"; | ||
import { BaseExtension, ExtensionTypeEnum } from "../extension"; | ||
|
||
/** | ||
* 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[]> | ||
/** | ||
* Assistant extension type. | ||
*/ | ||
type(): ExtensionTypeEnum | undefined { | ||
return ExtensionTypeEnum.Assistant; | ||
} | ||
|
||
abstract createAssistant(assistant: Assistant): Promise<void>; | ||
abstract deleteAssistant(assistant: Assistant): Promise<void>; | ||
abstract getAssistants(): Promise<Assistant[]>; | ||
} |
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,9 +1,16 @@ | ||
import { InferenceInterface, MessageRequest, ThreadMessage } from '../index' | ||
import { BaseExtension } from '../extension' | ||
import { InferenceInterface, MessageRequest, ThreadMessage } from "../index"; | ||
import { BaseExtension, ExtensionTypeEnum } from "../extension"; | ||
|
||
/** | ||
* Inference extension. Start, stop and inference models. | ||
*/ | ||
export abstract class InferenceExtension extends BaseExtension implements InferenceInterface { | ||
abstract inference(data: MessageRequest): Promise<ThreadMessage> | ||
/** | ||
* Inference extension type. | ||
*/ | ||
type(): ExtensionTypeEnum | undefined { | ||
return ExtensionTypeEnum.Inference; | ||
} | ||
|
||
abstract inference(data: MessageRequest): Promise<ThreadMessage>; | ||
} |
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,14 +1,24 @@ | ||
import { BaseExtension } from '../extension' | ||
import { Model, ModelInterface } from '../index' | ||
import { BaseExtension, ExtensionTypeEnum } from "../extension"; | ||
import { Model, ModelInterface } from "../index"; | ||
|
||
/** | ||
* Model extension for managing models. | ||
*/ | ||
export abstract class ModelExtension extends BaseExtension implements ModelInterface { | ||
abstract downloadModel(model: Model, network?: { proxy: string, ignoreSSL?: boolean }): Promise<void> | ||
abstract cancelModelDownload(modelId: string): Promise<void> | ||
abstract deleteModel(modelId: string): Promise<void> | ||
abstract saveModel(model: Model): Promise<void> | ||
abstract getDownloadedModels(): Promise<Model[]> | ||
abstract getConfiguredModels(): Promise<Model[]> | ||
/** | ||
* Model extension type. | ||
*/ | ||
type(): ExtensionTypeEnum | undefined { | ||
return ExtensionTypeEnum.Model; | ||
} | ||
|
||
abstract downloadModel( | ||
model: Model, | ||
network?: { proxy: string; ignoreSSL?: boolean }, | ||
): Promise<void>; | ||
abstract cancelModelDownload(modelId: string): Promise<void>; | ||
abstract deleteModel(modelId: string): Promise<void>; | ||
abstract saveModel(model: Model): Promise<void>; | ||
abstract getDownloadedModels(): Promise<Model[]>; | ||
abstract getConfiguredModels(): Promise<Model[]>; | ||
} |
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,11 +1,18 @@ | ||
import { BaseExtension } from '../extension' | ||
import { MonitoringInterface } from '../index' | ||
import { BaseExtension, ExtensionTypeEnum } from "../extension"; | ||
import { MonitoringInterface } from "../index"; | ||
|
||
/** | ||
* Monitoring extension for system monitoring. | ||
* @extends BaseExtension | ||
*/ | ||
export abstract class MonitoringExtension extends BaseExtension implements MonitoringInterface { | ||
abstract getResourcesInfo(): Promise<any> | ||
abstract getCurrentLoad(): Promise<any> | ||
/** | ||
* Monitoring extension type. | ||
*/ | ||
type(): ExtensionTypeEnum | undefined { | ||
return ExtensionTypeEnum.SystemMonitoring; | ||
} | ||
|
||
abstract getResourcesInfo(): Promise<any>; | ||
abstract getCurrentLoad(): Promise<any>; | ||
} |
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.