+
{isLoading &&
}
{!isLoading && (
-
{t('app.appSelector.params')}
+
{t('app.appSelector.params')}
)}
- {!isLoading && !inputs.length && (
+ {!isLoading && !inputFormSchema.length && (
{t('app.appSelector.noParams')}
)}
+ {!isLoading && !!inputFormSchema.length && (
+
+ )}
)
}
diff --git a/web/app/components/plugins/plugin-detail-panel/app-selector/index.tsx b/web/app/components/plugins/plugin-detail-panel/app-selector/index.tsx
index 53b2152ea4..59556dcc10 100644
--- a/web/app/components/plugins/plugin-detail-panel/app-selector/index.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/app-selector/index.tsx
@@ -55,14 +55,35 @@ const AppSelector: FC
= ({
}, [appList?.data, value])
const [isShowChooseApp, setIsShowChooseApp] = useState(false)
const handleSelectApp = (app: App) => {
+ const clearValue = app.id !== value?.app_id
const appValue = {
app_id: app.id,
- inputs: value?.inputs || {},
- files: value?.files || [],
+ inputs: clearValue ? {} : value?.inputs || {},
+ files: clearValue ? [] : value?.files || [],
}
onSelect(appValue)
setIsShowChooseApp(false)
}
+ const handleFormChange = (inputs: Record) => {
+ const newFiles = inputs['#image#']
+ delete inputs['#image#']
+ const newValue = {
+ app_id: value?.app_id || '',
+ inputs,
+ files: newFiles ? [newFiles] : value?.files || [],
+ }
+ onSelect(newValue)
+ }
+
+ const formattedValue = useMemo(() => {
+ return {
+ app_id: value?.app_id || '',
+ inputs: {
+ ...value?.inputs,
+ ...(value?.files?.length ? { '#image#': value.files[0] } : {}),
+ },
+ }
+ }, [value])
return (
<>
@@ -104,7 +125,9 @@ const AppSelector: FC = ({
{/* app inputs config panel */}
{currentAppInfo && (
)}
diff --git a/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx b/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx
index f6e4a0d0bc..2d200cb348 100644
--- a/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx
@@ -11,8 +11,6 @@ import Toast from '@/app/components/base/toast'
import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks'
import cn from '@/utils/classnames'
-import AppSelector from '@/app/components/plugins/plugin-detail-panel/app-selector'
-
type Props = {
formSchemas: any
defaultValues?: any
@@ -40,8 +38,6 @@ const EndpointModal: FC