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
8c4b0c42
Commit
8c4b0c42
authored
Jan 25, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: create add description
parent
fd5c45ae
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
NewAppDialog.tsx
web/app/(commonLayout)/apps/NewAppDialog.tsx
+15
-2
apps.ts
web/service/apps.ts
+2
-2
No files found.
web/app/(commonLayout)/apps/NewAppDialog.tsx
View file @
8c4b0c42
...
@@ -43,6 +43,8 @@ const NewAppDialog = ({ show, onSuccess, onClose }: NewAppDialogProps) => {
...
@@ -43,6 +43,8 @@ const NewAppDialog = ({ show, onSuccess, onClose }: NewAppDialogProps) => {
const
[
showEmojiPicker
,
setShowEmojiPicker
]
=
useState
(
false
)
const
[
showEmojiPicker
,
setShowEmojiPicker
]
=
useState
(
false
)
const
[
emoji
,
setEmoji
]
=
useState
({
icon
:
'🤖'
,
icon_background
:
'#FFEAD5'
})
const
[
emoji
,
setEmoji
]
=
useState
({
icon
:
'🤖'
,
icon_background
:
'#FFEAD5'
})
const
[
desc
,
setDesc
]
=
useState
(
''
)
const
mutateApps
=
useContextSelector
(
AppsContext
,
state
=>
state
.
mutateApps
)
const
mutateApps
=
useContextSelector
(
AppsContext
,
state
=>
state
.
mutateApps
)
const
{
data
:
templates
,
mutate
}
=
useSWR
({
url
:
'/app-templates'
},
fetchAppTemplates
)
const
{
data
:
templates
,
mutate
}
=
useSWR
({
url
:
'/app-templates'
},
fetchAppTemplates
)
...
@@ -82,6 +84,7 @@ const NewAppDialog = ({ show, onSuccess, onClose }: NewAppDialogProps) => {
...
@@ -82,6 +84,7 @@ const NewAppDialog = ({ show, onSuccess, onClose }: NewAppDialogProps) => {
try
{
try
{
const
app
=
await
createApp
({
const
app
=
await
createApp
({
name
,
name
,
description
:
desc
,
icon
:
emoji
.
icon
,
icon
:
emoji
.
icon
,
icon_background
:
emoji
.
icon_background
,
icon_background
:
emoji
.
icon_background
,
mode
:
isWithTemplate
?
templates
.
data
[
selectedTemplateIndex
].
mode
:
newAppMode
!
,
mode
:
isWithTemplate
?
templates
.
data
[
selectedTemplateIndex
].
mode
:
newAppMode
!
,
...
@@ -99,7 +102,7 @@ const NewAppDialog = ({ show, onSuccess, onClose }: NewAppDialogProps) => {
...
@@ -99,7 +102,7 @@ const NewAppDialog = ({ show, onSuccess, onClose }: NewAppDialogProps) => {
notify
({
type
:
'error'
,
message
:
t
(
'app.newApp.appCreateFailed'
)
})
notify
({
type
:
'error'
,
message
:
t
(
'app.newApp.appCreateFailed'
)
})
}
}
isCreatingRef
.
current
=
false
isCreatingRef
.
current
=
false
},
[
isWithTemplate
,
newAppMode
,
notify
,
router
,
templates
,
selectedTemplateIndex
,
emoji
])
},
[
isWithTemplate
,
newAppMode
,
desc
,
notify
,
router
,
templates
,
selectedTemplateIndex
,
emoji
])
return
<>
return
<>
{
showEmojiPicker
&&
<
EmojiPicker
{
showEmojiPicker
&&
<
EmojiPicker
...
@@ -122,7 +125,7 @@ const NewAppDialog = ({ show, onSuccess, onClose }: NewAppDialogProps) => {
...
@@ -122,7 +125,7 @@ const NewAppDialog = ({ show, onSuccess, onClose }: NewAppDialogProps) => {
</>
</>
}
}
>
>
<
div
className=
'overflow-y-auto'
>
<
div
>
<
div
className=
{
style
.
newItemCaption
}
>
<
div
className=
{
style
.
newItemCaption
}
>
<
h3
className=
'inline'
>
{
t
(
'app.newApp.captionAppType'
)
}
</
h3
>
<
h3
className=
'inline'
>
{
t
(
'app.newApp.captionAppType'
)
}
</
h3
>
{
isWithTemplate
&&
(
{
isWithTemplate
&&
(
...
@@ -211,6 +214,16 @@ const NewAppDialog = ({ show, onSuccess, onClose }: NewAppDialogProps) => {
...
@@ -211,6 +214,16 @@ const NewAppDialog = ({ show, onSuccess, onClose }: NewAppDialogProps) => {
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
classNames
(
style
.
newItemCaption
,
'mt-4 !mb-0'
)
}
>
{
t
(
'appOverview.overview.appInfo.settings.webDesc'
)
}
</
div
>
<
p
className=
{
'leading-[18px] text-xs font-normal text-gray-500'
}
>
{
t
(
'appOverview.overview.appInfo.settings.webDescTip'
)
}
</
p
>
<
textarea
rows=
{
3
}
className=
{
'mt-2 pt-2 pb-2 px-3 rounded-lg bg-gray-100 w-full text-gray-900 leading-5 text-sm font-normal'
}
value=
{
desc
}
onChange=
{
e
=>
setDesc
(
e
.
target
.
value
)
}
placeholder=
{
t
(
'appOverview.overview.appInfo.settings.webDescPlaceholder'
)
as
string
}
/>
{
{
!
isWithTemplate
&&
(
!
isWithTemplate
&&
(
<
div
className=
'flex items-center h-[34px] mt-2'
>
<
div
className=
'flex items-center h-[34px] mt-2'
>
...
...
web/service/apps.ts
View file @
8c4b0c42
...
@@ -16,8 +16,8 @@ export const fetchAppTemplates: Fetcher<AppTemplatesResponse, { url: string }> =
...
@@ -16,8 +16,8 @@ export const fetchAppTemplates: Fetcher<AppTemplatesResponse, { url: string }> =
return
get
<
AppTemplatesResponse
>
(
url
)
return
get
<
AppTemplatesResponse
>
(
url
)
}
}
export
const
createApp
:
Fetcher
<
AppDetailResponse
,
{
name
:
string
;
icon
:
string
;
icon_background
:
string
;
mode
:
AppMode
;
config
?:
ModelConfig
}
>
=
({
name
,
icon
,
icon_background
,
mode
,
config
})
=>
{
export
const
createApp
:
Fetcher
<
AppDetailResponse
,
{
name
:
string
;
description
?:
string
;
icon
:
string
;
icon_background
:
string
;
mode
:
AppMode
;
config
?:
ModelConfig
}
>
=
({
name
,
description
,
icon
,
icon_background
,
mode
,
config
})
=>
{
return
post
<
AppDetailResponse
>
(
'apps'
,
{
body
:
{
name
,
icon
,
icon_background
,
mode
,
model_config
:
config
}
})
return
post
<
AppDetailResponse
>
(
'apps'
,
{
body
:
{
name
,
description
,
icon
,
icon_background
,
mode
,
model_config
:
config
}
})
}
}
export
const
deleteApp
:
Fetcher
<
CommonResponse
,
string
>
=
(
appID
)
=>
{
export
const
deleteApp
:
Fetcher
<
CommonResponse
,
string
>
=
(
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