Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
8a906e29
Commit
8a906e29
authored
Mar 06, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: http nodes update error and support json
parent
9839b5cb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
4 deletions
+11
-4
index.tsx
...kflow/nodes/_base/components/editor/code-editor/index.tsx
+8
-1
panel.tsx
web/app/components/workflow/nodes/code/panel.tsx
+0
-1
types.ts
web/app/components/workflow/nodes/code/types.ts
+1
-0
index.tsx
...onents/workflow/nodes/http/components/edit-body/index.tsx
+2
-2
No files found.
web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx
View file @
8a906e29
...
@@ -15,6 +15,12 @@ type Props = {
...
@@ -15,6 +15,12 @@ type Props = {
readOnly
?:
boolean
readOnly
?:
boolean
}
}
const
languageMap
=
{
[
CodeLanguage
.
javascript
]:
'javascript'
,
[
CodeLanguage
.
python3
]:
'python'
,
[
CodeLanguage
.
json
]:
'json'
,
}
const
CodeEditor
:
FC
<
Props
>
=
({
const
CodeEditor
:
FC
<
Props
>
=
({
value
,
value
,
onChange
,
onChange
,
...
@@ -70,7 +76,8 @@ const CodeEditor: FC<Props> = ({
...
@@ -70,7 +76,8 @@ const CodeEditor: FC<Props> = ({
{
/* https://www.npmjs.com/package/@monaco-editor/react */
}
{
/* https://www.npmjs.com/package/@monaco-editor/react */
}
<
Editor
<
Editor
className=
'h-full'
className=
'h-full'
defaultLanguage=
{
language
===
CodeLanguage
.
javascript
?
'javascript'
:
'python'
}
// language={language === CodeLanguage.javascript ? 'javascript' : 'python'}
language=
{
languageMap
[
language
]
||
'javascript'
}
theme=
{
isFocus
?
'focus-theme'
:
'blur-theme'
}
theme=
{
isFocus
?
'focus-theme'
:
'blur-theme'
}
value=
{
value
}
value=
{
value
}
onChange=
{
handleEditorChange
}
onChange=
{
handleEditorChange
}
...
...
web/app/components/workflow/nodes/code/panel.tsx
View file @
8a906e29
...
@@ -57,7 +57,6 @@ const Panel: FC<NodePanelProps<CodeNodeType>> = ({
...
@@ -57,7 +57,6 @@ const Panel: FC<NodePanelProps<CodeNodeType>> = ({
/>
/>
</
Field
>
</
Field
>
<
Split
/>
<
Split
/>
{
inputs
.
code_language
}
<
CodeEditor
<
CodeEditor
readOnly=
{
readOnly
}
readOnly=
{
readOnly
}
title=
{
title=
{
...
...
web/app/components/workflow/nodes/code/types.ts
View file @
8a906e29
...
@@ -3,6 +3,7 @@ import type { CommonNodeType, Variable } from '@/app/components/workflow/types'
...
@@ -3,6 +3,7 @@ import type { CommonNodeType, Variable } from '@/app/components/workflow/types'
export
enum
CodeLanguage
{
export
enum
CodeLanguage
{
python3
=
'python3'
,
python3
=
'python3'
,
javascript
=
'javascript'
,
javascript
=
'javascript'
,
json
=
'json'
,
}
}
export
type
OutputVar
=
{
export
type
OutputVar
=
{
...
...
web/app/components/workflow/nodes/http/components/edit-body/index.tsx
View file @
8a906e29
...
@@ -73,7 +73,7 @@ const EditBody: FC<Props> = ({
...
@@ -73,7 +73,7 @@ const EditBody: FC<Props> = ({
})
})
onChange
(
newBody
)
onChange
(
newBody
)
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line react-hooks/exhaustive-deps
},
[
body
,
isCurrentKeyValue
])
},
[
isCurrentKeyValue
])
const
handleBodyValueChange
=
useCallback
((
value
:
string
)
=>
{
const
handleBodyValueChange
=
useCallback
((
value
:
string
)
=>
{
const
newBody
=
produce
(
payload
,
(
draft
:
Body
)
=>
{
const
newBody
=
produce
(
payload
,
(
draft
:
Body
)
=>
{
...
@@ -127,7 +127,7 @@ const EditBody: FC<Props> = ({
...
@@ -127,7 +127,7 @@ const EditBody: FC<Props> = ({
readOnly=
{
readonly
}
readOnly=
{
readonly
}
title=
{
<
div
className=
'uppercase'
>
JSON
</
div
>
}
title=
{
<
div
className=
'uppercase'
>
JSON
</
div
>
}
value=
{
payload
.
data
}
onChange=
{
handleBodyValueChange
}
value=
{
payload
.
data
}
onChange=
{
handleBodyValueChange
}
language=
{
CodeLanguage
.
j
avascript
}
language=
{
CodeLanguage
.
j
son
}
/>
/>
)
}
)
}
</
div
>
</
div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment