mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
chore(web): new lint setup (#30020)
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import type { EntryNodeStatus } from '../trigger-status'
|
||||
import { act, renderHook } from '@testing-library/react'
|
||||
import { useTriggerStatusStore } from '../trigger-status'
|
||||
import type { EntryNodeStatus } from '../trigger-status'
|
||||
|
||||
describe('useTriggerStatusStore', () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from './workflow'
|
||||
export * from './trigger-status'
|
||||
export * from './workflow'
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import type { StateCreator } from 'zustand'
|
||||
import { produce } from 'immer'
|
||||
import type { NodeWithVar, VarInInspect } from '@/types/workflow'
|
||||
import type { ValueSelector } from '../../../types'
|
||||
import type { NodeWithVar, VarInInspect } from '@/types/workflow'
|
||||
import { produce } from 'immer'
|
||||
|
||||
type InspectVarsState = {
|
||||
currentFocusNodeId: string | null
|
||||
@ -79,8 +79,7 @@ export const createInspectVarsSlice: StateCreator<InspectVarsSliceShape> = (set)
|
||||
return
|
||||
targetVar.value = value
|
||||
targetVar.edited = true
|
||||
},
|
||||
)
|
||||
})
|
||||
return {
|
||||
nodesWithInspectVars: nodes,
|
||||
}
|
||||
@ -97,8 +96,7 @@ export const createInspectVarsSlice: StateCreator<InspectVarsSliceShape> = (set)
|
||||
return
|
||||
targetVar.value = value
|
||||
targetVar.edited = false
|
||||
},
|
||||
)
|
||||
})
|
||||
return {
|
||||
nodesWithInspectVars: nodes,
|
||||
}
|
||||
@ -115,8 +113,7 @@ export const createInspectVarsSlice: StateCreator<InspectVarsSliceShape> = (set)
|
||||
return
|
||||
targetVar.name = selector[1]
|
||||
targetVar.selector = selector
|
||||
},
|
||||
)
|
||||
})
|
||||
return {
|
||||
nodesWithInspectVars: nodes,
|
||||
}
|
||||
@ -131,8 +128,7 @@ export const createInspectVarsSlice: StateCreator<InspectVarsSliceShape> = (set)
|
||||
const needChangeVarIndex = targetNode.vars.findIndex(varItem => varItem.id === varId)
|
||||
if (needChangeVarIndex !== -1)
|
||||
targetNode.vars.splice(needChangeVarIndex, 1)
|
||||
},
|
||||
)
|
||||
})
|
||||
return {
|
||||
nodesWithInspectVars: nodes,
|
||||
}
|
||||
|
||||
@ -1,61 +1,61 @@
|
||||
import { useContext } from 'react'
|
||||
import type {
|
||||
StateCreator,
|
||||
} from 'zustand'
|
||||
import type { ChatVariableSliceShape } from './chat-variable-slice'
|
||||
import type { InspectVarsSliceShape } from './debug/inspect-vars-slice'
|
||||
import type { EnvVariableSliceShape } from './env-variable-slice'
|
||||
import type { FormSliceShape } from './form-slice'
|
||||
import type { HelpLineSliceShape } from './help-line-slice'
|
||||
import type { HistorySliceShape } from './history-slice'
|
||||
import type { LayoutSliceShape } from './layout-slice'
|
||||
import type { NodeSliceShape } from './node-slice'
|
||||
import type { PanelSliceShape } from './panel-slice'
|
||||
import type { ToolSliceShape } from './tool-slice'
|
||||
import type { VersionSliceShape } from './version-slice'
|
||||
import type { WorkflowDraftSliceShape } from './workflow-draft-slice'
|
||||
import type { WorkflowSliceShape } from './workflow-slice'
|
||||
import type { RagPipelineSliceShape } from '@/app/components/rag-pipeline/store'
|
||||
import type { WorkflowSliceShape as WorkflowAppSliceShape } from '@/app/components/workflow-app/store/workflow/workflow-slice'
|
||||
import { useContext } from 'react'
|
||||
import {
|
||||
useStore as useZustandStore,
|
||||
} from 'zustand'
|
||||
import { createStore } from 'zustand/vanilla'
|
||||
import type { ChatVariableSliceShape } from './chat-variable-slice'
|
||||
import { createChatVariableSlice } from './chat-variable-slice'
|
||||
import type { EnvVariableSliceShape } from './env-variable-slice'
|
||||
import { createEnvVariableSlice } from './env-variable-slice'
|
||||
import type { FormSliceShape } from './form-slice'
|
||||
import { createFormSlice } from './form-slice'
|
||||
import type { HelpLineSliceShape } from './help-line-slice'
|
||||
import { createHelpLineSlice } from './help-line-slice'
|
||||
import type { HistorySliceShape } from './history-slice'
|
||||
import { createHistorySlice } from './history-slice'
|
||||
import type { NodeSliceShape } from './node-slice'
|
||||
import { createNodeSlice } from './node-slice'
|
||||
import type { PanelSliceShape } from './panel-slice'
|
||||
import { createPanelSlice } from './panel-slice'
|
||||
import type { ToolSliceShape } from './tool-slice'
|
||||
import { createToolSlice } from './tool-slice'
|
||||
import type { VersionSliceShape } from './version-slice'
|
||||
import { createVersionSlice } from './version-slice'
|
||||
import type { WorkflowDraftSliceShape } from './workflow-draft-slice'
|
||||
import { createWorkflowDraftSlice } from './workflow-draft-slice'
|
||||
import type { WorkflowSliceShape } from './workflow-slice'
|
||||
import { createWorkflowSlice } from './workflow-slice'
|
||||
import type { InspectVarsSliceShape } from './debug/inspect-vars-slice'
|
||||
import { createInspectVarsSlice } from './debug/inspect-vars-slice'
|
||||
|
||||
import { WorkflowContext } from '@/app/components/workflow/context'
|
||||
import type { LayoutSliceShape } from './layout-slice'
|
||||
import { createChatVariableSlice } from './chat-variable-slice'
|
||||
import { createInspectVarsSlice } from './debug/inspect-vars-slice'
|
||||
import { createEnvVariableSlice } from './env-variable-slice'
|
||||
import { createFormSlice } from './form-slice'
|
||||
import { createHelpLineSlice } from './help-line-slice'
|
||||
import { createHistorySlice } from './history-slice'
|
||||
import { createLayoutSlice } from './layout-slice'
|
||||
import type { WorkflowSliceShape as WorkflowAppSliceShape } from '@/app/components/workflow-app/store/workflow/workflow-slice'
|
||||
import type { RagPipelineSliceShape } from '@/app/components/rag-pipeline/store'
|
||||
import { createNodeSlice } from './node-slice'
|
||||
|
||||
import { createPanelSlice } from './panel-slice'
|
||||
import { createToolSlice } from './tool-slice'
|
||||
import { createVersionSlice } from './version-slice'
|
||||
import { createWorkflowDraftSlice } from './workflow-draft-slice'
|
||||
import { createWorkflowSlice } from './workflow-slice'
|
||||
|
||||
export type SliceFromInjection
|
||||
= Partial<WorkflowAppSliceShape>
|
||||
& Partial<RagPipelineSliceShape>
|
||||
& Partial<RagPipelineSliceShape>
|
||||
|
||||
export type Shape
|
||||
= ChatVariableSliceShape
|
||||
& EnvVariableSliceShape
|
||||
& FormSliceShape
|
||||
& HelpLineSliceShape
|
||||
& HistorySliceShape
|
||||
& NodeSliceShape
|
||||
& PanelSliceShape
|
||||
& ToolSliceShape
|
||||
& VersionSliceShape
|
||||
& WorkflowDraftSliceShape
|
||||
& WorkflowSliceShape
|
||||
& InspectVarsSliceShape
|
||||
& LayoutSliceShape
|
||||
& SliceFromInjection
|
||||
& EnvVariableSliceShape
|
||||
& FormSliceShape
|
||||
& HelpLineSliceShape
|
||||
& HistorySliceShape
|
||||
& NodeSliceShape
|
||||
& PanelSliceShape
|
||||
& ToolSliceShape
|
||||
& VersionSliceShape
|
||||
& WorkflowDraftSliceShape
|
||||
& WorkflowSliceShape
|
||||
& InspectVarsSliceShape
|
||||
& LayoutSliceShape
|
||||
& SliceFromInjection
|
||||
|
||||
export type InjectWorkflowStoreSliceFn = StateCreator<SliceFromInjection>
|
||||
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import type { StateCreator } from 'zustand'
|
||||
import type {
|
||||
Node,
|
||||
} from '@/app/components/workflow/types'
|
||||
import type {
|
||||
VariableAssignerNodeType,
|
||||
} from '@/app/components/workflow/nodes/variable-assigner/types'
|
||||
import type {
|
||||
Node,
|
||||
} from '@/app/components/workflow/types'
|
||||
import type {
|
||||
NodeTracing,
|
||||
} from '@/types/workflow'
|
||||
@ -35,7 +35,7 @@ export type NodeSliceShape = {
|
||||
setShowAssignVariablePopup: (showAssignVariablePopup: NodeSliceShape['showAssignVariablePopup']) => void
|
||||
hoveringAssignVariableGroupId?: string
|
||||
setHoveringAssignVariableGroupId: (hoveringAssignVariableGroupId?: string) => void
|
||||
connectingNodePayload?: { nodeId: string; nodeType: string; handleType: string; handleId: string | null }
|
||||
connectingNodePayload?: { nodeId: string, nodeType: string, handleType: string, handleId: string | null }
|
||||
setConnectingNodePayload: (startConnectingPayload?: NodeSliceShape['connectingNodePayload']) => void
|
||||
enteringNodePayload?: {
|
||||
nodeId: string
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import type { StateCreator } from 'zustand'
|
||||
import { debounce } from 'lodash-es'
|
||||
import type { Viewport } from 'reactflow'
|
||||
import type { StateCreator } from 'zustand'
|
||||
import type {
|
||||
Edge,
|
||||
EnvironmentVariable,
|
||||
Node,
|
||||
} from '@/app/components/workflow/types'
|
||||
import { debounce } from 'lodash-es'
|
||||
|
||||
export type WorkflowDraftSliceShape = {
|
||||
backupDraft?: {
|
||||
|
||||
@ -26,15 +26,15 @@ export type WorkflowSliceShape = {
|
||||
setListeningTriggerIsAll: (isAll: boolean) => void
|
||||
clipboardElements: Node[]
|
||||
setClipboardElements: (clipboardElements: Node[]) => void
|
||||
selection: null | { x1: number; y1: number; x2: number; y2: number }
|
||||
selection: null | { x1: number, y1: number, x2: number, y2: number }
|
||||
setSelection: (selection: WorkflowSliceShape['selection']) => void
|
||||
bundleNodeSize: { width: number; height: number } | null
|
||||
bundleNodeSize: { width: number, height: number } | null
|
||||
setBundleNodeSize: (bundleNodeSize: WorkflowSliceShape['bundleNodeSize']) => void
|
||||
controlMode: 'pointer' | 'hand'
|
||||
setControlMode: (controlMode: WorkflowSliceShape['controlMode']) => void
|
||||
mousePosition: { pageX: number; pageY: number; elementX: number; elementY: number }
|
||||
mousePosition: { pageX: number, pageY: number, elementX: number, elementY: number }
|
||||
setMousePosition: (mousePosition: WorkflowSliceShape['mousePosition']) => void
|
||||
showConfirm?: { title: string; desc?: string; onConfirm: () => void }
|
||||
showConfirm?: { title: string, desc?: string, onConfirm: () => void }
|
||||
setShowConfirm: (showConfirm: WorkflowSliceShape['showConfirm']) => void
|
||||
controlPromptEditorRerenderKey: number
|
||||
setControlPromptEditorRerenderKey: (controlPromptEditorRerenderKey: number) => void
|
||||
|
||||
Reference in New Issue
Block a user