From ebd51928d73237a53d4f0dc6dd4ec5516b50631a Mon Sep 17 00:00:00 2001 From: zhaoying Date: Thu, 19 Mar 2026 13:42:06 +0800 Subject: [PATCH] fix(web): workflow memory not allowed change --- web/src/components/ButtonCheckbox/index.tsx | 6 ++++-- web/src/components/Chat/ChatContent.tsx | 4 ++-- web/src/views/Conversation/index.tsx | 6 +++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/web/src/components/ButtonCheckbox/index.tsx b/web/src/components/ButtonCheckbox/index.tsx index 41824fd1..18bca7c6 100644 --- a/web/src/components/ButtonCheckbox/index.tsx +++ b/web/src/components/ButtonCheckbox/index.tsx @@ -2,7 +2,7 @@ * @Author: ZhaoYing * @Date: 2026-02-02 15:01:59 * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-03-17 15:35:34 + * @Last Modified time: 2026-03-19 13:41:26 */ /** @@ -42,7 +42,8 @@ const ButtonCheckbox: FC = ({ icon, checkedIcon, children, - cicle = false + cicle = false, + disabled, }) => { // Listen to value changes and trigger side effects via onValueChange callback useEffect(() => { @@ -70,6 +71,7 @@ const ButtonCheckbox: FC = ({ "rb:bg-[rgba(21,94,239,0.06)] rb:border-[rgba(21,94,239,0.25)] rb:hover:bg-[rgba(21,94,239,0.06)] rb:text-[#155EEF]": checked, // Unchecked state: gray border and dark text "rb:border-[#DFE4ED] rb:text-[#212332]": !checked, + "rb:opacity-65 rb:cursor-not-allowed!": disabled })} onClick={handleChange} > diff --git a/web/src/components/Chat/ChatContent.tsx b/web/src/components/Chat/ChatContent.tsx index c73d91f5..c77e8384 100644 --- a/web/src/components/Chat/ChatContent.tsx +++ b/web/src/components/Chat/ChatContent.tsx @@ -2,7 +2,7 @@ * @Author: ZhaoYing * @Date: 2025-12-10 16:46:17 * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-03-19 10:37:01 + * @Last Modified time: 2026-03-19 13:38:20 */ import { type FC, useRef, useEffect, useState } from 'react' import clsx from 'clsx' @@ -118,7 +118,7 @@ const ChatContent: FC = ({ {labelFormat(item)} } - {item.meta_data?.files && item.meta_data?.files.length > 0 && + {item.meta_data?.files && item.meta_data?.files.length > 0 && {item.meta_data?.files?.map((file) => { if (file.type.includes('image')) { return ( diff --git a/web/src/views/Conversation/index.tsx b/web/src/views/Conversation/index.tsx index 9774a8df..3a726746 100644 --- a/web/src/views/Conversation/index.tsx +++ b/web/src/views/Conversation/index.tsx @@ -2,7 +2,7 @@ * @Author: ZhaoYing * @Date: 2026-02-03 16:58:03 * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-03-18 20:54:00 + * @Last Modified time: 2026-03-19 12:30:41 */ /** * Conversation Page @@ -63,6 +63,7 @@ const Conversation: FC = () => { const [isHasMemory, setIsHasMemory] = useState(false) const [memory, setMemory] = useState(true) const [features, setFeatures] = useState({} as FeaturesConfigForm) + const [config, setConfig] = useState>({}) useEffect(() => { const shareToken = localStorage.getItem(`shareToken_${token}`) @@ -88,6 +89,7 @@ const Conversation: FC = () => { .then(res => { const response = res as { variables: Variable[]; features: FeaturesConfigForm; app_type: string; memory?: boolean; } toolbarRef.current?.setVariables(response.variables || []) + setConfig(response) setFeatures(response.features) setIsHasMemory((response.app_type === 'workflow' && response.memory) || (response.app_type !== 'workflow')) }) @@ -284,6 +286,7 @@ const Conversation: FC = () => { } const handleChangeMemory = (value: boolean) => { + if (config.app_type === 'workflow') return; modal.confirm({ title: value ? t('memoryConversation.memoryTipTitle') : t('memoryConversation.memoryCancelTipTitle'), okText: t('common.confirm'), @@ -388,6 +391,7 @@ const Conversation: FC = () => { icon={MemoryFunctionIcon} checkedIcon={MemoryFunctionCheckedIcon} checked={memory} + disabled={config.app_type === 'workflow'} onChange={handleChangeMemory} > {t('memoryConversation.memory')}