Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

chore: update navigate, can delete default thread after finish setup screen

Faisal Amir43313a5d24e8
diff --git a/web-app/src/containers/DownloadManegement.tsx b/web-app/src/containers/DownloadManegement.tsx
index ff0a54ad3..1e60715e1 100644
--- a/web-app/src/containers/DownloadManegement.tsx
+++ b/web-app/src/containers/DownloadManegement.tsx
@@ -361,7 +361,7 @@ export function DownloadManagement() {
<>
<Popover open={isPopoverOpen} onOpenChange={setIsPopoverOpen}>
<PopoverTrigger asChild>
- <Button variant="ghost" size="icon" className="text-muted-foreground relative z-50 rounded-full hover:bg-sidebar-foreground/8! -mt-0.5 size-7 relative">
+ <Button variant="ghost" size="icon" className="text-muted-foreground z-50 rounded-full hover:bg-sidebar-foreground/8! -mt-0.5 size-7 relative">
<DownloadIcon className='text-muted-foreground size-4' />
{downloadCount > 0 && (
<svg className="absolute inset-0 size-7 -rotate-90" viewBox="0 0 36 36">
diff --git a/web-app/src/containers/SetupScreen.tsx b/web-app/src/containers/SetupScreen.tsx
index 954430cef..81cb285ac 100644
--- a/web-app/src/containers/SetupScreen.tsx
+++ b/web-app/src/containers/SetupScreen.tsx
@@ -773,21 +773,22 @@ function SetupScreen() {
localStorage.setItem(localStorageKey.setupCompleted, 'true')
// Navigate to default thread if it exists, otherwise to home
- if (defaultThreadIdRef.current) {
+ const threadId = defaultThreadIdRef.current
+ let threadExists = false
+
+ if (threadId) {
+ try {
+ const threads = await serviceHub.threads().fetchThreads()
+ threadExists = threads.some((t) => t.id === threadId)
+ } catch {
+ threadExists = false
+ }
+ }
+
+ if (threadId && threadExists) {
navigate({
to: route.threadsDetail,
- params: { threadId: defaultThreadIdRef.current },
- search: {
- threadModel: {
- id: defaultVariant.model_id,
- provider: 'llamacpp',
- },
- },
- replace: true,
- })
- } else {
- navigate({
- to: route.home,
+ params: { threadId },
search: {
threadModel: {
id: defaultVariant.model_id,
diff --git a/web-app/src/containers/ThreadList.tsx b/web-app/src/containers/ThreadList.tsx
index 40d7ed6ab..d15700270 100644
--- a/web-app/src/containers/ThreadList.tsx
+++ b/web-app/src/containers/ThreadList.tsx
@@ -227,8 +227,11 @@ const ThreadItem = memo(
<DropdownMenuSeparator />
<DropdownMenuItem
variant="destructive"
- onSelect={() => {
- setDeleteConfirmOpen(true)
+ disabled={thread.title === 'What is Jan?' && !localStorage.getItem('setup-completed')}
+ onSelect={(e) => {
+ if (thread.title !== 'What is Jan?' || localStorage.getItem('setup-completed')) {
+ setDeleteConfirmOpen(true)
+ }
}}
>
<Trash2 className="size-4" />