Skip to content

Commit 6ac16cb

Browse files
committed
Add removal confirmation to Model Hub for Installed Models
1 parent 6cfeff7 commit 6ac16cb

3 files changed

Lines changed: 54 additions & 5 deletions

File tree

CHANGES.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,9 @@
100100
- Some changes with how configurations for notes directory and neo4j are saved and retrieved (Uses PouchDB instead of a file now)
101101
- Adjust the Similarity Thresholds for Smart Hubs to be more acceptable (Low: 0.5, Medium: 0.65, High: 0.8, Highest: 0.9)
102102
- Removed Knowledge Graph for Smart Hubs until further notice, I'm going to rework it and make sure it is polished before releasing it again
103-
- Fix notice under Default Prompts for File Attachments Prompt and set the placeholder to [FILE_ATTACHMENTS] rather than [DOCUMENTS_ATTACHED]
103+
- Fix notice under Default Prompts for File Attachments Prompt and set the placeholder to [FILE_ATTACHMENTS] rather than [DOCUMENTS_ATTACHED]
104+
105+
## 0.3.0
106+
107+
- Complete implementation of Knowledge Graph using Neo4j for Smart Hub document retrieval
108+
- Add removal confirmation to Model Hub for Installed Models

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "notebit",
33
"description": "Notebit is a cross-platform desktop note-taking application built with Electron, React, and TypeScript.",
4-
"version": "0.2.1",
4+
"version": "0.3.0",
55
"author": {
66
"email": "mikeymooney1991@gmail.com",
77
"name": "Michael Mooney"
@@ -80,6 +80,7 @@
8080
"eventsource-parser": "^3.0.1",
8181
"highlight.js": "^11.11.1",
8282
"jotai": "^2.12.3",
83+
"jsonrepair": "^3.12.0",
8384
"katex": "^0.16.22",
8485
"level": "^10.0.0",
8586
"loadash": "^1.0.0",

src/web/features/model-hub/components/ModelCard.tsx

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ import {
3535
SelectValue,
3636
} from '@/components/ui/select';
3737
import { Progress } from '@/components/ui/progress';
38+
import {
39+
AlertDialog,
40+
AlertDialogAction,
41+
AlertDialogCancel,
42+
AlertDialogContent,
43+
AlertDialogDescription,
44+
AlertDialogFooter,
45+
AlertDialogHeader,
46+
AlertDialogTitle,
47+
} from '@/components/ui/alert-dialog';
3848

3949
// Types
4050
import { ModelInfo } from '@shared/types/ai';
@@ -341,7 +351,7 @@ export const AvailableModelCardComponent: React.FC<ModelCardProps> = ({
341351
variant="default"
342352
size="sm"
343353
onClick={handlePullModel}
344-
disabled={isPulling || model.installed === true}
354+
disabled={isPulling || model.installed}
345355
className="w-full"
346356
>
347357
<Download className="h-4 w-4 mr-2" />
@@ -353,7 +363,7 @@ export const AvailableModelCardComponent: React.FC<ModelCardProps> = ({
353363
<p>
354364
{isPulling
355365
? 'Cancel the current download'
356-
: model.installed === true
366+
: model.installed
357367
? 'This model is already installed'
358368
: 'Download and install this model to your local Ollama'}
359369
</p>
@@ -375,9 +385,15 @@ export const InstalledModelCardComponent: React.FC<ModelCardProps> = ({
375385
model,
376386
}) => {
377387
const isDeleting = modelHubState$.deletingModels[model.id]?.get() || false;
388+
const [showDeleteDialog, setShowDeleteDialog] = useState(false);
378389

379390
const handleDeleteModel = async () => {
380391
await deleteModel(model.id);
392+
setShowDeleteDialog(false);
393+
};
394+
395+
const openDeleteDialog = () => {
396+
setShowDeleteDialog(true);
381397
};
382398

383399
return (
@@ -427,7 +443,7 @@ export const InstalledModelCardComponent: React.FC<ModelCardProps> = ({
427443
<Button
428444
variant="destructive"
429445
size="sm"
430-
onClick={handleDeleteModel}
446+
onClick={openDeleteDialog}
431447
disabled={isDeleting}
432448
className="w-full"
433449
>
@@ -446,6 +462,33 @@ export const InstalledModelCardComponent: React.FC<ModelCardProps> = ({
446462
</TooltipContent>
447463
</Tooltip>
448464
</TooltipProvider>
465+
466+
{/* Delete Confirmation Dialog */}
467+
<AlertDialog
468+
open={showDeleteDialog}
469+
onOpenChange={setShowDeleteDialog}
470+
>
471+
<AlertDialogContent>
472+
<AlertDialogHeader>
473+
<AlertDialogTitle>Remove Model</AlertDialogTitle>
474+
<AlertDialogDescription>
475+
Are you sure you want to remove the model "{model.name}"? This
476+
action cannot be undone.
477+
</AlertDialogDescription>
478+
</AlertDialogHeader>
479+
<AlertDialogFooter>
480+
<AlertDialogCancel onClick={() => setShowDeleteDialog(false)}>
481+
Cancel
482+
</AlertDialogCancel>
483+
<AlertDialogAction
484+
onClick={handleDeleteModel}
485+
className="bg-red-500 hover:bg-red-600"
486+
>
487+
Remove
488+
</AlertDialogAction>
489+
</AlertDialogFooter>
490+
</AlertDialogContent>
491+
</AlertDialog>
449492
</div>
450493
</CardFooter>
451494
</Card>

0 commit comments

Comments
 (0)