mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 01:48:04 +08:00
chore(web): new lint setup (#30020)
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
This commit is contained in:
@ -1,20 +1,21 @@
|
||||
import type { FC } from 'react'
|
||||
import type { CodeNodeType } from './types'
|
||||
import type { NodePanelProps } from '@/app/components/workflow/types'
|
||||
import React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import RemoveEffectVarConfirm from '../_base/components/remove-effect-var-confirm'
|
||||
import useConfig from './use-config'
|
||||
import type { CodeNodeType } from './types'
|
||||
import { CodeLanguage } from './types'
|
||||
import { extractFunctionParams, extractReturnType } from './code-parser'
|
||||
import VarList from '@/app/components/workflow/nodes/_base/components/variable/var-list'
|
||||
import OutputVarList from '@/app/components/workflow/nodes/_base/components/variable/output-var-list'
|
||||
import AddButton from '@/app/components/base/button/add-button'
|
||||
import Field from '@/app/components/workflow/nodes/_base/components/field'
|
||||
import Split from '@/app/components/workflow/nodes/_base/components/split'
|
||||
import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor'
|
||||
import TypeSelector from '@/app/components/workflow/nodes/_base/components/selector'
|
||||
import type { NodePanelProps } from '@/app/components/workflow/types'
|
||||
import SyncButton from '@/app/components/base/button/sync-button'
|
||||
import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor'
|
||||
import Field from '@/app/components/workflow/nodes/_base/components/field'
|
||||
import TypeSelector from '@/app/components/workflow/nodes/_base/components/selector'
|
||||
import Split from '@/app/components/workflow/nodes/_base/components/split'
|
||||
import OutputVarList from '@/app/components/workflow/nodes/_base/components/variable/output-var-list'
|
||||
import VarList from '@/app/components/workflow/nodes/_base/components/variable/var-list'
|
||||
import RemoveEffectVarConfirm from '../_base/components/remove-effect-var-confirm'
|
||||
import { extractFunctionParams, extractReturnType } from './code-parser'
|
||||
import { CodeLanguage } from './types'
|
||||
import useConfig from './use-config'
|
||||
|
||||
const i18nPrefix = 'workflow.nodes.code'
|
||||
|
||||
const codeLanguages = [
|
||||
@ -65,17 +66,19 @@ const Panel: FC<NodePanelProps<CodeNodeType>> = ({
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='mt-2'>
|
||||
<div className='space-y-4 px-4 pb-4'>
|
||||
<div className="mt-2">
|
||||
<div className="space-y-4 px-4 pb-4">
|
||||
<Field
|
||||
title={t(`${i18nPrefix}.inputVars`)}
|
||||
operations={
|
||||
!readOnly ? (
|
||||
<div className="flex gap-2">
|
||||
<SyncButton popupContent={t(`${i18nPrefix}.syncFunctionSignature`)} onClick={handleSyncFunctionSignature} />
|
||||
<AddButton onClick={handleAddVariable} />
|
||||
</div>
|
||||
) : undefined
|
||||
!readOnly
|
||||
? (
|
||||
<div className="flex gap-2">
|
||||
<SyncButton popupContent={t(`${i18nPrefix}.syncFunctionSignature`)} onClick={handleSyncFunctionSignature} />
|
||||
<AddButton onClick={handleAddVariable} />
|
||||
</div>
|
||||
)
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<VarList
|
||||
@ -92,13 +95,13 @@ const Panel: FC<NodePanelProps<CodeNodeType>> = ({
|
||||
nodeId={id}
|
||||
isInNode
|
||||
readOnly={readOnly}
|
||||
title={
|
||||
title={(
|
||||
<TypeSelector
|
||||
options={codeLanguages}
|
||||
value={inputs.code_language}
|
||||
onChange={handleCodeLanguageChange}
|
||||
/>
|
||||
}
|
||||
)}
|
||||
language={inputs.code_language}
|
||||
value={inputs.code}
|
||||
onChange={handleCodeChange}
|
||||
@ -107,7 +110,7 @@ const Panel: FC<NodePanelProps<CodeNodeType>> = ({
|
||||
/>
|
||||
</div>
|
||||
<Split />
|
||||
<div className='px-4 pb-2 pt-4'>
|
||||
<div className="px-4 pb-2 pt-4">
|
||||
<Field
|
||||
title={t(`${i18nPrefix}.outputVars`)}
|
||||
operations={
|
||||
@ -129,7 +132,7 @@ const Panel: FC<NodePanelProps<CodeNodeType>> = ({
|
||||
onCancel={hideRemoveVarConfirm}
|
||||
onConfirm={onRemoveVarConfirm}
|
||||
/>
|
||||
</div >
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user