empty inputs form of app selector

pull/12372/head
JzoNg 1 year ago
parent f9f2e68bd8
commit e53c4fc0ad

@ -18,7 +18,7 @@ import { SimpleSelect } from '@/app/components/base/select'
import Tooltip from '@/app/components/base/tooltip' import Tooltip from '@/app/components/base/tooltip'
import Radio from '@/app/components/base/radio' import Radio from '@/app/components/base/radio'
import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal' import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal'
import ToolSelector from '@/app/components/plugins/plugin-detail-panel/tool-selector' // import ToolSelector from '@/app/components/plugins/plugin-detail-panel/tool-selector'
import AppSelector from '@/app/components/plugins/plugin-detail-panel/app-selector' import AppSelector from '@/app/components/plugins/plugin-detail-panel/app-selector'
type FormProps = { type FormProps = {
@ -318,34 +318,34 @@ const Form: FC<FormProps> = ({
) )
} }
if (formSchema.type === FormTypeEnum.toolSelector) { // if (formSchema.type === FormTypeEnum.toolSelector) {
const { // const {
variable, // variable,
label, // label,
required, // required,
} = formSchema as (CredentialFormSchemaTextInput | CredentialFormSchemaSecretInput) // } = formSchema as (CredentialFormSchemaTextInput | CredentialFormSchemaSecretInput)
return ( // return (
<div key={variable} className={cn(itemClassName, 'py-3')}> // <div key={variable} className={cn(itemClassName, 'py-3')}>
<div className={cn(fieldLabelClassName, 'flex items-center py-2 system-sm-semibold text-text-secondary')}> // <div className={cn(fieldLabelClassName, 'flex items-center py-2 system-sm-semibold text-text-secondary')}>
{label[language] || label.en_US} // {label[language] || label.en_US}
{ // {
required && ( // required && (
<span className='ml-1 text-red-500'>*</span> // <span className='ml-1 text-red-500'>*</span>
) // )
} // }
{tooltipContent} // {tooltipContent}
</div> // </div>
<ToolSelector // <ToolSelector
disabled={readonly} // disabled={readonly}
value={value[variable]} // value={value[variable]}
onSelect={item => handleFormChange(variable, item as any)} // onSelect={item => handleFormChange(variable, item as any)}
/> // />
{fieldMoreInfo?.(formSchema)} // {fieldMoreInfo?.(formSchema)}
{validating && changeKey === variable && <ValidatingTip />} // {validating && changeKey === variable && <ValidatingTip />}
</div> // </div>
) // )
} // }
if (formSchema.type === FormTypeEnum.appSelector) { if (formSchema.type === FormTypeEnum.appSelector) {
const { const {

@ -0,0 +1,36 @@
'use client'
import React from 'react'
import { useTranslation } from 'react-i18next'
import Loading from '@/app/components/base/loading'
import { useAppDetail } from '@/service/use-apps'
import type { App } from '@/types/app'
import cn from '@/utils/classnames'
type Props = {
appDetail: App
}
const AppInputsPanel = ({
appDetail,
}: Props) => {
const { t } = useTranslation()
const { data: currentApp, isFetching: isLoading } = useAppDetail(appDetail.id)
const inputs = []
return (
<div className={cn('px-4 pb-4 rounded-b-2xl border-t border-divider-subtle')}>
{isLoading && <div className='pt-3'><Loading type='app' /></div>}
{!isLoading && (
<div className='mt-3 mb-2 h-6 flex items-center system-sm-semibold text-text-secondary'>{t('app.appSelector.params')}</div>
)}
{!isLoading && !inputs.length && (
<div className='h-16 flex flex-col justify-center items-center'>
<div className='text-text-tertiary system-sm-regular'>{t('app.appSelector.noParams')}</div>
</div>
)}
</div>
)
}
export default AppInputsPanel

@ -9,8 +9,7 @@ import {
} from '@/app/components/base/portal-to-follow-elem' } from '@/app/components/base/portal-to-follow-elem'
import AppTrigger from '@/app/components/plugins/plugin-detail-panel/app-selector/app-trigger' import AppTrigger from '@/app/components/plugins/plugin-detail-panel/app-selector/app-trigger'
import AppPicker from '@/app/components/plugins/plugin-detail-panel/app-selector/app-picker' import AppPicker from '@/app/components/plugins/plugin-detail-panel/app-selector/app-picker'
// import Button from '@/app/components/base/button' import AppInputsPanel from '@/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-panel'
import { useAppFullList } from '@/service/use-apps' import { useAppFullList } from '@/service/use-apps'
import type { App } from '@/types/app' import type { App } from '@/types/app'
import type { import type {
@ -65,8 +64,6 @@ const AppSelector: FC<Props> = ({
setIsShowChooseApp(false) setIsShowChooseApp(false)
} }
// const { data: currentApp } = useAppDetail(value?.app_id || 'empty')
return ( return (
<> <>
<PortalToFollowElem <PortalToFollowElem
@ -105,8 +102,11 @@ const AppSelector: FC<Props> = ({
/> />
</div> </div>
{/* app inputs config panel */} {/* app inputs config panel */}
<div className='px-4 py-3 flex items-center border-t border-divider-subtle'> {currentAppInfo && (
</div> <AppInputsPanel
appDetail={currentAppInfo}
/>
)}
</div> </div>
</PortalToFollowElemContent> </PortalToFollowElemContent>
</PortalToFollowElem> </PortalToFollowElem>

@ -137,6 +137,7 @@ const translation = {
label: 'APP', label: 'APP',
placeholder: 'Select an app...', placeholder: 'Select an app...',
params: 'APP PARAMETERS', params: 'APP PARAMETERS',
noParams: 'No parameters needed',
}, },
} }

@ -136,6 +136,7 @@ const translation = {
label: '应用', label: '应用',
placeholder: '选择一个应用', placeholder: '选择一个应用',
params: '应用参数', params: '应用参数',
noParams: '无需参数',
}, },
} }

Loading…
Cancel
Save