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
65ac4ded
Commit
65ac4ded
authored
Feb 21, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: template transform code tooltip
parent
671654da
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
12 deletions
+30
-12
base.tsx
...omponents/workflow/nodes/_base/components/editor/base.tsx
+2
-2
code-editor.tsx
...ts/workflow/nodes/_base/components/editor/code-editor.tsx
+3
-0
panel.tsx
...pp/components/workflow/nodes/template-transform/panel.tsx
+14
-1
workflow.en.ts
web/i18n/lang/workflow.en.ts
+1
-0
workflow.zh.ts
web/i18n/lang/workflow.zh.ts
+10
-9
No files found.
web/app/components/workflow/nodes/_base/components/editor/base.tsx
View file @
65ac4ded
...
...
@@ -42,8 +42,8 @@ const Base: FC<Props> = ({
return
(
<
div
className=
{
cn
(
className
,
'rounded-lg border'
,
isFocus
?
'bg-white border-gray-200'
:
'bg-gray-100 border-gray-100'
)
}
>
<
div
className=
'flex justify-between items-center h-7 pt-1 pl-3 pr-1'
>
<
div
className=
''
>
{
title
}
</
div
>
<
div
className=
'flex'
>
<
div
className=
'
text-xs font-semibold text-gray-700
'
>
{
title
}
</
div
>
<
div
className=
'flex
items-center
'
>
{
headerRight
}
{
!
isCopied
?
(
...
...
web/app/components/workflow/nodes/_base/components/editor/code-editor.tsx
View file @
65ac4ded
...
...
@@ -7,12 +7,14 @@ type Props = {
value
:
string
onChange
:
(
value
:
string
)
=>
void
title
:
JSX
.
Element
headerRight
?:
JSX
.
Element
}
const
CodeEditor
:
FC
<
Props
>
=
({
value
,
onChange
,
title
,
headerRight
,
})
=>
{
const
[
isFocus
,
setIsFocus
]
=
React
.
useState
(
false
)
...
...
@@ -21,6 +23,7 @@ const CodeEditor: FC<Props> = ({
<
Base
title=
{
title
}
value=
{
value
}
headerRight=
{
headerRight
}
isFocus=
{
isFocus
}
minHeight=
{
86
}
>
...
...
web/app/components/workflow/nodes/template-transform/panel.tsx
View file @
65ac4ded
...
...
@@ -8,6 +8,7 @@ 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
OutputVars
,
{
VarItem
}
from
'@/app/components/workflow/nodes/_base/components/output-vars'
import
{
HelpCircle
}
from
'@/app/components/base/icons/src/vender/line/general'
const
i18nPrefix
=
'workflow.nodes.templateTransform'
...
...
@@ -38,7 +39,19 @@ const Panel: FC = () => {
<
Split
/>
<
CodeEditor
title=
{
<
div
>
{
t
(
`${i18nPrefix}.code`
)
}
</
div
>
<
div
className=
'uppercase'
>
{
t
(
`${i18nPrefix}.code`
)
}
</
div
>
}
headerRight=
{
<
div
className=
'flex items-center'
>
<
a
className=
'flex items-center space-x-0.5 h-[18px] text-xs font-normal text-gray-500'
href=
"https://jinja.palletsprojects.com/en/3.1.x/templates/"
target=
'_blank'
>
<
span
>
{
t
(
`${i18nPrefix}.codeSupportTip`
)
}
</
span
>
<
HelpCircle
className=
'w-3 h-3'
/>
</
a
>
<
div
className=
'mx-1.5 w-px h-3 bg-gray-200'
></
div
>
</
div
>
}
value=
{
inputs
.
template
}
onChange=
{
handleCodeChange
}
...
...
web/i18n/lang/workflow.en.ts
View file @
65ac4ded
...
...
@@ -25,6 +25,7 @@ const translation = {
templateTransform
:
{
inputVars
:
'Input Variables'
,
code
:
'Code'
,
codeSupportTip
:
'Only supports Jinja2'
,
outputVars
:
{
output
:
'Transformed content'
,
},
...
...
web/i18n/lang/workflow.zh.ts
View file @
65ac4ded
...
...
@@ -18,15 +18,16 @@ const translation = {
output
:
'生成内容'
,
usage
:
'模型用量信息'
,
},
code
:
{
inputVars
:
'输入变量'
,
},
templateTransform
:
{
inputVars
:
'输入变量'
,
code
:
'代码'
,
outputVars
:
{
output
:
'转换后内容'
,
},
},
code
:
{
inputVars
:
'输入变量'
,
},
templateTransform
:
{
inputVars
:
'输入变量'
,
code
:
'代码'
,
codeSupportTip
:
'只支持 Jinja2'
,
outputVars
:
{
output
:
'转换后内容'
,
},
},
},
...
...
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