* feat: setting toggle vulkan * feat: add vulkan toggle setting * chore: default flash attention disable * chore: fix vulkan retrieval * fix: vulkan setting does not affect engine run * Update web-app/src/routes/settings/hardware.tsx Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --------- Co-authored-by: Louis <louis@jan.ai> Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
35 lines
761 B
TypeScript
35 lines
761 B
TypeScript
import { create } from 'zustand'
|
|
import { persist, createJSONStorage } from 'zustand/middleware'
|
|
import { localStorageKey } from '@/constants/localStorage'
|
|
|
|
interface VulkanStore {
|
|
// Vulkan state
|
|
vulkanEnabled: boolean
|
|
|
|
// Update functions
|
|
setVulkanEnabled: (enabled: boolean) => void
|
|
toggleVulkan: () => void
|
|
}
|
|
|
|
export const useVulkan = create<VulkanStore>()(
|
|
persist(
|
|
(set) => ({
|
|
vulkanEnabled: false,
|
|
|
|
setVulkanEnabled: (enabled) =>
|
|
set({
|
|
vulkanEnabled: enabled,
|
|
}),
|
|
|
|
toggleVulkan: () =>
|
|
set((state) => ({
|
|
vulkanEnabled: !state.vulkanEnabled,
|
|
})),
|
|
}),
|
|
{
|
|
name: localStorageKey.settingVulkan,
|
|
storage: createJSONStorage(() => localStorage),
|
|
}
|
|
)
|
|
)
|