Files
dify/web/features/knowledge-fs-availability/state.ts
T
fd2db63184 feat: KnowledgeFS and New Knowledge (#44165)
Co-authored-by: Jyong <76649700+JohnJyong@users.noreply.github.com>
Co-authored-by: hjlarry <hjlarry@163.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: zhaohao1004 <zhaohao1004@gmail.com>
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
Co-authored-by: FFXN <lizy@dify.ai>
2026-10-23 03:34:59 +00:00

21 lines
767 B
TypeScript

'use client'
import { atom } from 'jotai'
import { atomWithQuery } from 'jotai-tanstack-query'
import { knowledgeFsFeaturesQueryOptions } from './client'
const knowledgeFsFeaturesQueryAtom = atomWithQuery(() => knowledgeFsFeaturesQueryOptions())
// Every surface stays unavailable until the authenticated query resolves, and after it fails.
const knowledgeFsFeaturesAtom = atom((get) => get(knowledgeFsFeaturesQueryAtom).data)
export const knowledgeFsEnabledAtom = atom((get) => get(knowledgeFsFeaturesAtom)?.enabled ?? false)
export const knowledgeFsUploadEnabledAtom = atom(
(get) => get(knowledgeFsFeaturesAtom)?.upload_enabled ?? false,
)
export const agentKnowledgeFsEnabledAtom = atom(
(get) => get(knowledgeFsFeaturesAtom)?.agent_enabled ?? false,
)