fix: new thread isn't automatically created on factory reset
This commit is contained in:
parent
643c7276b5
commit
432477341c
@ -4,9 +4,15 @@ import { atomWithStorage } from 'jotai/utils'
|
|||||||
|
|
||||||
export const assistantsAtom = atom<Assistant[]>([])
|
export const assistantsAtom = atom<Assistant[]>([])
|
||||||
|
|
||||||
|
export const cachedAssistantAtom = atomWithStorage<
|
||||||
|
ThreadAssistantInfo | undefined
|
||||||
|
>('activeAssistant', undefined, undefined, { getOnInit: true })
|
||||||
/**
|
/**
|
||||||
* Get the current active assistant
|
* Get the current active assistant
|
||||||
*/
|
*/
|
||||||
export const activeAssistantAtom = atomWithStorage<
|
export const activeAssistantAtom = atom(
|
||||||
ThreadAssistantInfo | undefined
|
(get) => get(cachedAssistantAtom) ?? get(assistantsAtom)[0],
|
||||||
>('activeAssistant', undefined, undefined, { getOnInit: true })
|
(_get, set, newAssistant: ThreadAssistantInfo) => {
|
||||||
|
set(cachedAssistantAtom, newAssistant)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user