mirror of https://github.com/langgenius/dify.git
feat: code node can run
This commit is contained in:
parent
c74854aec0
commit
d0f5318b75
|
|
@ -79,12 +79,11 @@ const BeforeRunForm: FC<BeforeRunFormProps> = ({
|
|||
</div>
|
||||
|
||||
{isFinished && (
|
||||
<div className='px-4'>
|
||||
<>
|
||||
{result}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,9 @@ const useOneStepRun = <T>({ id, data, defaultRunInputData, isInvalid = () => tru
|
|||
})
|
||||
return false
|
||||
}
|
||||
setRunResult(res)
|
||||
finally {
|
||||
setRunResult(res)
|
||||
}
|
||||
handleNodeDataUpdate({
|
||||
id,
|
||||
data: {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/
|
|||
import TypeSelector from '@/app/components/workflow/nodes/_base/components/selector'
|
||||
import type { NodePanelProps } from '@/app/components/workflow/types'
|
||||
import BeforeRunForm from '@/app/components/workflow/nodes/_base/components/before-run-form'
|
||||
|
||||
import ResultPanel from '@/app/components/workflow/run/result-panel'
|
||||
const i18nPrefix = 'workflow.nodes.code'
|
||||
|
||||
const codeLanguages = [
|
||||
|
|
@ -113,7 +113,7 @@ const Panel: FC<NodePanelProps<CodeNodeType>> = ({
|
|||
runningStatus={runningStatus}
|
||||
onRun={handleRun}
|
||||
onStop={handleStop}
|
||||
result={<span className='text-gray-900'>{JSON.stringify(runResult, null, 2)}</span>}
|
||||
result={<ResultPanel {...runResult} showSteps={false} />}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -43,12 +43,22 @@ const useConfig = (id: string, payload: CodeNodeType) => {
|
|||
handleStop,
|
||||
runInputData,
|
||||
setRunInputData,
|
||||
runResult,
|
||||
runResult: unformattedRunResult,
|
||||
} = useOneStepRun<CodeNodeType>({
|
||||
id,
|
||||
data: inputs,
|
||||
defaultRunInputData: {},
|
||||
})
|
||||
|
||||
const runResult = (() => {
|
||||
if (!unformattedRunResult)
|
||||
return {}
|
||||
|
||||
return {
|
||||
...unformattedRunResult,
|
||||
created_by: unformattedRunResult.created_by_account?.name || '',
|
||||
}
|
||||
})()
|
||||
const varInputs = toVarInputs(inputs.variables)
|
||||
|
||||
const inputVarValues = (() => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue