mirror of
https://github.com/langgenius/dify.git
synced 2026-07-25 05:28:35 +08:00
18 lines
501 B
TypeScript
18 lines
501 B
TypeScript
import type { SearchResult } from '@/app/components/goto-anything/actions/types'
|
|
|
|
type SearchWorkflowNodes = (query: string) => SearchResult[]
|
|
|
|
let searchWorkflowNodes: SearchWorkflowNodes | undefined
|
|
|
|
export function registerWorkflowNodeSearch(search: SearchWorkflowNodes) {
|
|
searchWorkflowNodes = search
|
|
|
|
return () => {
|
|
if (searchWorkflowNodes === search) searchWorkflowNodes = undefined
|
|
}
|
|
}
|
|
|
|
export function findWorkflowNodes(query: string) {
|
|
return searchWorkflowNodes?.(query) ?? []
|
|
}
|