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
5afa5fb0
Commit
5afa5fb0
authored
Mar 09, 2024
by
JzoNg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app switch
parent
93e2dc4f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
23 deletions
+26
-23
app-info.tsx
web/app/components/app-sidebar/app-info.tsx
+1
-1
index.tsx
web/app/components/app-sidebar/index.tsx
+5
-9
index.tsx
web/app/components/app/switch-app-modal/index.tsx
+10
-7
detail.tsx
web/app/components/app/workflow-log/detail.tsx
+1
-1
index.tsx
web/app/components/workflow/run/index.tsx
+1
-1
tracing.tsx
web/app/components/workflow/run/tracing.tsx
+4
-4
apps.ts
web/service/apps.ts
+4
-0
No files found.
web/app/components/app-sidebar/app-info.tsx
View file @
5afa5fb0
...
...
@@ -257,7 +257,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
</
div
>
</>
)
}
{
(
appDetail
.
mode
===
'completion'
||
appDetail
.
mode
l_config
?.
prompt_type
===
'advanced
'
)
&&
(
{
(
appDetail
.
mode
===
'completion'
||
appDetail
.
mode
===
'chat
'
)
&&
(
<>
<
Divider
className=
"!my-1"
/>
<
div
...
...
web/app/components/app-sidebar/index.tsx
View file @
5afa5fb0
import
React
,
{
use
Callback
,
use
Effect
,
useState
}
from
'react'
import
React
,
{
useEffect
,
useState
}
from
'react'
import
NavLink
from
'./navLink'
import
type
{
NavIcon
}
from
'./navLink'
import
AppBasic
from
'./basic'
...
...
@@ -32,13 +32,9 @@ const AppDetailNav = ({ title, desc, icon, icon_background, navigation, extraInf
const
[
modeState
,
setModeState
]
=
useState
(
appSidebarExpand
)
const
expand
=
modeState
===
'expand'
const
handleToggle
=
useCallback
(()
=>
{
setModeState
((
prev
)
=>
{
const
next
=
prev
===
'expand'
?
'collapse'
:
'expand'
setAppSiderbarExpand
(
next
)
return
next
})
},
[
setAppSiderbarExpand
])
const
handleToggle
=
(
state
:
string
)
=>
{
setAppSiderbarExpand
(
state
===
'expand'
?
'collapse'
:
'expand'
)
}
useEffect
(()
=>
{
if
(
appSidebarExpand
)
{
...
...
@@ -100,7 +96,7 @@ const AppDetailNav = ({ title, desc, icon, icon_background, navigation, extraInf
>
<
div
className=
'flex items-center justify-center w-6 h-6 text-gray-500 cursor-pointer'
onClick=
{
handleToggle
}
onClick=
{
()
=>
handleToggle
(
modeState
)
}
>
{
expand
...
...
web/app/components/app/switch-app-modal/index.tsx
View file @
5afa5fb0
...
...
@@ -9,7 +9,7 @@ import s from './style.module.css'
import
Button
from
'@/app/components/base/button'
import
Modal
from
'@/app/components/base/modal'
import
{
ToastContext
}
from
'@/app/components/base/toast'
import
{
import
App
}
from
'@/service/apps'
import
{
deleteApp
,
switch
App
}
from
'@/service/apps'
import
{
useAppContext
}
from
'@/context/app-context'
import
{
useProviderContext
}
from
'@/context/provider-context'
import
AppsFull
from
'@/app/components/billing/apps-full-in-dialog'
...
...
@@ -29,7 +29,7 @@ type SwitchAppModalProps = {
}
const
SwitchAppModal
=
({
show
,
appDetail
,
onSuccess
,
onClose
}:
SwitchAppModalProps
)
=>
{
const
{
push
}
=
useRouter
()
const
{
push
,
replace
}
=
useRouter
()
const
{
t
}
=
useTranslation
()
const
{
notify
}
=
useContext
(
ToastContext
)
...
...
@@ -43,18 +43,21 @@ const SwitchAppModal = ({ show, appDetail, onSuccess, onClose }: SwitchAppModalP
const
[
removeOriginal
,
setRemoveOriginal
]
=
useState
<
boolean
>
(
false
)
const
goStart
=
async
()
=>
{
// ###TODO### SWITCH
try
{
const
app
=
await
importApp
({
data
:
''
,
})
const
{
new_app_id
:
newAppID
}
=
await
switchApp
(
appDetail
.
id
)
if
(
onSuccess
)
onSuccess
()
if
(
onClose
)
onClose
()
notify
({
type
:
'success'
,
message
:
t
(
'app.newApp.appCreated'
)
})
if
(
removeOriginal
)
await
deleteApp
(
appDetail
.
id
)
localStorage
.
setItem
(
NEED_REFRESH_APP_LIST_KEY
,
'1'
)
getRedirection
(
isCurrentWorkspaceManager
,
app
,
push
)
getRedirection
(
isCurrentWorkspaceManager
,
{
id
:
newAppID
},
removeOriginal
?
replace
:
push
,
)
}
catch
(
e
)
{
notify
({
type
:
'error'
,
message
:
t
(
'app.newApp.appCreateFailed'
)
})
...
...
web/app/components/app/workflow-log/detail.tsx
View file @
5afa5fb0
...
...
@@ -18,7 +18,7 @@ const DetailPanel: FC<ILogDetail> = ({ runID, onClose }) => {
<
XClose
className=
'w-4 h-4 text-gray-500'
/>
</
span
>
<
h1
className=
'shrink-0 px-4 py-1 text-md font-semibold text-gray-900'
>
{
t
(
'appLog.runDetail.workflowTitle'
)
}
</
h1
>
<
Run
activeTab=
'
RESULT
'
runID=
{
runID
}
/>
<
Run
activeTab=
'
TRACING
'
runID=
{
runID
}
/>
</
div
>
)
}
...
...
web/app/components/workflow/run/index.tsx
View file @
5afa5fb0
...
...
@@ -38,7 +38,7 @@ const RunPanel: FC<RunProps> = ({ activeTab, runID }) => {
{
/* panel detal */
}
<
div
className=
{
cn
(
'grow bg-white h-0 overflow-y-auto'
,
currentTab
===
'TRACING'
&&
'!bg-gray-50'
)
}
>
{
currentTab
===
'RESULT'
&&
<
Result
runID=
{
runID
}
/>
}
{
currentTab
===
'TRACING'
&&
<
Tracing
/>
}
{
currentTab
===
'TRACING'
&&
<
Tracing
runID=
{
runID
}
/>
}
</
div
>
</
div
>
)
...
...
web/app/components/workflow/run/tracing.tsx
View file @
5afa5fb0
'use client'
import
type
{
FC
}
from
'react'
import
React
,
{
useState
}
from
'react'
import
{
useTranslation
}
from
'react-i18next'
//
import { useTranslation } from 'react-i18next'
// import cn from 'classnames'
import
{
BlockEnum
}
from
'../types'
import
NodePanel
from
'./node'
type
TracingProps
=
{
// appId
: string
runID
:
string
}
const
nodeInfoFake
=
{
...
...
@@ -18,8 +18,8 @@ const nodeInfoFake = {
status
:
'succeeded'
,
}
const
Tracing
:
FC
<
TracingProps
>
=
()
=>
{
const
{
t
}
=
useTranslation
()
const
Tracing
:
FC
<
TracingProps
>
=
(
{
runID
}
)
=>
{
//
const { t } = useTranslation()
const
[
nodeCollapsed
,
setCurrentTab
]
=
useState
<
boolean
>
(
false
)
const
collapseStateChange
=
()
=>
{
...
...
web/service/apps.ts
View file @
5afa5fb0
...
...
@@ -36,6 +36,10 @@ export const importApp: Fetcher<AppDetailResponse, { data: string; name?: string
return
post
<
AppDetailResponse
>
(
'apps/import'
,
{
body
:
{
name
,
description
,
icon
,
icon_background
}
})
}
export
const
switchApp
:
Fetcher
<
{
new_app_id
:
string
},
string
>
=
(
appID
)
=>
{
return
post
<
{
new_app_id
:
string
}
>
(
`apps/
${
appID
}
/convert-to-workflow`
)
}
export
const
deleteApp
:
Fetcher
<
CommonResponse
,
string
>
=
(
appID
)
=>
{
return
del
<
CommonResponse
>
(
`apps/
${
appID
}
`
)
}
...
...
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