mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 01:48:04 +08:00
refactor: use bivariance to normalize node metadata types
This commit is contained in:
@ -24,7 +24,7 @@ const useResizablePanels = () => {
|
||||
const resolvedCodePanelHeight = useMemo(() => {
|
||||
if (!maxCodePanelHeight)
|
||||
return codePanelHeight
|
||||
// Reason: Clamp the panel height so the output area always has space.
|
||||
// Clamp the panel height so the output area always has space.
|
||||
return Math.min(codePanelHeight, maxCodePanelHeight)
|
||||
}, [codePanelHeight, maxCodePanelHeight])
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import type { NestedNodeConfig } from '@/app/components/workflow/nodes/_base/typ
|
||||
import type { CodeNodeType, OutputVar } from '@/app/components/workflow/nodes/code/types'
|
||||
import type { LLMNodeType } from '@/app/components/workflow/nodes/llm/types'
|
||||
import type {
|
||||
CommonNodeType,
|
||||
NodeDefaultBase,
|
||||
PromptItem,
|
||||
PromptTemplateItem,
|
||||
Node as WorkflowNode,
|
||||
@ -40,7 +40,7 @@ export const getDefaultOutputKey = (outputs?: OutputVar): string => {
|
||||
const keys = Object.keys(outputs)
|
||||
if (keys.length === 0)
|
||||
return ''
|
||||
// Reason: 'result' is the conventional default output key for code nodes
|
||||
// 'result' is the conventional default output key for code nodes
|
||||
if (keys.includes('result'))
|
||||
return 'result'
|
||||
return keys[0]
|
||||
@ -132,10 +132,7 @@ const buildPromptTemplateWithText = (
|
||||
return [...promptTemplate, defaultUserPrompt] as PromptTemplateItem[]
|
||||
}
|
||||
|
||||
type NodesMetaDataMap = Record<BlockEnum, {
|
||||
defaultValue?: Partial<LLMNodeType | CodeNodeType>
|
||||
checkValid?: (data: CommonNodeType, t: (key: string, options?: Record<string, unknown>) => string, moreData?: unknown) => { isValid: boolean, errorMessage?: string }
|
||||
}>
|
||||
type NodesMetaDataMap = Record<BlockEnum, Pick<NodeDefaultBase, 'defaultValue' | 'checkValid'>>
|
||||
|
||||
type ConfigsMap = {
|
||||
flowId?: string
|
||||
|
||||
Reference in New Issue
Block a user