Merge pull request #616 from SuanmoSuanyangTechnology/fix/v0.2.8_zy
fix(web): workflow memory not allowed change
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-02-02 15:01:59
|
* @Date: 2026-02-02 15:01:59
|
||||||
* @Last Modified by: ZhaoYing
|
* @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<ButtonCheckboxProps> = ({
|
|||||||
icon,
|
icon,
|
||||||
checkedIcon,
|
checkedIcon,
|
||||||
children,
|
children,
|
||||||
cicle = false
|
cicle = false,
|
||||||
|
disabled,
|
||||||
}) => {
|
}) => {
|
||||||
// Listen to value changes and trigger side effects via onValueChange callback
|
// Listen to value changes and trigger side effects via onValueChange callback
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -70,6 +71,7 @@ const ButtonCheckbox: FC<ButtonCheckboxProps> = ({
|
|||||||
"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,
|
"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
|
// Unchecked state: gray border and dark text
|
||||||
"rb:border-[#DFE4ED] rb:text-[#212332]": !checked,
|
"rb:border-[#DFE4ED] rb:text-[#212332]": !checked,
|
||||||
|
"rb:opacity-65 rb:cursor-not-allowed!": disabled
|
||||||
})}
|
})}
|
||||||
onClick={handleChange}
|
onClick={handleChange}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2025-12-10 16:46:17
|
* @Date: 2025-12-10 16:46:17
|
||||||
* @Last Modified by: ZhaoYing
|
* @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 { type FC, useRef, useEffect, useState } from 'react'
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
@@ -118,7 +118,7 @@ const ChatContent: FC<ChatContentProps> = ({
|
|||||||
{labelFormat(item)}
|
{labelFormat(item)}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{item.meta_data?.files && item.meta_data?.files.length > 0 && <Flex vertical align="end">
|
{item.meta_data?.files && item.meta_data?.files.length > 0 && <Flex gap={8} vertical align="end">
|
||||||
{item.meta_data?.files?.map((file) => {
|
{item.meta_data?.files?.map((file) => {
|
||||||
if (file.type.includes('image')) {
|
if (file.type.includes('image')) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-02-03 16:58:03
|
* @Date: 2026-02-03 16:58:03
|
||||||
* @Last Modified by: ZhaoYing
|
* @Last Modified by: ZhaoYing
|
||||||
* @Last Modified time: 2026-03-18 20:54:00
|
* @Last Modified time: 2026-03-19 12:30:41
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Conversation Page
|
* Conversation Page
|
||||||
@@ -63,6 +63,7 @@ const Conversation: FC = () => {
|
|||||||
const [isHasMemory, setIsHasMemory] = useState(false)
|
const [isHasMemory, setIsHasMemory] = useState(false)
|
||||||
const [memory, setMemory] = useState(true)
|
const [memory, setMemory] = useState(true)
|
||||||
const [features, setFeatures] = useState<FeaturesConfigForm>({} as FeaturesConfigForm)
|
const [features, setFeatures] = useState<FeaturesConfigForm>({} as FeaturesConfigForm)
|
||||||
|
const [config, setConfig] = useState<Record<string, any>>({})
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const shareToken = localStorage.getItem(`shareToken_${token}`)
|
const shareToken = localStorage.getItem(`shareToken_${token}`)
|
||||||
@@ -88,6 +89,7 @@ const Conversation: FC = () => {
|
|||||||
.then(res => {
|
.then(res => {
|
||||||
const response = res as { variables: Variable[]; features: FeaturesConfigForm; app_type: string; memory?: boolean; }
|
const response = res as { variables: Variable[]; features: FeaturesConfigForm; app_type: string; memory?: boolean; }
|
||||||
toolbarRef.current?.setVariables(response.variables || [])
|
toolbarRef.current?.setVariables(response.variables || [])
|
||||||
|
setConfig(response)
|
||||||
setFeatures(response.features)
|
setFeatures(response.features)
|
||||||
setIsHasMemory((response.app_type === 'workflow' && response.memory) || (response.app_type !== 'workflow'))
|
setIsHasMemory((response.app_type === 'workflow' && response.memory) || (response.app_type !== 'workflow'))
|
||||||
})
|
})
|
||||||
@@ -284,6 +286,7 @@ const Conversation: FC = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleChangeMemory = (value: boolean) => {
|
const handleChangeMemory = (value: boolean) => {
|
||||||
|
if (config.app_type === 'workflow') return;
|
||||||
modal.confirm({
|
modal.confirm({
|
||||||
title: value ? t('memoryConversation.memoryTipTitle') : t('memoryConversation.memoryCancelTipTitle'),
|
title: value ? t('memoryConversation.memoryTipTitle') : t('memoryConversation.memoryCancelTipTitle'),
|
||||||
okText: t('common.confirm'),
|
okText: t('common.confirm'),
|
||||||
@@ -388,6 +391,7 @@ const Conversation: FC = () => {
|
|||||||
icon={MemoryFunctionIcon}
|
icon={MemoryFunctionIcon}
|
||||||
checkedIcon={MemoryFunctionCheckedIcon}
|
checkedIcon={MemoryFunctionCheckedIcon}
|
||||||
checked={memory}
|
checked={memory}
|
||||||
|
disabled={config.app_type === 'workflow'}
|
||||||
onChange={handleChangeMemory}
|
onChange={handleChangeMemory}
|
||||||
>
|
>
|
||||||
{t('memoryConversation.memory')}
|
{t('memoryConversation.memory')}
|
||||||
|
|||||||
Reference in New Issue
Block a user