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
6448d71c
Commit
6448d71c
authored
Mar 06, 2024
by
StyleZhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
draft updated at
parent
e3a3e07e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
70 additions
and
4 deletions
+70
-4
index.tsx
web/app/components/workflow/header/index.tsx
+12
-0
index.tsx
web/app/components/workflow/index.tsx
+5
-0
default.ts
web/app/components/workflow/nodes/if-else/default.ts
+2
-2
node.tsx
web/app/components/workflow/nodes/if-else/node.tsx
+2
-2
store.ts
web/app/components/workflow/store.ts
+4
-0
workflow.ts
web/i18n/en-US/workflow.ts
+22
-0
workflow.ts
web/i18n/zh-Hans/workflow.ts
+22
-0
workflow.ts
web/types/workflow.ts
+1
-0
No files found.
web/app/components/workflow/header/index.tsx
View file @
6448d71c
...
@@ -3,6 +3,7 @@ import {
...
@@ -3,6 +3,7 @@ import {
memo
,
memo
,
useCallback
,
useCallback
,
}
from
'react'
}
from
'react'
import
dayjs
from
'dayjs'
import
{
useStore
}
from
'../store'
import
{
useStore
}
from
'../store'
import
RunAndHistory
from
'./run-and-history'
import
RunAndHistory
from
'./run-and-history'
import
Publish
from
'./publish'
import
Publish
from
'./publish'
...
@@ -17,6 +18,7 @@ const Header: FC = () => {
...
@@ -17,6 +18,7 @@ const Header: FC = () => {
const
setShowFeaturesPanel
=
useStore
(
state
=>
state
.
setShowFeaturesPanel
)
const
setShowFeaturesPanel
=
useStore
(
state
=>
state
.
setShowFeaturesPanel
)
const
runStaus
=
useStore
(
state
=>
state
.
runStaus
)
const
runStaus
=
useStore
(
state
=>
state
.
runStaus
)
const
setRunStaus
=
useStore
(
state
=>
state
.
setRunStaus
)
const
setRunStaus
=
useStore
(
state
=>
state
.
setRunStaus
)
const
draftUpdatedAt
=
useStore
(
state
=>
state
.
draftUpdatedAt
)
const
handleShowFeatures
=
useCallback
(()
=>
{
const
handleShowFeatures
=
useCallback
(()
=>
{
setShowFeaturesPanel
(
true
)
setShowFeaturesPanel
(
true
)
...
@@ -35,6 +37,16 @@ const Header: FC = () => {
...
@@ -35,6 +37,16 @@ const Header: FC = () => {
<
div
className=
'flex items-center text-xs text-gray-500'
>
<
div
className=
'flex items-center text-xs text-gray-500'
>
<
Edit03
className=
'mr-1 w-3 h-3 text-gray-400'
/>
<
Edit03
className=
'mr-1 w-3 h-3 text-gray-400'
/>
Editing
Editing
{
draftUpdatedAt
&&
(
<>
<
span
className=
'flex items-center mx-1'
>
·
</
span
>
<
span
>
Auto-Saved
{
dayjs
(
draftUpdatedAt
).
format
(
'HH:mm:ss'
)
}
</
span
>
</>
)
}
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
web/app/components/workflow/index.tsx
View file @
6448d71c
...
@@ -136,6 +136,11 @@ const WorkflowWrap: FC<WorkflowProps> = ({
...
@@ -136,6 +136,11 @@ const WorkflowWrap: FC<WorkflowProps> = ({
const
{
data
,
isLoading
,
error
}
=
useSWR
(
appDetail
?.
id
?
`/apps/
${
appDetail
.
id
}
/workflows/draft`
:
null
,
fetchWorkflowDraft
)
const
{
data
,
isLoading
,
error
}
=
useSWR
(
appDetail
?.
id
?
`/apps/
${
appDetail
.
id
}
/workflows/draft`
:
null
,
fetchWorkflowDraft
)
const
nodesInitialData
=
useNodesInitialData
()
const
nodesInitialData
=
useNodesInitialData
()
useEffect
(()
=>
{
if
(
data
)
useStore
.
setState
({
draftUpdatedAt
:
data
.
updated_at
})
},
[
data
])
const
startNode
=
{
const
startNode
=
{
id
:
`
${
Date
.
now
()}
`
,
id
:
`
${
Date
.
now
()}
`
,
type
:
'custom'
,
type
:
'custom'
,
...
...
web/app/components/workflow/nodes/if-else/default.ts
View file @
6448d71c
...
@@ -5,11 +5,11 @@ const nodeDefault: NodeDefault<IfElseNodeType> = {
...
@@ -5,11 +5,11 @@ const nodeDefault: NodeDefault<IfElseNodeType> = {
defaultValue
:
{
defaultValue
:
{
_targetBranches
:
[
_targetBranches
:
[
{
{
id
:
'
if-
true'
,
id
:
'true'
,
name
:
'IS TRUE'
,
name
:
'IS TRUE'
,
},
},
{
{
id
:
'
if-
false'
,
id
:
'false'
,
name
:
'IS FALSE'
,
name
:
'IS FALSE'
,
},
},
],
],
...
...
web/app/components/workflow/nodes/if-else/node.tsx
View file @
6448d71c
...
@@ -19,7 +19,7 @@ const IfElseNode: FC<NodeProps<IfElseNodeType>> = (props) => {
...
@@ -19,7 +19,7 @@ const IfElseNode: FC<NodeProps<IfElseNodeType>> = (props) => {
<
div
className=
'w-full text-right text-gray-700 text-xs font-semibold'
>
IF
</
div
>
<
div
className=
'w-full text-right text-gray-700 text-xs font-semibold'
>
IF
</
div
>
<
NodeSourceHandle
<
NodeSourceHandle
{
...
props
}
{
...
props
}
handleId=
'
if-
true'
handleId=
'true'
handleClassName=
'!top-1 !-right-[21px]'
handleClassName=
'!top-1 !-right-[21px]'
/>
/>
</
div
>
</
div
>
...
@@ -43,7 +43,7 @@ const IfElseNode: FC<NodeProps<IfElseNodeType>> = (props) => {
...
@@ -43,7 +43,7 @@ const IfElseNode: FC<NodeProps<IfElseNodeType>> = (props) => {
<
div
className=
'w-full text-right text-gray-700 text-xs font-semibold'
>
ELSE
</
div
>
<
div
className=
'w-full text-right text-gray-700 text-xs font-semibold'
>
ELSE
</
div
>
<
NodeSourceHandle
<
NodeSourceHandle
{
...
props
}
{
...
props
}
handleId=
'
if-
false'
handleId=
'false'
handleClassName=
'!top-1 !-right-[21px]'
handleClassName=
'!top-1 !-right-[21px]'
/>
/>
</
div
>
</
div
>
...
...
web/app/components/workflow/store.ts
View file @
6448d71c
...
@@ -15,6 +15,7 @@ type State = {
...
@@ -15,6 +15,7 @@ type State = {
helpLine
?:
HelpLinePosition
helpLine
?:
HelpLinePosition
toolsets
:
CollectionWithExpanded
[]
toolsets
:
CollectionWithExpanded
[]
toolsMap
:
ToolsMap
toolsMap
:
ToolsMap
draftUpdatedAt
:
number
}
}
type
Action
=
{
type
Action
=
{
...
@@ -25,6 +26,7 @@ type Action = {
...
@@ -25,6 +26,7 @@ type Action = {
setHelpLine
:
(
helpLine
?:
HelpLinePosition
)
=>
void
setHelpLine
:
(
helpLine
?:
HelpLinePosition
)
=>
void
setToolsets
:
(
toolsets
:
CollectionWithExpanded
[])
=>
void
setToolsets
:
(
toolsets
:
CollectionWithExpanded
[])
=>
void
setToolsMap
:
(
toolsMap
:
Record
<
string
,
ToolInWorkflow
[]
>
)
=>
void
setToolsMap
:
(
toolsMap
:
Record
<
string
,
ToolInWorkflow
[]
>
)
=>
void
setDraftUpdatedAt
:
(
draftUpdatedAt
:
number
)
=>
void
}
}
export
const
useStore
=
create
<
State
&
Action
>
(
set
=>
({
export
const
useStore
=
create
<
State
&
Action
>
(
set
=>
({
...
@@ -43,4 +45,6 @@ export const useStore = create<State & Action>(set => ({
...
@@ -43,4 +45,6 @@ export const useStore = create<State & Action>(set => ({
setToolsets
:
toolsets
=>
set
(()
=>
({
toolsets
})),
setToolsets
:
toolsets
=>
set
(()
=>
({
toolsets
})),
toolsMap
:
{},
toolsMap
:
{},
setToolsMap
:
toolsMap
=>
set
(()
=>
({
toolsMap
})),
setToolsMap
:
toolsMap
=>
set
(()
=>
({
toolsMap
})),
draftUpdatedAt
:
0
,
setDraftUpdatedAt
:
draftUpdatedAt
=>
set
(()
=>
({
draftUpdatedAt
})),
}))
}))
web/i18n/en-US/workflow.ts
View file @
6448d71c
const
translation
=
{
const
translation
=
{
common
:
{
editing
:
'Editing'
,
autoSaved
:
'Auto-Saved'
,
unpublished
:
'Unpublished'
,
published
:
'Published'
,
publish
:
'Publish'
,
run
:
'Run'
,
inRunMode
:
'In Run Mode'
,
inPreview
:
'In Preview'
,
inPreviewMode
:
'In Preview Mode'
,
preview
:
'Preview'
,
viewRunHistory
:
'View run history'
,
runHistory
:
'Run History'
,
goBackToEdit
:
'Go back to editor'
,
conversationLog
:
'Conversation Log'
,
features
:
'Features'
,
debugAndPreview
:
'Debug and Preview'
,
restart
:
'Restart'
,
currentDraft
:
'Current Draft'
,
latestPublished
:
'Latest Published'
,
restore
:
'Restore'
,
},
tabs
:
{
tabs
:
{
blocks
:
'Blocks'
,
blocks
:
'Blocks'
,
builtInTool
:
'Built-in Tool'
,
builtInTool
:
'Built-in Tool'
,
...
...
web/i18n/zh-Hans/workflow.ts
View file @
6448d71c
const
translation
=
{
const
translation
=
{
common
:
{
editing
:
'编辑中'
,
autoSaved
:
'自动保存'
,
unpublished
:
'未发布'
,
published
:
'已发布'
,
publish
:
'发布'
,
run
:
'运行'
,
inRunMode
:
'运行中'
,
inPreview
:
'预览中'
,
inPreviewMode
:
'预览中'
,
preview
:
'预览'
,
viewRunHistory
:
'查看运行历史'
,
runHistory
:
'运行历史'
,
goBackToEdit
:
'返回编辑模式'
,
conversationLog
:
'对话记录'
,
features
:
'功能'
,
debugAndPreview
:
'调试和预览'
,
restart
:
'重新开始'
,
currentDraft
:
'当前草稿'
,
latestPublished
:
'最新发布'
,
restore
:
'恢复'
,
},
tabs
:
{
tabs
:
{
blocks
:
'Blocks'
,
blocks
:
'Blocks'
,
builtInTool
:
'内置工具'
,
builtInTool
:
'内置工具'
,
...
...
web/types/workflow.ts
View file @
6448d71c
...
@@ -12,4 +12,5 @@ export type FetchWorkflowDraftResponse = {
...
@@ -12,4 +12,5 @@ export type FetchWorkflowDraftResponse = {
viewport
?:
Viewport
viewport
?:
Viewport
}
}
features
?:
any
features
?:
any
updated_at
:
number
}
}
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