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
cd773b8c
Commit
cd773b8c
authored
Mar 03, 2024
by
JzoNg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app import supported
parent
9bca69eb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
index.tsx
web/app/components/explore/app-list/index.tsx
+4
-8
apps.ts
web/service/apps.ts
+4
-0
No files found.
web/app/components/explore/app-list/index.tsx
View file @
cd773b8c
...
...
@@ -13,13 +13,12 @@ import type { App } from '@/models/explore'
import
Category
from
'@/app/components/explore/category'
import
AppCard
from
'@/app/components/explore/app-card'
import
{
fetchAppDetail
,
fetchAppList
}
from
'@/service/explore'
import
{
create
App
}
from
'@/service/apps'
import
{
import
App
}
from
'@/service/apps'
import
{
useTabSearchParams
}
from
'@/hooks/use-tab-searchparams'
import
CreateAppModal
from
'@/app/components/explore/create-app-modal'
import
type
{
CreateAppModalProps
}
from
'@/app/components/explore/create-app-modal'
import
Loading
from
'@/app/components/base/loading'
import
{
NEED_REFRESH_APP_LIST_KEY
}
from
'@/config'
import
{
type
AppMode
}
from
'@/types/app'
import
{
useAppContext
}
from
'@/context/app-context'
type
AppsProps
=
{
...
...
@@ -73,19 +72,16 @@ const Apps = ({
icon_background
,
description
,
})
=>
{
const
{
app_model_config
:
model_config
}
=
await
fetchAppDetail
(
const
{
export_data
}
=
await
fetchAppDetail
(
currApp
?.
app
.
id
as
string
,
)
// #TODO# need yaml config from app detail
// #TODO# use import api
try
{
const
app
=
await
createApp
({
const
app
=
await
importApp
({
data
:
export_data
,
name
,
icon
,
icon_background
,
mode
:
currApp
?.
app
.
mode
as
AppMode
,
description
,
config
:
model_config
,
})
setIsShowCreateModal
(
false
)
Toast
.
notify
({
...
...
web/service/apps.ts
View file @
cd773b8c
...
...
@@ -28,6 +28,10 @@ export const exportAppConfig: Fetcher<{ data: string }, string> = (appID) => {
return
post
<
{
data
:
string
}
>
(
`apps/
${
appID
}
/export`
)
}
export
const
importApp
:
Fetcher
<
AppDetailResponse
,
{
data
:
string
;
name
?:
string
;
description
?:
string
;
icon
?:
string
;
icon_background
?:
string
}
>
=
({
name
,
description
,
icon
,
icon_background
})
=>
{
return
post
<
AppDetailResponse
>
(
'apps/import'
,
{
body
:
{
name
,
description
,
icon
,
icon_background
}
})
}
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