From aee669f67d17cc9f9063671fe1acbd37c4a2a654 Mon Sep 17 00:00:00 2001 From: JzoNg Date: Wed, 3 Apr 2024 15:32:21 +0800 Subject: [PATCH] fix max length for paragraph --- web/app/(commonLayout)/apps/Apps.tsx | 1 - .../config-var/config-modal/index.tsx | 5 ++++- .../config-var/config-string/index.tsx | 16 ++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/web/app/(commonLayout)/apps/Apps.tsx b/web/app/(commonLayout)/apps/Apps.tsx index b032208c88..b753a6f8e4 100644 --- a/web/app/(commonLayout)/apps/Apps.tsx +++ b/web/app/(commonLayout)/apps/Apps.tsx @@ -46,7 +46,6 @@ const Apps = () => { const { isCurrentWorkspaceManager } = useAppContext() const [activeTab, setActiveTab] = useTabSearchParams({ defaultTab: 'all', - disableSearchParams: true, // use search params will distroy app list mutation }) const [keywords, setKeywords] = useState('') const [searchKeywords, setSearchKeywords] = useState('') diff --git a/web/app/components/app/configuration/config-var/config-modal/index.tsx b/web/app/components/app/configuration/config-var/config-modal/index.tsx index e2c4b96793..671b5a0bd1 100644 --- a/web/app/components/app/configuration/config-var/config-modal/index.tsx +++ b/web/app/components/app/configuration/config-var/config-modal/index.tsx @@ -16,6 +16,9 @@ import Modal from '@/app/components/base/modal' import Switch from '@/app/components/base/switch' import { ChangeType, InputVarType } from '@/app/components/workflow/types' +const TEXT_MAX_LENGTH = 256 +const PARAGRAPH_MAX_LENGTH = 1024 + export type IConfigModalProps = { isCreate?: boolean payload?: InputVar @@ -165,7 +168,7 @@ const ConfigModal: FC = ({ {isStringInput && ( - + )} diff --git a/web/app/components/app/configuration/config-var/config-string/index.tsx b/web/app/components/app/configuration/config-var/config-string/index.tsx index 2ec7e767b7..2c941cfa47 100644 --- a/web/app/components/app/configuration/config-var/config-string/index.tsx +++ b/web/app/components/app/configuration/config-var/config-string/index.tsx @@ -4,32 +4,32 @@ import React, { useEffect } from 'react' export type IConfigStringProps = { value: number | undefined + maxLength: number modelId: string onChange: (value: number | undefined) => void } -const MAX_LENGTH = 256 - const ConfigString: FC = ({ value, onChange, + maxLength, }) => { useEffect(() => { - if (value && value > MAX_LENGTH) - onChange(MAX_LENGTH) - }, [value, MAX_LENGTH]) + if (value && value > maxLength) + onChange(maxLength) + }, [value, maxLength, onChange]) return (
{ let value = parseInt(e.target.value, 10) - if (value > MAX_LENGTH) - value = MAX_LENGTH + if (value > maxLength) + value = maxLength else if (value < 1) value = 1