From 738d3001be38cdbe2ac77593d8e950fe58704c5d Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 15 Oct 2025 14:45:54 +0800 Subject: [PATCH 1/7] chore: chat input and feature readonly --- .../debug/debug-with-single-model/index.tsx | 2 ++ web/app/components/base/action-button/index.tsx | 3 ++- .../base/chat/chat/chat-input-area/index.tsx | 14 ++++++++++++-- .../base/chat/chat/chat-input-area/operation.tsx | 11 ++++++++--- web/app/components/base/chat/chat/context.tsx | 7 ++++++- web/app/components/base/chat/chat/index.tsx | 4 ++++ .../features/new-feature-panel/feature-bar.tsx | 14 ++++++++++---- .../file-uploader-in-chat-input/index.tsx | 6 ++++++ web/i18n/en-US/common.ts | 1 + web/i18n/zh-Hans/common.ts | 1 + 10 files changed, 52 insertions(+), 11 deletions(-) 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 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 ( Date: Wed, 15 Oct 2025 15:21:09 +0800 Subject: [PATCH 2/7] chore: vision readonly --- .../app/configuration/config-vision/index.tsx | 80 +++++++++++-------- .../components/app/configuration/preview.tsx | 15 ++-- web/i18n/ja-JP/common.ts | 1 + 3 files changed, 58 insertions(+), 38 deletions(-) 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/preview.tsx b/web/app/components/app/configuration/preview.tsx index 7679ee13b6..92212ee515 100644 --- a/web/app/components/app/configuration/preview.tsx +++ b/web/app/components/app/configuration/preview.tsx @@ -25,6 +25,7 @@ import { useGetTryAppDataSets, useGetTryAppInfo } from '@/service/use-try-app' import { noop } from 'lodash' import { correctModelProvider } from '@/utils' import { userInputsFormToPromptVariables } from '@/utils/model-config' +import { useTextGenerationCurrentProviderAndModelAndModelList } from '../../header/account-setting/model-provider-page/hooks' type Props = { appId: string @@ -172,12 +173,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) diff --git a/web/i18n/ja-JP/common.ts b/web/i18n/ja-JP/common.ts index 52545c460b..45dbb2bd8d 100644 --- a/web/i18n/ja-JP/common.ts +++ b/web/i18n/ja-JP/common.ts @@ -654,6 +654,7 @@ const translation = { hitScore: '検索スコア:', }, inputPlaceholder: '{{botName}} と話す', + inputDisabledPlaceholder: 'プレビューのみ', thought: '思考', thinking: '考え中...', resend: '再送信してください', From 6f4518ebf72f4285021735e7d8efb2b14658c4d8 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 15 Oct 2025 15:27:18 +0800 Subject: [PATCH 3/7] chore: document readonly --- .../configuration/config/config-document.tsx | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/web/app/components/app/configuration/config/config-document.tsx b/web/app/components/app/configuration/config/config-document.tsx index 9300bbc712..06f608c6f0 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 @@ -64,14 +64,16 @@ const ConfigDocument: FC = () => { } /> -
-
- -
+ {!readonly && ( +
+
+ +
+ )} ) } From cad77ce0bf68caf5baa99b82435123e59a3cb4e3 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 15 Oct 2025 15:29:09 +0800 Subject: [PATCH 4/7] chore: audio config readonly --- .../app/configuration/config/config-audio.tsx | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/web/app/components/app/configuration/config/config-audio.tsx b/web/app/components/app/configuration/config/config-audio.tsx index 5600f8cbb6..aed236bcc6 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 @@ -64,14 +64,16 @@ const ConfigAudio: FC = () => { } /> -
-
- -
+ {!readonly && ( +
+
+ +
+ )} ) } From db9e5665c251ba1e6160012dfe6461e84ef64e7b Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 15 Oct 2025 15:35:49 +0800 Subject: [PATCH 5/7] fix: docuemnt and aduio show condition in preview --- web/app/components/app/configuration/config/config-audio.tsx | 2 +- web/app/components/app/configuration/config/config-document.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/app/components/app/configuration/config/config-audio.tsx b/web/app/components/app/configuration/config/config-audio.tsx index aed236bcc6..1616ee4244 100644 --- a/web/app/components/app/configuration/config/config-audio.tsx +++ b/web/app/components/app/configuration/config/config-audio.tsx @@ -44,7 +44,7 @@ const ConfigAudio: FC = () => { setFeatures(newFeatures) }, [featuresStore]) - if (!isShowAudioConfig) + if (!isShowAudioConfig || (readonly && !isAudioEnabled)) return null return ( diff --git a/web/app/components/app/configuration/config/config-document.tsx b/web/app/components/app/configuration/config/config-document.tsx index 06f608c6f0..daec96eb1a 100644 --- a/web/app/components/app/configuration/config/config-document.tsx +++ b/web/app/components/app/configuration/config/config-document.tsx @@ -44,7 +44,7 @@ const ConfigDocument: FC = () => { setFeatures(newFeatures) }, [featuresStore]) - if (!isShowDocumentConfig) + if (!isShowDocumentConfig || (readonly && !isDocumentEnabled)) return null return ( From 9e3dd69277e8ec36e9053b96b239f03957f42cf3 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 15 Oct 2025 15:51:18 +0800 Subject: [PATCH 6/7] fix: upload btn not sync right --- web/app/components/app/configuration/preview.tsx | 7 ++++--- web/models/debug.ts | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/web/app/components/app/configuration/preview.tsx b/web/app/components/app/configuration/preview.tsx index 92212ee515..315cbd6bd0 100644 --- a/web/app/components/app/configuration/preview.tsx +++ b/web/app/components/app/configuration/preview.tsx @@ -11,6 +11,7 @@ import Config from '@/app/components/app/configuration/config' import Debug from '@/app/components/app/configuration/debug' import { ModelFeatureEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import { ModelModeType, Resolution, TransferMethod } from '@/types/app' +import type { ModelConfig } from '@/models/debug' import { PromptMode } from '@/models/debug' import { ANNOTATION_DEFAULT, DEFAULT_AGENT_SETTING, DEFAULT_CHAT_PROMPT_CONFIG, DEFAULT_COMPLETION_PROMPT_CONFIG } from '@/config' import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' @@ -82,7 +83,7 @@ const Configuration: FC = ({ const dataSets = dataSetData?.data || [] const isLoading = isLoadingAppDetail || isLoadingDatasets - const modelConfig = ((modelConfig?: BackendModelConfig) => { + const modelConfig: ModelConfig = ((modelConfig?: BackendModelConfig) => { if(isLoading || !modelConfig) return defaultModelConfig @@ -139,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!) @@ -211,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/models/debug.ts b/web/models/debug.ts index 630c48a970..7748e16856 100644 --- a/web/models/debug.ts +++ b/web/models/debug.ts @@ -132,6 +132,9 @@ export type ModelConfig = { provider: string // LLM Provider: for example "OPENAI" model_id: string mode: ModelModeType + prompt_type: PromptMode + chat_prompt_config: ChatPromptConfig | null + completion_prompt_config: CompletionPromptConfig | null configs: PromptConfig opening_statement: string | null more_like_this: MoreLikeThisConfig | null From b07c76655118b388e36aaf4f112f6ca5a701a9d9 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 15 Oct 2025 16:00:14 +0800 Subject: [PATCH 7/7] chroe: fix ts problem --- web/models/debug.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/models/debug.ts b/web/models/debug.ts index 7748e16856..90995e72dc 100644 --- a/web/models/debug.ts +++ b/web/models/debug.ts @@ -132,9 +132,9 @@ export type ModelConfig = { provider: string // LLM Provider: for example "OPENAI" model_id: string mode: ModelModeType - prompt_type: PromptMode - chat_prompt_config: ChatPromptConfig | null - completion_prompt_config: CompletionPromptConfig | null + prompt_type?: PromptMode + chat_prompt_config?: ChatPromptConfig | null + completion_prompt_config?: CompletionPromptConfig | null configs: PromptConfig opening_statement: string | null more_like_this: MoreLikeThisConfig | null