* chore: update core services and module export * Correct version of plugins (#374) Co-authored-by: Hien To <tominhhien97@gmail.com> * janhq/jan: Update tag build 1.0.2 for data-plugin * janhq/jan: Update tag build 1.0.2 for inference-plugin * janhq/jan: Update tag build 1.0.2 for model-management-plugin * janhq/jan: Update tag build 1.0.2 for monitoring-plugin * janhq/jan: Update tag build 1.0.2 for openai-plugin * chore: update web to use @janhq/core module --------- Co-authored-by: hiento09 <136591877+hiento09@users.noreply.github.com> Co-authored-by: Hien To <tominhhien97@gmail.com> Co-authored-by: Service Account <service@jan.ai>
22 lines
820 B
TypeScript
22 lines
820 B
TypeScript
import { execute, executeSerial } from "@/_services/pluginService";
|
|
import { ModelManagementService } from "@janhq/core";
|
|
import { useSetAtom } from "jotai";
|
|
import { downloadedModelAtom } from "@/_helpers/atoms/DownloadedModel.atom";
|
|
import { getDownloadedModels } from "./useGetDownloadedModels";
|
|
import { AssistantModel } from "@/_models/AssistantModel";
|
|
|
|
export default function useDeleteModel() {
|
|
const setDownloadedModels = useSetAtom(downloadedModelAtom);
|
|
|
|
const deleteModel = async (model: AssistantModel) => {
|
|
execute(ModelManagementService.DeleteDownloadModel, model._id);
|
|
await executeSerial(ModelManagementService.DeleteModel, model._id);
|
|
|
|
// reload models
|
|
const downloadedModels = await getDownloadedModels();
|
|
setDownloadedModels(downloadedModels);
|
|
};
|
|
|
|
return { deleteModel };
|
|
}
|