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.

657 B
Raw Blame
'use client'

import type { EventEmitter } from 'ahooks/lib/useEventEmitter'
import { createContext, useContext } from 'use-context-selector'

/**
 * Typed event object emitted via the shared EventEmitter.
 * Covers workflow updates, prompt-editor commands, DSL export checks, etc.
 */
type EventEmitterMessage = {
  type: string
  payload?: unknown
  instanceId?: string
}

export type EventEmitterValue = string | EventEmitterMessage

export const EventEmitterContext = createContext<{
  eventEmitter: EventEmitter<EventEmitterValue> | null
}>({
  eventEmitter: null,
})

export const useEventEmitterContextContext = () => useContext(EventEmitterContext)