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.

681 B
Raw Blame
'use client'

import type { InputVar } from '@/models/pipeline'
import { create } from 'zustand'

type SnippetDraftState = {
  snippetId?: string
  inputFields: InputVar[]
  hydrateDraft: (payload: { snippetId: string; inputFields: InputVar[] }) => void
  setInputFields: (inputFields: InputVar[]) => void
  reset: () => void
}

const initialState = {
  snippetId: undefined,
  inputFields: [] as InputVar[],
}

export const useSnippetDraftStore = create<SnippetDraftState>((set) => ({
  ...initialState,
  hydrateDraft: ({ snippetId, inputFields }) => set({ snippetId, inputFields }),
  setInputFields: (inputFields) => set({ inputFields }),
  reset: () => set(initialState),
}))