diff --git a/app/src/components/ServerSettings/ModelManagement.tsx b/app/src/components/ServerSettings/ModelManagement.tsx
index bcc944b2..9811f643 100644
--- a/app/src/components/ServerSettings/ModelManagement.tsx
+++ b/app/src/components/ServerSettings/ModelManagement.tsx
@@ -13,6 +13,7 @@ import {
RotateCcw,
Scale,
Trash2,
+ Unplug,
X,
} from 'lucide-react';
import { useCallback, useMemo, useState } from 'react';
@@ -300,6 +301,27 @@ export function ModelManagement() {
},
});
+ const unloadMutation = useMutation({
+ mutationFn: async (modelName: string) => {
+ return await apiClient.unloadModel(modelName);
+ },
+ onSuccess: async (_data, modelName) => {
+ toast({
+ title: 'Model unloaded',
+ description: `${modelName} has been unloaded from memory.`,
+ });
+ await queryClient.invalidateQueries({ queryKey: ['modelStatus'], refetchType: 'all' });
+ await queryClient.refetchQueries({ queryKey: ['modelStatus'] });
+ },
+ onError: (error: Error) => {
+ toast({
+ title: 'Unload failed',
+ description: error.message,
+ variant: 'destructive',
+ });
+ },
+ });
+
const formatSize = (sizeMb?: number): string => {
if (!sizeMb) return 'Unknown size';
if (sizeMb < 1024) return `${sizeMb.toFixed(1)} MB`;
@@ -697,26 +719,46 @@ export function ModelManagement() {
>
) : freshSelectedModel.downloaded ? (
-
+
+ {freshSelectedModel.loaded && (
+
+ )}
+
+
) : (