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.

707 B
Raw Blame
import { create } from 'zustand'

type AppUpdateDownload = {
  isDownloading: boolean
  downloadProgress: number
  downloadedBytes: number
  totalBytes: number
}

type AppUpdateDownloadState = AppUpdateDownload & {
  update: (partial: Partial<AppUpdateDownload>) => void
}

// App-update download progress, fed by the AppEvent download events.
// DownloadManagement is mounted in the sidebar or the header depending on
// whether the sidebar is open, so per-instance state was lost on every toggle.
export const useAppUpdateDownload = create<AppUpdateDownloadState>()((set) => ({
  isDownloading: false,
  downloadProgress: 0,
  downloadedBytes: 0,
  totalBytes: 0,
  update: (partial) => set(partial),
}))