mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-23 09:46:53 +08:00
Fix variable typo (#8084)
This commit is contained in:
@@ -79,7 +79,7 @@ const CustomEdge = ({
|
||||
id={id}
|
||||
path={edgePath}
|
||||
style={{
|
||||
stroke: (selected || data?._connectedNodeIsHovering || data?._runned) ? '#2970FF' : '#D0D5DD',
|
||||
stroke: (selected || data?._connectedNodeIsHovering || data?._run) ? '#2970FF' : '#D0D5DD',
|
||||
strokeWidth: 2,
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
} from '@/app/components/base/icons/src/vender/line/time'
|
||||
import { AlertTriangle } from '@/app/components/base/icons/src/vender/line/alertsAndFeedback'
|
||||
import {
|
||||
fetcChatRunHistory,
|
||||
fetchChatRunHistory,
|
||||
fetchWorkflowRunHistory,
|
||||
} from '@/service/workflow'
|
||||
import Loading from '@/app/components/base/loading'
|
||||
@@ -67,7 +67,7 @@ const ViewHistory = ({
|
||||
const historyWorkflowData = useStore(s => s.historyWorkflowData)
|
||||
const { handleBackupDraft } = useWorkflowRun()
|
||||
const { data: runList, isLoading: runListLoading } = useSWR((appDetail && !isChatMode && open) ? `/apps/${appDetail.id}/workflow-runs` : null, fetchWorkflowRunHistory)
|
||||
const { data: chatList, isLoading: chatListLoading } = useSWR((appDetail && isChatMode && open) ? `/apps/${appDetail.id}/advanced-chat/workflow-runs` : null, fetcChatRunHistory)
|
||||
const { data: chatList, isLoading: chatListLoading } = useSWR((appDetail && isChatMode && open) ? `/apps/${appDetail.id}/advanced-chat/workflow-runs` : null, fetchChatRunHistory)
|
||||
|
||||
const data = isChatMode ? chatList : runList
|
||||
const isLoading = isChatMode ? chatListLoading : runListLoading
|
||||
|
||||
@@ -155,7 +155,7 @@ export const useEdgesInteractions = () => {
|
||||
|
||||
const newEdges = produce(edges, (draft) => {
|
||||
draft.forEach((edge) => {
|
||||
edge.data._runned = false
|
||||
edge.data._run = false
|
||||
})
|
||||
})
|
||||
setEdges(newEdges)
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
CUSTOM_NODE, DSL_EXPORT_CHECK,
|
||||
WORKFLOW_DATA_UPDATE,
|
||||
} from '../constants'
|
||||
import type { Node, WorkflowDataUpdator } from '../types'
|
||||
import type { Node, WorkflowDataUpdater } from '../types'
|
||||
import { ControlMode } from '../types'
|
||||
import {
|
||||
getLayoutByDagre,
|
||||
@@ -208,7 +208,7 @@ export const useWorkflowUpdate = () => {
|
||||
const workflowStore = useWorkflowStore()
|
||||
const { eventEmitter } = useEventEmitterContextContext()
|
||||
|
||||
const handleUpdateWorkflowCanvas = useCallback((payload: WorkflowDataUpdator) => {
|
||||
const handleUpdateWorkflowCanvas = useCallback((payload: WorkflowDataUpdater) => {
|
||||
const {
|
||||
nodes,
|
||||
edges,
|
||||
@@ -236,7 +236,7 @@ export const useWorkflowUpdate = () => {
|
||||
} = workflowStore.getState()
|
||||
setIsSyncingWorkflowDraft(true)
|
||||
fetchWorkflowDraft(`/apps/${appId}/workflows/draft`).then((response) => {
|
||||
handleUpdateWorkflowCanvas(response.graph as WorkflowDataUpdator)
|
||||
handleUpdateWorkflowCanvas(response.graph as WorkflowDataUpdater)
|
||||
setSyncWorkflowDraftHash(response.hash)
|
||||
setEnvSecrets((response.environment_variables || []).filter(env => env.value_type === 'secret').reduce((acc, env) => {
|
||||
acc[env.id] = env.value
|
||||
|
||||
@@ -186,7 +186,7 @@ export const useWorkflowRun = () => {
|
||||
draft.forEach((edge) => {
|
||||
edge.data = {
|
||||
...edge.data,
|
||||
_runned: false,
|
||||
_run: false,
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -292,7 +292,7 @@ export const useWorkflowRun = () => {
|
||||
const edge = draft.find(edge => edge.target === data.node_id && edge.source === prevNodeId)
|
||||
|
||||
if (edge)
|
||||
edge.data = { ...edge.data, _runned: true } as any
|
||||
edge.data = { ...edge.data, _run: true } as any
|
||||
})
|
||||
setEdges(newEdges)
|
||||
}
|
||||
@@ -398,7 +398,7 @@ export const useWorkflowRun = () => {
|
||||
const edge = draft.find(edge => edge.target === data.node_id && edge.source === prevNodeId)
|
||||
|
||||
if (edge)
|
||||
edge.data = { ...edge.data, _runned: true } as any
|
||||
edge.data = { ...edge.data, _run: true } as any
|
||||
})
|
||||
setEdges(newEdges)
|
||||
|
||||
|
||||
@@ -20,14 +20,14 @@ const Line = ({
|
||||
d='M0,18 L24,18'
|
||||
strokeWidth={1}
|
||||
fill='none'
|
||||
className='stroke-divider-soild'
|
||||
className='stroke-divider-solid'
|
||||
/>
|
||||
<rect
|
||||
x={0}
|
||||
y={16}
|
||||
width={1}
|
||||
height={4}
|
||||
className='fill-divider-soild-alt'
|
||||
className='fill-divider-solid-alt'
|
||||
/>
|
||||
</>
|
||||
)
|
||||
@@ -38,7 +38,7 @@ const Line = ({
|
||||
d={`M0,18 Q12,18 12,28 L12,${index * 48 + 18 - 10} Q12,${index * 48 + 18} 24,${index * 48 + 18}`}
|
||||
strokeWidth={1}
|
||||
fill='none'
|
||||
className='stroke-divider-soild'
|
||||
className='stroke-divider-solid'
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -47,7 +47,7 @@ const Line = ({
|
||||
y={index * 48 + 18 - 2}
|
||||
width={1}
|
||||
height={4}
|
||||
className='fill-divider-soild-alt'
|
||||
className='fill-divider-solid-alt'
|
||||
/>
|
||||
</g>
|
||||
))
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
useState,
|
||||
} from 'react'
|
||||
|
||||
export type UseResizePanelPrarams = {
|
||||
export type UseResizePanelParams = {
|
||||
direction?: 'horizontal' | 'vertical' | 'both'
|
||||
triggerDirection?: 'top' | 'right' | 'bottom' | 'left' | 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'
|
||||
minWidth?: number
|
||||
@@ -15,7 +15,7 @@ export type UseResizePanelPrarams = {
|
||||
onResized?: (width: number, height: number) => void
|
||||
onResize?: (width: number, height: number) => void
|
||||
}
|
||||
export const useResizePanel = (params?: UseResizePanelPrarams) => {
|
||||
export const useResizePanel = (params?: UseResizePanelParams) => {
|
||||
const {
|
||||
direction = 'both',
|
||||
triggerDirection = 'bottom-right',
|
||||
|
||||
@@ -44,7 +44,7 @@ const nodeDefault: NodeDefault<LLMNodeType> = {
|
||||
|
||||
if (!errorMessages && !payload.memory) {
|
||||
const isChatModel = payload.model.mode === 'chat'
|
||||
const isPromptyEmpty = isChatModel
|
||||
const isPromptEmpty = isChatModel
|
||||
? !(payload.prompt_template as PromptItem[]).some((t) => {
|
||||
if (t.edition_type === EditionType.jinja2)
|
||||
return t.jinja2_text !== ''
|
||||
@@ -52,7 +52,7 @@ const nodeDefault: NodeDefault<LLMNodeType> = {
|
||||
return t.text !== ''
|
||||
})
|
||||
: ((payload.prompt_template as PromptItem).edition_type === EditionType.jinja2 ? (payload.prompt_template as PromptItem).jinja2_text === '' : (payload.prompt_template as PromptItem).text === '')
|
||||
if (isPromptyEmpty)
|
||||
if (isPromptEmpty)
|
||||
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t('workflow.nodes.llm.prompt') })
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { memo, useCallback } from 'react'
|
||||
import type { WorkflowDataUpdator } from '../types'
|
||||
import type { WorkflowDataUpdater } from '../types'
|
||||
import Run from '../run'
|
||||
import { useStore } from '../store'
|
||||
import { useWorkflowUpdate } from '../hooks'
|
||||
@@ -9,7 +9,7 @@ const Record = () => {
|
||||
const { handleUpdateWorkflowCanvas } = useWorkflowUpdate()
|
||||
|
||||
const handleResultCallback = useCallback((res: any) => {
|
||||
const graph: WorkflowDataUpdator = res.graph
|
||||
const graph: WorkflowDataUpdater = res.graph
|
||||
handleUpdateWorkflowCanvas({
|
||||
nodes: graph.nodes,
|
||||
edges: graph.edges,
|
||||
|
||||
@@ -134,12 +134,12 @@ const RunPanel: FC<RunProps> = ({ hideResult, activeTab = 'RESULT', runID, getRe
|
||||
getData(appDetail.id, runID)
|
||||
}, [appDetail, runID])
|
||||
|
||||
const [height, setHieght] = useState(0)
|
||||
const [height, setHeight] = useState(0)
|
||||
const ref = useRef<HTMLDivElement>(null)
|
||||
|
||||
const adjustResultHeight = () => {
|
||||
if (ref.current)
|
||||
setHieght(ref.current?.clientHeight - 16 - 16 - 2 - 1)
|
||||
setHeight(ref.current?.clientHeight - 16 - 16 - 2 - 1)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
@@ -197,7 +197,7 @@ const RunPanel: FC<RunProps> = ({ hideResult, activeTab = 'RESULT', runID, getRe
|
||||
onClick={() => switchTab('TRACING')}
|
||||
>{t('runLog.tracing')}</div>
|
||||
</div>
|
||||
{/* panel detal */}
|
||||
{/* panel detail */}
|
||||
<div ref={ref} className={cn('grow bg-white h-0 overflow-y-auto rounded-b-2xl', currentTab !== 'DETAIL' && '!bg-gray-50')}>
|
||||
{loading && (
|
||||
<div className='flex h-full items-center justify-center bg-white'>
|
||||
|
||||
@@ -69,7 +69,7 @@ export type CommonEdgeType = {
|
||||
_hovering?: boolean
|
||||
_connectedNodeIsHovering?: boolean
|
||||
_connectedNodeIsSelected?: boolean
|
||||
_runned?: boolean
|
||||
_run?: boolean
|
||||
_isBundled?: boolean
|
||||
isInIteration?: boolean
|
||||
iteration_id?: string
|
||||
@@ -86,7 +86,7 @@ export type NodePanelProps<T> = {
|
||||
}
|
||||
export type Edge = ReactFlowEdge<CommonEdgeType>
|
||||
|
||||
export type WorkflowDataUpdator = {
|
||||
export type WorkflowDataUpdater = {
|
||||
nodes: Node[]
|
||||
edges: Edge[]
|
||||
viewport: Viewport
|
||||
|
||||
@@ -34,18 +34,18 @@ const WHITE = 'WHITE'
|
||||
const GRAY = 'GRAY'
|
||||
const BLACK = 'BLACK'
|
||||
|
||||
const isCyclicUtil = (nodeId: string, color: Record<string, string>, adjaList: Record<string, string[]>, stack: string[]) => {
|
||||
const isCyclicUtil = (nodeId: string, color: Record<string, string>, adjList: Record<string, string[]>, stack: string[]) => {
|
||||
color[nodeId] = GRAY
|
||||
stack.push(nodeId)
|
||||
|
||||
for (let i = 0; i < adjaList[nodeId].length; ++i) {
|
||||
const childId = adjaList[nodeId][i]
|
||||
for (let i = 0; i < adjList[nodeId].length; ++i) {
|
||||
const childId = adjList[nodeId][i]
|
||||
|
||||
if (color[childId] === GRAY) {
|
||||
stack.push(childId)
|
||||
return true
|
||||
}
|
||||
if (color[childId] === WHITE && isCyclicUtil(childId, color, adjaList, stack))
|
||||
if (color[childId] === WHITE && isCyclicUtil(childId, color, adjList, stack))
|
||||
return true
|
||||
}
|
||||
color[nodeId] = BLACK
|
||||
@@ -55,21 +55,21 @@ const isCyclicUtil = (nodeId: string, color: Record<string, string>, adjaList: R
|
||||
}
|
||||
|
||||
const getCycleEdges = (nodes: Node[], edges: Edge[]) => {
|
||||
const adjaList: Record<string, string[]> = {}
|
||||
const adjList: Record<string, string[]> = {}
|
||||
const color: Record<string, string> = {}
|
||||
const stack: string[] = []
|
||||
|
||||
for (const node of nodes) {
|
||||
color[node.id] = WHITE
|
||||
adjaList[node.id] = []
|
||||
adjList[node.id] = []
|
||||
}
|
||||
|
||||
for (const edge of edges)
|
||||
adjaList[edge.source]?.push(edge.target)
|
||||
adjList[edge.source]?.push(edge.target)
|
||||
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
if (color[nodes[i].id] === WHITE)
|
||||
isCyclicUtil(nodes[i].id, color, adjaList, stack)
|
||||
isCyclicUtil(nodes[i].id, color, adjList, stack)
|
||||
}
|
||||
|
||||
const cycleEdges = []
|
||||
|
||||
Reference in New Issue
Block a user