Commit 8c4b0c42 authored by Joel's avatar Joel

chore: create add description

parent fd5c45ae
......@@ -43,6 +43,8 @@ const NewAppDialog = ({ show, onSuccess, onClose }: NewAppDialogProps) => {
const [showEmojiPicker, setShowEmojiPicker] = useState(false)
const [emoji, setEmoji] = useState({ icon: '🤖', icon_background: '#FFEAD5' })
const [desc, setDesc] = useState('')
const mutateApps = useContextSelector(AppsContext, state => state.mutateApps)
const { data: templates, mutate } = useSWR({ url: '/app-templates' }, fetchAppTemplates)
......@@ -82,6 +84,7 @@ const NewAppDialog = ({ show, onSuccess, onClose }: NewAppDialogProps) => {
try {
const app = await createApp({
name,
description: desc,
icon: emoji.icon,
icon_background: emoji.icon_background,
mode: isWithTemplate ? templates.data[selectedTemplateIndex].mode : newAppMode!,
......@@ -99,7 +102,7 @@ const NewAppDialog = ({ show, onSuccess, onClose }: NewAppDialogProps) => {
notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
}
isCreatingRef.current = false
}, [isWithTemplate, newAppMode, notify, router, templates, selectedTemplateIndex, emoji])
}, [isWithTemplate, newAppMode, desc, notify, router, templates, selectedTemplateIndex, emoji])
return <>
{showEmojiPicker && <EmojiPicker
......@@ -122,7 +125,7 @@ const NewAppDialog = ({ show, onSuccess, onClose }: NewAppDialogProps) => {
</>
}
>
<div className='overflow-y-auto'>
<div>
<div className={style.newItemCaption}>
<h3 className='inline'>{t('app.newApp.captionAppType')}</h3>
{isWithTemplate && (
......@@ -211,6 +214,16 @@ const NewAppDialog = ({ show, onSuccess, onClose }: NewAppDialogProps) => {
</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 && (
<div className='flex items-center h-[34px] mt-2'>
......
......@@ -16,8 +16,8 @@ export const fetchAppTemplates: Fetcher<AppTemplatesResponse, { url: string }> =
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 }) => {
return post<AppDetailResponse>('apps', { body: { name, icon, icon_background, mode, model_config: 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, description, icon, icon_background, mode, model_config: config } })
}
export const deleteApp: Fetcher<CommonResponse, string> = (appID) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment