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.

725 B
Raw Blame
'use client'

import type { ReactNode } from 'react'
import type { AgentSoulConfigFormState } from './form-state'
import { ScopeProvider } from 'jotai-scope'
import { defaultAgentSoulConfigFormState } from './form-state'
import { agentComposerDraftAtom, agentComposerSavedDraftAtom } from './store'

export function AgentComposerProvider({
  children,
  initialDraft,
}: {
  children: ReactNode
  initialDraft?: AgentSoulConfigFormState
}) {
  const draft = initialDraft ?? defaultAgentSoulConfigFormState

  return (
    <ScopeProvider
      atoms={[
        [agentComposerDraftAtom, draft],
        [agentComposerSavedDraftAtom, draft],
      ]}
      name="AgentComposer"
    >
      {children}
    </ScopeProvider>
  )
}