Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

568 B
Raw Blame
import { atom } from 'jotai'
import { documentCanWriteAtom } from './runtime'

export const documentUploadingAtom = atom(false)

export function documentUploadAvailability(canWrite: boolean, uploadAvailable: boolean) {
  return {
    canUpload: canWrite && uploadAvailable,
    restrictionReasonId: uploadAvailable
      ? canWrite
        ? undefined
        : 'documents-readonly-reason'
      : 'documents-upload-unavailable',
  }
}

export const documentReadOnlyReasonIdAtom = atom((get) =>
  get(documentCanWriteAtom) ? undefined : 'documents-readonly-reason',
)