diff --git a/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx b/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx index 70e0334e98..6e38007b8d 100644 --- a/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx +++ b/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx @@ -25,7 +25,7 @@ import Tooltip from '@/app/components/base/tooltip' import PromptEditor from '@/app/components/base/prompt-editor' import ConfigContext from '@/context/debug-configuration' import { getNewVar, getVars } from '@/utils/var' -import { AppType } from '@/types/app' +import { AppModeEnum } from '@/types/app' import { useModalContext } from '@/context/modal-context' import type { ExternalDataTool } from '@/models/common' import { useToastContext } from '@/app/components/base/toast' @@ -100,7 +100,7 @@ const AdvancedPromptInput: FC = ({ }, }) } - const isChatApp = mode !== AppType.completion + const isChatApp = mode !== AppModeEnum.COMPLETION const [isCopied, setIsCopied] = React.useState(false) const promptVariablesObj = (() => { diff --git a/web/app/components/app/configuration/config-prompt/index.tsx b/web/app/components/app/configuration/config-prompt/index.tsx index ec34588e41..416f87e135 100644 --- a/web/app/components/app/configuration/config-prompt/index.tsx +++ b/web/app/components/app/configuration/config-prompt/index.tsx @@ -12,11 +12,13 @@ import Button from '@/app/components/base/button' import AdvancedMessageInput from '@/app/components/app/configuration/config-prompt/advanced-prompt-input' import { PromptRole } from '@/models/debug' import type { PromptItem, PromptVariable } from '@/models/debug' -import { type AppType, ModelModeType } from '@/types/app' +import type { AppModeEnum } from '@/types/app' +import { ModelModeType } from '@/types/app' import ConfigContext from '@/context/debug-configuration' import { MAX_PROMPT_MESSAGE_LENGTH } from '@/config' + export type IPromptProps = { - mode: AppType + mode: AppModeEnum promptTemplate: string promptVariables: PromptVariable[] readonly?: boolean diff --git a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx index 169e8a14a2..d9ba533dcf 100644 --- a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx +++ b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx @@ -10,7 +10,7 @@ import PromptEditorHeightResizeWrap from './prompt-editor-height-resize-wrap' import cn from '@/utils/classnames' import type { PromptVariable } from '@/models/debug' import Tooltip from '@/app/components/base/tooltip' -import { AppType } from '@/types/app' +import { AppModeEnum } from '@/types/app' import { getNewVar, getVars } from '@/utils/var' import AutomaticBtn from '@/app/components/app/configuration/config/automatic/automatic-btn' import type { GenRes } from '@/service/debug' @@ -29,7 +29,7 @@ import { useFeaturesStore } from '@/app/components/base/features/hooks' import { noop } from 'lodash-es' export type ISimplePromptInput = { - mode: AppType + mode: AppModeEnum promptTemplate: string promptVariables: PromptVariable[] readonly?: boolean @@ -153,7 +153,7 @@ const Prompt: FC = ({ setModelConfig(newModelConfig) setPrevPromptConfig(modelConfig.configs) - if (mode !== AppType.completion) { + if (mode !== AppModeEnum.COMPLETION) { setIntroduction(res.opening_statement || '') const newFeatures = produce(features, (draft) => { draft.opening = { @@ -175,7 +175,7 @@ const Prompt: FC = ({ {!noTitle && (
-
{mode !== AppType.completion ? t('appDebug.chatSubTitle') : t('appDebug.completionSubTitle')}
+
{mode !== AppModeEnum.COMPLETION ? t('appDebug.chatSubTitle') : t('appDebug.completionSubTitle')}
{!readonly && ( = ({ {showAutomatic && ( = ({ promptVariables, readonly, onPromptVar const handleRemoveVar = (index: number) => { const removeVar = promptVariables[index] - if (mode === AppType.completion && dataSets.length > 0 && removeVar.is_context_var) { + if (mode === AppModeEnum.COMPLETION && dataSets.length > 0 && removeVar.is_context_var) { showDeleteContextVarModal() setRemoveIndex(index) return diff --git a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx index 5c87eea3ca..33ff7b7b64 100644 --- a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx +++ b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx @@ -19,8 +19,7 @@ import Modal from '@/app/components/base/modal' import Button from '@/app/components/base/button' import Toast from '@/app/components/base/toast' import { generateBasicAppFirstTimeRule, generateRule } from '@/service/debug' -import type { CompletionParams, Model } from '@/types/app' -import type { AppType } from '@/types/app' +import type { AppModeEnum, CompletionParams, Model } from '@/types/app' import Loading from '@/app/components/base/loading' import Confirm from '@/app/components/base/confirm' @@ -44,7 +43,7 @@ import { useGenerateRuleTemplate } from '@/service/use-apps' const i18nPrefix = 'appDebug.generate' export type IGetAutomaticResProps = { - mode: AppType + mode: AppModeEnum isShow: boolean onClose: () => void onFinished: (res: GenRes) => void diff --git a/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx b/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx index 6fd1582491..3323ac6ca7 100644 --- a/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx +++ b/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx @@ -5,8 +5,8 @@ import { useTranslation } from 'react-i18next' import { languageMap } from '../../../../workflow/nodes/_base/components/editor/code-editor/index' import { generateRule } from '@/service/debug' import type { GenRes } from '@/service/debug' -import type { ModelModeType } from '@/types/app' -import type { AppType, CompletionParams, Model } from '@/types/app' +import type { AppModeEnum, ModelModeType } from '@/types/app' +import type { CompletionParams, Model } from '@/types/app' import Modal from '@/app/components/base/modal' import Button from '@/app/components/base/button' import { Generator } from '@/app/components/base/icons/src/vender/other' @@ -33,7 +33,7 @@ export type IGetCodeGeneratorResProps = { flowId: string nodeId: string currentCode?: string - mode: AppType + mode: AppModeEnum isShow: boolean codeLanguages: CodeLanguage onClose: () => void diff --git a/web/app/components/app/configuration/config/index.tsx b/web/app/components/app/configuration/config/index.tsx index 7e130a4e95..4e67d1bd32 100644 --- a/web/app/components/app/configuration/config/index.tsx +++ b/web/app/components/app/configuration/config/index.tsx @@ -14,8 +14,7 @@ import ConfigContext from '@/context/debug-configuration' import ConfigPrompt from '@/app/components/app/configuration/config-prompt' import ConfigVar from '@/app/components/app/configuration/config-var' import type { ModelConfig, PromptVariable } from '@/models/debug' -import type { AppType } from '@/types/app' -import { ModelModeType } from '@/types/app' +import { AppModeEnum, ModelModeType } from '@/types/app' const Config: FC = () => { const { @@ -29,7 +28,7 @@ const Config: FC = () => { setModelConfig, setPrevPromptConfig, } = useContext(ConfigContext) - const isChatApp = ['advanced-chat', 'agent-chat', 'chat'].includes(mode) + const isChatApp = [AppModeEnum.ADVANCED_CHAT, AppModeEnum.AGENT_CHAT, AppModeEnum.CHAT].includes(mode) const formattingChangedDispatcher = useFormattingChangedDispatcher() const promptTemplate = modelConfig.configs.prompt_template @@ -62,7 +61,7 @@ const Config: FC = () => { > {/* Template */} = ({ const [completionFiles, setCompletionFiles] = useState([]) const checkCanSend = useCallback(() => { - if (isAdvancedMode && mode !== AppType.completion) { + if (isAdvancedMode && mode !== AppModeEnum.COMPLETION) { if (modelModeType === ModelModeType.completion) { if (!hasSetBlockStatus.history) { notify({ type: 'error', message: t('appDebug.otherError.historyNoBeEmpty') }) @@ -411,7 +411,7 @@ const Debug: FC = ({ ) : null } - {mode !== AppType.completion && ( + {mode !== AppModeEnum.COMPLETION && ( <> = ({ )}
- {mode !== AppType.completion && expanded && ( + {mode !== AppModeEnum.COMPLETION && expanded && (
)} - {mode === AppType.completion && ( + {mode === AppModeEnum.COMPLETION && ( = ({ !debugWithMultipleModel && (
{/* Chat */} - {mode !== AppType.completion && ( + {mode !== AppModeEnum.COMPLETION && (
= ({
)} {/* Text Generation */} - {mode === AppType.completion && ( + {mode === AppModeEnum.COMPLETION && ( <> {(completionRes || isResponding) && ( <> @@ -529,7 +529,7 @@ const Debug: FC = ({ )} )} - {mode === AppType.completion && showPromptLogModal && ( + {mode === AppModeEnum.COMPLETION && showPromptLogModal && ( void inputs: Inputs visionConfig: VisionSettings @@ -55,7 +55,7 @@ const PromptValuePanel: FC = ({ }, [promptVariables]) const canNotRun = useMemo(() => { - if (mode !== AppType.completion) + if (mode !== AppModeEnum.COMPLETION) return true if (isAdvancedMode) { @@ -215,7 +215,7 @@ const PromptValuePanel: FC = ({
diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx index 2a43315e14..5272846d03 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx @@ -31,13 +31,13 @@ import Loading from '@/app/components/base/loading' import { useProviderContext } from '@/context/provider-context' import { PROVIDER_WITH_PRESET_TONE, STOP_PARAMETER_RULE, TONE_LIST } from '@/config' import { ArrowNarrowLeft } from '@/app/components/base/icons/src/vender/line/arrows' -import type { AppModeEnum } from '@/types/app' +import type { ModelModeType } from '@/types/app' export type ModelParameterModalProps = { popupClassName?: string portalToFollowElemContentClassName?: string isAdvancedMode: boolean - mode: AppModeEnum + mode: ModelModeType modelId: string provider: string setModel: (model: { modelId: string; provider: string; mode?: string; features?: string[] }) => void diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/selector-entry.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/selector-entry.tsx index 50279010e7..9e637423af 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/selector-entry.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/selector-entry.tsx @@ -42,8 +42,17 @@ const SubscriptionTriggerButton: React.FC = ({ } } + const selectedSubscription = subscriptions?.find(sub => sub.id === selectedId) + + if (!selectedSubscription) { + return { + label: t('pluginTrigger.subscription.subscriptionRemoved'), + color: 'red' as const, + } + } + return { - label: subscriptions?.find(sub => sub.id === selectedId)?.name || t('pluginTrigger.subscription.selectPlaceholder'), + label: selectedSubscription.name, color: 'green' as const, } }, [selectedId, subscriptions, t, isOpen]) diff --git a/web/app/components/workflow/nodes/_base/components/code-generator-button.tsx b/web/app/components/workflow/nodes/_base/components/code-generator-button.tsx index a62ffeb55f..21b1cf0595 100644 --- a/web/app/components/workflow/nodes/_base/components/code-generator-button.tsx +++ b/web/app/components/workflow/nodes/_base/components/code-generator-button.tsx @@ -6,7 +6,7 @@ import cn from 'classnames' import type { CodeLanguage } from '../../code/types' import { Generator } from '@/app/components/base/icons/src/vender/other' import { ActionButton } from '@/app/components/base/action-button' -import { AppType } from '@/types/app' +import { AppModeEnum } from '@/types/app' import type { GenRes } from '@/service/debug' import { GetCodeGeneratorResModal } from '@/app/components/app/configuration/config/code-generator/get-code-generator-res' import { useHooksStore } from '../../../hooks-store' @@ -42,7 +42,7 @@ const CodeGenerateBtn: FC = ({ {showAutomatic && ( = ({ {showAutomatic && ( :