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
7ae23d55
Commit
7ae23d55
authored
Mar 03, 2024
by
JzoNg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add redirection
parent
569315ee
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
138 additions
and
8 deletions
+138
-8
layout.tsx
...p/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx
+39
-5
page.tsx
...commonLayout)/app/(appDetailLayout)/[appId]/logs/page.tsx
+1
-1
page.tsx
...onLayout)/app/(appDetailLayout)/[appId]/workflow/page.tsx
+96
-0
AppCard.tsx
web/app/(commonLayout)/apps/AppCard.tsx
+1
-1
NewAppCard.tsx
web/app/(commonLayout)/apps/NewAppCard.tsx
+1
-1
No files found.
web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx
View file @
7ae23d55
'use client'
import
type
{
FC
}
from
'react'
import
React
,
{
useEffect
,
useMemo
}
from
'react'
import
{
usePathname
,
useRouter
}
from
'next/navigation'
import
cn
from
'classnames'
import
useSWR
from
'swr'
import
{
useTranslation
}
from
'react-i18next'
...
...
@@ -22,10 +23,18 @@ const AppDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
params
:
{
appId
},
// get appId in path
}
=
props
const
{
t
}
=
useTranslation
()
const
router
=
useRouter
()
const
pathname
=
usePathname
()
const
{
isCurrentWorkspaceManager
}
=
useAppContext
()
const
detailParams
=
{
url
:
'/apps'
,
id
:
appId
}
const
{
data
:
response
}
=
useSWR
(
detailParams
,
fetchAppDetail
)
// redirection
if
((
response
?.
mode
===
'workflow'
||
response
?.
mode
===
'advanced-chat'
)
&&
(
pathname
).
endsWith
(
'configuration'
))
router
.
replace
(
`/app/
${
appId
}
/workflow`
)
if
((
response
?.
mode
!==
'workflow'
&&
response
?.
mode
!==
'advanced-chat'
)
&&
(
pathname
).
endsWith
(
'workflow'
))
router
.
replace
(
`/app/
${
appId
}
/configuration`
)
const
appModeName
=
(()
=>
{
if
(
response
?.
mode
===
'chat'
||
response
?.
mode
===
'advanced-chat'
)
return
t
(
'app.types.chatbot'
)
...
...
@@ -41,13 +50,38 @@ const AppDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
const
navigation
=
useMemo
(()
=>
{
const
navs
=
[
...(
isCurrentWorkspaceManager
?
[{
name
:
t
(
'common.appMenus.promptEng'
),
href
:
`/app/
${
appId
}
/configuration`
,
icon
:
PromptEngineering
,
selectedIcon
:
PromptEngineeringSolid
}]
:
[]),
{
name
:
t
(
'common.appMenus.apiAccess'
),
href
:
`/app/
${
appId
}
/develop`
,
icon
:
TerminalSquare
,
selectedIcon
:
TerminalSquareSolid
},
...(
appModeName
!==
'workflow'
?
[{
name
:
t
(
'common.appMenus.logAndAnn'
),
href
:
`/app/
${
appId
}
/logs`
,
icon
:
FileHeart02
,
selectedIcon
:
FileHeart02Solid
}]
:
[{
name
:
t
(
'common.appMenus.logs'
),
href
:
`/app/
${
appId
}
/logs`
,
icon
:
FileHeart02
,
selectedIcon
:
FileHeart02Solid
}]),
{
name
:
t
(
'common.appMenus.overview'
),
href
:
`/app/
${
appId
}
/overview`
,
icon
:
BarChartSquare02
,
selectedIcon
:
BarChartSquare02Solid
},
...(
isCurrentWorkspaceManager
?
[{
name
:
t
(
'common.appMenus.promptEng'
),
href
:
`/app/
${
appId
}
/
${(
response
?.
mode
===
'workflow'
||
response
?.
mode
===
'advanced-chat'
)
?
'workflow'
:
'configuration'
}
`,
icon: PromptEngineering,
selectedIcon: PromptEngineeringSolid,
}]
: []
),
{
name: t('common.appMenus.apiAccess'),
href: `
/
app
/
$
{
appId
}
/develop`
,
icon
:
TerminalSquare
,
selectedIcon
:
TerminalSquareSolid
,
}
,
{
name: response?.mode !== 'workflow'
? t('common.appMenus.logAndAnn')
: t('common.appMenus.logs'),
href: `
/
app
/
$
{
appId
}
/logs`
,
icon
:
FileHeart02
,
selectedIcon
:
FileHeart02Solid
,
},
{
name
:
t
(
'common.appMenus.overview'
),
href
:
`/app/
${
appId
}
/overview`
,
icon
:
BarChartSquare02
,
selectedIcon
:
BarChartSquare02Solid
,
},
]
return
navs
},
[
appId
,
appModeName
,
isCurrentWorkspaceManager
,
t
])
},
[
appId
,
isCurrentWorkspaceManager
,
response
?.
mode
,
t
])
useEffect
(()
=>
{
if
(
response
?.
name
)
...
...
web/app/(commonLayout)/app/(appDetailLayout)/[appId]/logs/page.tsx
View file @
7ae23d55
...
...
@@ -13,7 +13,7 @@ const Logs = async ({
appMode
,
}:
IProps
)
=>
{
return
(
<
Main
appMode=
{
'workflow'
}
pageType=
{
PageType
.
log
}
appId=
{
appId
}
/>
<
Main
appMode=
{
appMode
}
pageType=
{
PageType
.
log
}
appId=
{
appId
}
/>
)
}
...
...
web/app/(commonLayout)/app/(appDetailLayout)/[appId]/workflow/page.tsx
0 → 100644
View file @
7ae23d55
'use client'
import
type
{
FC
}
from
'react'
import
{
memo
}
from
'react'
import
Workflow
from
'@/app/components/workflow'
const
initialNodes
=
[
{
id
:
'1'
,
type
:
'custom'
,
position
:
{
x
:
180
,
y
:
180
},
data
:
{
type
:
'start'
},
},
// {
// id: '2',
// type: 'custom',
// position: { x: 0, y: 0 },
// data: {
// type: 'if-else',
// branches: [
// {
// id: 'if-true',
// name: 'IS TRUE',
// },
// {
// id: 'if-false',
// name: 'IS FALSE',
// },
// ],
// },
// },
// {
// id: '3',
// type: 'custom',
// position: { x: 0, y: 0 },
// data: { type: 'question-classifier', sortIndexInBranches: 0 },
// },
// {
// id: '4',
// type: 'custom',
// position: { x: 0, y: 0 },
// data: {
// type: 'if-else',
// sortIndexInBranches: 1,
// branches: [
// {
// id: 'if-true',
// name: 'IS TRUE',
// },
// {
// id: 'if-false',
// name: 'IS FALSE',
// },
// ],
// },
// },
]
const
initialEdges
=
[
// {
// id: '0',
// type: 'custom',
// source: '1',
// sourceHandle: 'source',
// target: '2',
// targetHandle: 'target',
// },
// {
// id: '1',
// type: 'custom',
// source: '2',
// sourceHandle: 'if-true',
// target: '3',
// targetHandle: 'target',
// },
// {
// id: '2',
// type: 'custom',
// source: '2',
// sourceHandle: 'if-false',
// target: '4',
// targetHandle: 'target',
// },
]
const
Page
:
FC
=
()
=>
{
return
(
<
div
className=
'min-w-[720px] w-full h-full overflow-x-auto'
>
<
Workflow
nodes=
{
initialNodes
}
edges=
{
initialEdges
}
/>
</
div
>
)
}
export
default
memo
(
Page
)
web/app/(commonLayout)/apps/AppCard.tsx
View file @
7ae23d55
...
...
@@ -218,7 +218,7 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => {
/>
}
</
div
>
<
div
className=
{
style
.
listItemDescription
}
>
{
app
.
model_config
?.
pre_prompt
}
{
app
.
description
}
</
div
>
<
div
className=
{
style
.
listItemFooter
}
>
<
AppModeLabel
mode=
{
app
.
mode
}
/>
...
...
web/app/(commonLayout)/apps/NewAppCard.tsx
View file @
7ae23d55
...
...
@@ -17,7 +17,7 @@ const CreateAppCard = forwardRef<HTMLAnchorElement, CreateAppCardProps>(({ onSuc
const
{
t
}
=
useTranslation
()
const
{
onPlanInfoChanged
}
=
useProviderContext
()
const
[
showNewAppDialog
,
setShowNewAppDialog
]
=
useState
(
tru
e
)
const
[
showNewAppDialog
,
setShowNewAppDialog
]
=
useState
(
fals
e
)
const
[
showCreateFromDSLModal
,
setShowCreateFromDSLModal
]
=
useState
(
false
)
return
(
<
a
...
...
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