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
bc90fc88
Commit
bc90fc88
authored
Mar 09, 2024
by
JzoNg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tracing node style update
parent
5afa5fb0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
10 deletions
+47
-10
node.tsx
web/app/components/workflow/run/node.tsx
+38
-8
result.tsx
web/app/components/workflow/run/result.tsx
+1
-1
tracing.tsx
web/app/components/workflow/run/tracing.tsx
+2
-1
workflow.ts
web/i18n/en-US/workflow.ts
+3
-0
workflow.ts
web/i18n/zh-Hans/workflow.ts
+3
-0
No files found.
web/app/components/workflow/run/node.tsx
View file @
bc90fc88
'use client'
import
{
useTranslation
}
from
'react-i18next'
import
type
{
FC
}
from
'react'
import
cn
from
'classnames'
import
BlockIcon
from
'../block-icon'
import
type
{
BlockEnum
}
from
'../types'
import
{
AlertTriangle
}
from
'@/app/components/base/icons/src/vender/line/alertsAndFeedback'
import
CodeEditor
from
'@/app/components/workflow/nodes/_base/components/editor/code-editor'
import
{
CodeLanguage
}
from
'@/app/components/workflow/nodes/code/types'
import
{
AlertCircle
,
AlertTriangle
}
from
'@/app/components/base/icons/src/vender/line/alertsAndFeedback'
import
{
CheckCircle
,
Loading02
}
from
'@/app/components/base/icons/src/vender/line/general'
import
{
ChevronRight
}
from
'@/app/components/base/icons/src/vender/line/arrows'
...
...
@@ -23,12 +26,15 @@ type Props = {
}
const
NodePanel
:
FC
<
Props
>
=
({
nodeInfo
,
collapsed
,
collapseHandle
})
=>
{
const
{
t
}
=
useTranslation
()
const
getTime
=
(
time
:
number
)
=>
{
if
(
time
<
1
)
return
`
${
time
*
1000
}
ms`
if
(
time
>
60
)
return
`
${
parseInt
(
Math
.
round
(
time
/
60
).
toString
())}
m
${(
time
%
60
).
toFixed
(
3
)}
s`
}
const
getTokenCount
=
(
tokens
:
number
)
=>
{
if
(
tokens
<
1000
)
return
tokens
...
...
@@ -37,14 +43,16 @@ const NodePanel: FC<Props> = ({ nodeInfo, collapsed, collapseHandle }) => {
if
(
tokens
>=
1000000
)
return
`
${
parseFloat
((
tokens
/
1000000
).
toFixed
(
3
))}
M`
}
return
(
<
div
className=
'px-4 py-1'
>
<
div
className=
'group transition-all bg-white border border-gray-100 rounded-2xl shadow-xs
cursor-pointer hover:shadow-md'
onClick=
{
collapseHandle
}
>
<
div
className=
'group transition-all bg-white border border-gray-100 rounded-2xl shadow-xs
hover:shadow-md'
>
<
div
className=
{
cn
(
'flex items-center pl-[6px] py-3 pr-3'
,
'flex items-center pl-[6px] py-3 pr-3
cursor-pointer
'
,
!
collapsed
&&
'pb-2'
,
)
}
onClick=
{
collapseHandle
}
>
<
ChevronRight
className=
{
cn
(
...
...
@@ -59,10 +67,10 @@ const NodePanel: FC<Props> = ({ nodeInfo, collapsed, collapseHandle }) => {
<
CheckCircle
className=
'shrink-0 ml-2 w-3.5 h-3.5 text-[#12B76A]'
/>
)
}
{
nodeInfo
.
status
===
'failed'
&&
(
<
Alert
Triangle
className=
'shrink-0 ml-2 w-3 h-3 text-[#F79009
]'
/>
<
Alert
Circle
className=
'shrink-0 ml-2 w-3.5 h-3.5 text-[#F04438
]'
/>
)
}
{
nodeInfo
.
status
===
'stopped'
&&
(
<
AlertTriangle
className=
'shrink-0 ml-2 w-3
h-3
text-[#F79009]'
/>
<
AlertTriangle
className=
'shrink-0 ml-2 w-3
.5 h-3.5
text-[#F79009]'
/>
)
}
{
nodeInfo
.
status
===
'running'
&&
(
<
div
className=
'shrink-0 text-primary-600 text-[13px] leading-[16px] font-medium'
>
...
...
@@ -73,12 +81,34 @@ const NodePanel: FC<Props> = ({ nodeInfo, collapsed, collapseHandle }) => {
</
div
>
{
!
collapsed
&&
(
<
div
className=
'pb-2'
>
{
/* TODO */
}
<
div
className=
'px-[10px] py-1'
>
<
div
className=
'p-3 bg-gray-50 rounded-lg h-[120px] text-gray-700'
>
INPUT
</
div
>
{
/* ###TODO### no data */
}
{
nodeInfo
.
status
===
'stopped'
&&
(
<
div
className=
'px-3 py-[10px] bg-[#fffaeb] rounded-lg border-[0.5px] border-[rbga(0,0,0,0.05)] text-xs leading-[18px] text-[#dc6803] shadow-xs'
>
{
t
(
'workflow.tracing.stopBy'
,
{
user
:
'Evan'
})
}
</
div
>
)
}
{
nodeInfo
.
status
===
'failed'
&&
(
<
div
className=
'px-3 py-[10px] bg-[#fef3f2] rounded-lg border-[0.5px] border-[rbga(0,0,0,0.05)] text-xs leading-[18px] text-[#d92d20] shadow-xs'
>
{
nodeInfo
.
error
}
</
div
>
)
}
</
div
>
<
div
className=
'px-[10px] py-1'
>
{
/* ###TODO### value */
}
<
CodeEditor
readOnly
title=
{
<
div
>
INPUT
</
div
>
}
language=
{
CodeLanguage
.
json
}
value=
{
''
}
onChange=
{
()
=>
{}
}
/>
</
div
>
<
div
className=
'px-[10px] py-1'
>
<
div
className=
'p-3 bg-gray-50 rounded-lg h-[120px] text-gray-700'
>
OUPUT
</
div
>
{
/* ###TODO### value */
}
<
CodeEditor
readOnly
title=
{
<
div
>
OUTPUT
</
div
>
}
language=
{
CodeLanguage
.
json
}
value=
{
''
}
onChange=
{
()
=>
{}
}
/>
</
div
>
</
div
>
)
}
...
...
web/app/components/workflow/run/result.tsx
View file @
bc90fc88
...
...
@@ -5,8 +5,8 @@ import StatusPanel from './status'
import
MetaData
from
'./meta'
import
Loading
from
'@/app/components/base/loading'
import
CodeEditor
from
'@/app/components/workflow/nodes/_base/components/editor/code-editor'
import
{
fetchRunDetail
}
from
'@/service/log'
import
{
CodeLanguage
}
from
'@/app/components/workflow/nodes/code/types'
import
{
fetchRunDetail
}
from
'@/service/log'
import
type
{
WorkflowRunDetailResponse
}
from
'@/models/log'
import
{
useStore
as
useAppStore
}
from
'@/app/components/app/store'
...
...
web/app/components/workflow/run/tracing.tsx
View file @
bc90fc88
...
...
@@ -15,7 +15,8 @@ const nodeInfoFake = {
title
:
'START'
,
time
:
67.349
,
tokens
:
2708
,
status
:
'succeeded'
,
status
:
'failed'
,
error
:
'lvlvlvlv'
,
}
const
Tracing
:
FC
<
TracingProps
>
=
({
runID
})
=>
{
...
...
web/i18n/en-US/workflow.ts
View file @
bc90fc88
...
...
@@ -256,6 +256,9 @@ const translation = {
instructionPlaceholder
:
'Write your instruction'
,
},
},
tracing
:
{
stopBy
:
'Stop by {{user}}'
,
},
}
export
default
translation
web/i18n/zh-Hans/workflow.ts
View file @
bc90fc88
...
...
@@ -256,6 +256,9 @@ const translation = {
instructionPlaceholder
:
'在这里输入你的指令'
,
},
},
tracing
:
{
stopBy
:
'由{{user}}终止'
,
},
}
export
default
translation
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