diff --git a/web/app/components/app/configuration/config-vision/index.tsx b/web/app/components/app/configuration/config-vision/index.tsx index f0904b3fd8..8d97097fba 100644 --- a/web/app/components/app/configuration/config-vision/index.tsx +++ b/web/app/components/app/configuration/config-vision/index.tsx @@ -13,10 +13,14 @@ import ConfigContext from '@/context/debug-configuration' import { useFeatures, useFeaturesStore } from '@/app/components/base/features/hooks' import Switch from '@/app/components/base/switch' import { SupportUploadFileTypes } from '@/app/components/workflow/types' +import OptionCard from '@/app/components/workflow/nodes/_base/components/option-card' +import { Resolution } from '@/types/app' +import { noop } from 'lodash' +import cn from '@/utils/classnames' const ConfigVision: FC = () => { const { t } = useTranslation() - const { isShowVisionConfig, isAllowVideoUpload } = useContext(ConfigContext) + const { isShowVisionConfig, isAllowVideoUpload, readonly } = useContext(ConfigContext) const file = useFeatures(s => s.features.file) const featuresStore = useFeaturesStore() @@ -53,7 +57,7 @@ const ConfigVision: FC = () => { setFeatures(newFeatures) }, [featuresStore, isAllowVideoUpload]) - if (!isShowVisionConfig) + if (!isShowVisionConfig || (readonly && !isImageEnabled)) return null return ( @@ -74,37 +78,49 @@ const ConfigVision: FC = () => { />
- {/*
-
{t('appDebug.vision.visionSettings.resolution')}
- - {t('appDebug.vision.visionSettings.resolutionTooltip').split('\n').map(item => ( -
{item}
- ))} -
- } + {readonly ? (<> +
+
{t('appDebug.vision.visionSettings.resolution')}
+ + {t('appDebug.vision.visionSettings.resolutionTooltip').split('\n').map(item => ( +
{item}
+ ))} +
+ } + /> +
+
+ + +
+ ) : <> + +
+ - */} - {/*
- handleChange(Resolution.high)} - /> - handleChange(Resolution.low)} - /> -
*/} - -
- + } + ) diff --git a/web/app/components/app/configuration/config/config-audio.tsx b/web/app/components/app/configuration/config/config-audio.tsx index 5600f8cbb6..1616ee4244 100644 --- a/web/app/components/app/configuration/config/config-audio.tsx +++ b/web/app/components/app/configuration/config/config-audio.tsx @@ -16,7 +16,7 @@ const ConfigAudio: FC = () => { const { t } = useTranslation() const file = useFeatures(s => s.features.file) const featuresStore = useFeaturesStore() - const { isShowAudioConfig } = useContext(ConfigContext) + const { isShowAudioConfig, readonly } = useContext(ConfigContext) const isAudioEnabled = file?.allowed_file_types?.includes(SupportUploadFileTypes.audio) ?? false @@ -44,7 +44,7 @@ const ConfigAudio: FC = () => { setFeatures(newFeatures) }, [featuresStore]) - if (!isShowAudioConfig) + if (!isShowAudioConfig || (readonly && !isAudioEnabled)) return null return ( @@ -64,14 +64,16 @@ const ConfigAudio: FC = () => { } /> -
-
- -
+ {!readonly && ( +
+
+ +
+ )} ) } diff --git a/web/app/components/app/configuration/config/config-document.tsx b/web/app/components/app/configuration/config/config-document.tsx index 9300bbc712..daec96eb1a 100644 --- a/web/app/components/app/configuration/config/config-document.tsx +++ b/web/app/components/app/configuration/config/config-document.tsx @@ -16,7 +16,7 @@ const ConfigDocument: FC = () => { const { t } = useTranslation() const file = useFeatures(s => s.features.file) const featuresStore = useFeaturesStore() - const { isShowDocumentConfig } = useContext(ConfigContext) + const { isShowDocumentConfig, readonly } = useContext(ConfigContext) const isDocumentEnabled = file?.allowed_file_types?.includes(SupportUploadFileTypes.document) ?? false @@ -44,7 +44,7 @@ const ConfigDocument: FC = () => { setFeatures(newFeatures) }, [featuresStore]) - if (!isShowDocumentConfig) + if (!isShowDocumentConfig || (readonly && !isDocumentEnabled)) return null return ( @@ -64,14 +64,16 @@ const ConfigDocument: FC = () => { } /> -
-
- -
+ {!readonly && ( +
+
+ +
+ )} ) } diff --git a/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx b/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx index d439b00939..503aefc4fb 100644 --- a/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx +++ b/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx @@ -39,6 +39,7 @@ const DebugWithSingleModel = ( ) => { const { userProfile } = useAppContext() const { + readonly, modelConfig, appId, inputs, @@ -154,6 +155,7 @@ const DebugWithSingleModel = ( return ( = ({ const dataSets = dataSetData?.data || [] const isLoading = isLoadingAppDetail || isLoadingDatasets - const modelConfig = ((modelConfig?: BackendModelConfig) => { + const modelConfig: ModelConfig = ((modelConfig?: BackendModelConfig) => { if(isLoading || !modelConfig) return defaultModelConfig @@ -138,7 +140,7 @@ const Configuration: FC = ({ tools: [], } : DEFAULT_AGENT_SETTING, } - return newModelConfig + return (newModelConfig as any) })(appDetail?.model_config) const mode = appDetail?.mode // const isChatApp = ['chat', 'advanced-chat', 'agent-chat'].includes(mode!) @@ -172,12 +174,14 @@ const Configuration: FC = ({ const query = '' const completionParams = useState({}) - // todo - const currModel: { - features: ModelFeatureEnum[] - } = { - features: [], - } + const { + currentModel: currModel, + } = useTextGenerationCurrentProviderAndModelAndModelList( + { + provider: modelConfig.provider, + model: modelConfig.model_id, + }, + ) const isShowVisionConfig = !!currModel?.features?.includes(ModelFeatureEnum.vision) const isShowDocumentConfig = !!currModel?.features?.includes(ModelFeatureEnum.document) @@ -208,7 +212,7 @@ const Configuration: FC = ({ number_limits: modelConfig.file_upload?.image?.number_limits || 3, transfer_methods: modelConfig.file_upload?.image?.transfer_methods || ['local_file', 'remote_url'], }, - enabled: true, + enabled: !!(modelConfig.file_upload?.enabled || modelConfig.file_upload?.image?.enabled), allowed_file_types: modelConfig.file_upload?.allowed_file_types || [], allowed_file_extensions: modelConfig.file_upload?.allowed_file_extensions || [...FILE_EXTS[SupportUploadFileTypes.image], ...FILE_EXTS[SupportUploadFileTypes.video]].map(ext => `.${ext}`), allowed_file_upload_methods: modelConfig.file_upload?.allowed_file_upload_methods || modelConfig.file_upload?.image?.transfer_methods || ['local_file', 'remote_url'], diff --git a/web/app/components/base/action-button/index.tsx b/web/app/components/base/action-button/index.tsx index f70bfb4448..2aefef94f0 100644 --- a/web/app/components/base/action-button/index.tsx +++ b/web/app/components/base/action-button/index.tsx @@ -50,13 +50,14 @@ function getActionButtonState(state: ActionButtonState) { } } -const ActionButton = ({ className, size, state = ActionButtonState.Default, styleCss, children, ref, ...props }: ActionButtonProps) => { +const ActionButton = ({ className, size, state = ActionButtonState.Default, styleCss, children, ref, disabled, ...props }: ActionButtonProps) => { return ( + { + !hideEditEntrance && ( + + ) + } )} diff --git a/web/app/components/base/file-uploader/file-uploader-in-chat-input/index.tsx b/web/app/components/base/file-uploader/file-uploader-in-chat-input/index.tsx index 7e6e190ddb..91d6f22ef2 100644 --- a/web/app/components/base/file-uploader/file-uploader-in-chat-input/index.tsx +++ b/web/app/components/base/file-uploader/file-uploader-in-chat-input/index.tsx @@ -13,21 +13,27 @@ import { TransferMethod } from '@/types/app' type FileUploaderInChatInputProps = { fileConfig: FileUpload + readonly?: boolean } const FileUploaderInChatInput = ({ fileConfig, + readonly, }: FileUploaderInChatInputProps) => { const renderTrigger = useCallback((open: boolean) => { return ( ) }, []) + if(readonly) + return renderTrigger(false) + return (