diff --git a/web/app/components/workflow/nodes/llm/components/memory-system/hooks.ts b/web/app/components/workflow/nodes/llm/components/memory-system/hooks.ts index 593280b531..afd242da3d 100644 --- a/web/app/components/workflow/nodes/llm/components/memory-system/hooks.ts +++ b/web/app/components/workflow/nodes/llm/components/memory-system/hooks.ts @@ -14,7 +14,7 @@ export const useMemory = ( id: string, data: LLMNodeType, ) => { - const { memory = {} as Memory } = data + const { memory } = data const initCollapsed = useMemo(() => { if (!memory?.enabled) return true @@ -74,16 +74,19 @@ export const useMemory = ( }, [handleNodeDataUpdate]) const memoryType = useMemo(() => { - if (memory?.enabled) { + if (!memory) + return 'disabled' + + if (!('enabled' in memory)) + return 'linear' + + if (memory.enabled) { if (memory.mode === 'linear') return 'linear' if (memory.mode === 'block') return 'block' } else { - if (memory?.window?.enabled) - return 'linear' - return 'disabled' } }, [memory]) diff --git a/web/app/components/workflow/nodes/llm/components/memory-system/index.tsx b/web/app/components/workflow/nodes/llm/components/memory-system/index.tsx index 3ab14758a5..91ee802d08 100644 --- a/web/app/components/workflow/nodes/llm/components/memory-system/index.tsx +++ b/web/app/components/workflow/nodes/llm/components/memory-system/index.tsx @@ -14,6 +14,7 @@ import LinearMemory from './linear-memory' import type { Memory } from '@/app/components/workflow/types' import type { LLMNodeType } from '../../types' import { useMemory } from './hooks' +import Split from '@/app/components/workflow/nodes/_base/components/split' type MemoryProps = Pick & { readonly?: boolean @@ -37,7 +38,7 @@ const MemorySystem = ({ return ( <> -
+
+
) diff --git a/web/app/components/workflow/nodes/llm/components/memory-system/memory-create-button.tsx b/web/app/components/workflow/nodes/llm/components/memory-system/memory-create-button.tsx index 4236791710..b55fae28ea 100644 --- a/web/app/components/workflow/nodes/llm/components/memory-system/memory-create-button.tsx +++ b/web/app/components/workflow/nodes/llm/components/memory-system/memory-create-button.tsx @@ -41,11 +41,7 @@ const MemoryCreateButton = () => { setOpen(v => !v)}> diff --git a/web/app/components/workflow/nodes/llm/panel.tsx b/web/app/components/workflow/nodes/llm/panel.tsx index 3bb9e2cba7..c39f7386c3 100644 --- a/web/app/components/workflow/nodes/llm/panel.tsx +++ b/web/app/components/workflow/nodes/llm/panel.tsx @@ -172,7 +172,7 @@ const Panel: FC> = ({ )} {/* Memory put place examples. */} - {isChatMode && isChatModel && !!inputs.memory && ( + {isChatMode && isChatModel && !!inputs.memory?.enabled && (
@@ -218,7 +218,6 @@ const Panel: FC> = ({ {/* Memory */} {isChatMode && ( <> -