* fix: reduce the number of api call Signed-off-by: James <james@jan.ai> * fix: download progress Signed-off-by: James <james@jan.ai> * chore: save blob * fix: server boot up * fix: download state not updating Signed-off-by: James <james@jan.ai> * fix: copy assets * Add Dockerfile CPU for Jan Server and Jan Web * Add Dockerfile GPU for Jan Server and Jan Web * feat: S3 adapter * Update check find count from ./pre-install and correct copy:asserts command * server add bundleDependencies @janhq/core * server add bundleDependencies @janhq/core * fix: update success/failed download state (#1945) * fix: update success/failed download state Signed-off-by: James <james@jan.ai> * fix: download model progress and state handling for both Desktop and Web --------- Signed-off-by: James <james@jan.ai> Co-authored-by: James <james@jan.ai> Co-authored-by: Louis <louis@jan.ai> * chore: refactor * fix: load models empty first time open * Add Docker compose * fix: assistants onUpdate --------- Signed-off-by: James <james@jan.ai> Co-authored-by: James <james@jan.ai> Co-authored-by: Hien To <tominhhien97@gmail.com> Co-authored-by: NamH <NamNh0122@gmail.com>
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import { Model } from '@janhq/core'
|
|
import { atom } from 'jotai'
|
|
|
|
export const stateModel = atom({ state: 'start', loading: false, model: '' })
|
|
export const activeAssistantModelAtom = atom<Model | undefined>(undefined)
|
|
|
|
/**
|
|
* Stores the list of models which are being downloaded.
|
|
*/
|
|
const downloadingModelsAtom = atom<Model[]>([])
|
|
|
|
export const getDownloadingModelAtom = atom((get) => get(downloadingModelsAtom))
|
|
|
|
export const addDownloadingModelAtom = atom(null, (get, set, model: Model) => {
|
|
const downloadingModels = get(downloadingModelsAtom)
|
|
if (!downloadingModels.find((e) => e.id === model.id)) {
|
|
set(downloadingModelsAtom, [...downloadingModels, model])
|
|
}
|
|
})
|
|
|
|
export const removeDownloadingModelAtom = atom(
|
|
null,
|
|
(get, set, modelId: string) => {
|
|
const downloadingModels = get(downloadingModelsAtom)
|
|
|
|
set(
|
|
downloadingModelsAtom,
|
|
downloadingModels.filter((e) => e.id !== modelId)
|
|
)
|
|
}
|
|
)
|
|
|
|
export const downloadedModelsAtom = atom<Model[]>([])
|
|
|
|
export const configuredModelsAtom = atom<Model[]>([])
|