diff --git a/ui/app/providers/page.tsx b/ui/app/providers/page.tsx
index 0e2d393f..2f377011 100644
--- a/ui/app/providers/page.tsx
+++ b/ui/app/providers/page.tsx
@@ -488,6 +488,25 @@ export default function ProvidersPage() {
},
});
+ const deleteModelMutation = useMutation({
+ mutationFn: ({
+ providerId,
+ modelId,
+ }: {
+ providerId: number;
+ modelId: string;
+ }) => AdminService.deleteProviderModel(providerId, modelId),
+ onSuccess: (_, variables) => {
+ queryClient.invalidateQueries({
+ queryKey: ['provider-models', variables.providerId],
+ });
+ toast.success('Model deleted successfully');
+ },
+ onError: (error: Error) => {
+ toast.error(`Failed to delete model: ${error.message}`);
+ },
+ });
+
const handleCreateAccount = async () => {
setIsCreatingAccount(true);
try {
@@ -566,6 +585,12 @@ export default function ProvidersPage() {
}
};
+ const handleDeleteModel = (providerId: number, modelId: string) => {
+ if (confirm('Are you sure you want to delete this model?')) {
+ deleteModelMutation.mutate({ providerId, modelId });
+ }
+ };
+
const getDefaultBaseUrl = (type: string) => {
const providerType = providerTypes.find((pt) => pt.id === type);
return providerType?.default_base_url || '';
@@ -1068,6 +1093,22 @@ export default function ProvidersPage() {
>
+
))}