chore: add facades refactor: core module export refactor: inference plugin - deprecate function registering (#537) * refactor: revamp inference plugin as class - deprecate function registering * refactor: monitoring plugin - deprecate service registering (#538) refactor: revamp inference plugin as class - deprecate function registering chore: update import refactor: plugin revamp - model management chore: update build steps and remove experimental plugins refactor: remove pluggable electron chore: add sorting for conversations chore: build plugins for testing chore: consistent plugin directory name chore: docs chore: fix CI chore: update conversation prefix
24 lines
772 B
TypeScript
24 lines
772 B
TypeScript
import { PluginType } from '@janhq/core'
|
|
import { useSetAtom } from 'jotai'
|
|
import { downloadedModelAtom } from '@helpers/atoms/DownloadedModel.atom'
|
|
import { getDownloadedModels } from './useGetDownloadedModels'
|
|
import { pluginManager } from '@plugin/PluginManager'
|
|
import { ModelPlugin } from '@janhq/core/lib/plugins'
|
|
import { Model } from '@janhq/core/lib/types'
|
|
|
|
export default function useDeleteModel() {
|
|
const setDownloadedModels = useSetAtom(downloadedModelAtom)
|
|
|
|
const deleteModel = async (model: Model) => {
|
|
await pluginManager
|
|
.get<ModelPlugin>(PluginType.Model)
|
|
?.deleteModel(model._id)
|
|
|
|
// reload models
|
|
const downloadedModels = await getDownloadedModels()
|
|
setDownloadedModels(downloadedModels)
|
|
}
|
|
|
|
return { deleteModel }
|
|
}
|