diff --git a/web/app/components/base/prompt-editor/index.tsx b/web/app/components/base/prompt-editor/index.tsx index 9e076060c6..ebf37bc52a 100644 --- a/web/app/components/base/prompt-editor/index.tsx +++ b/web/app/components/base/prompt-editor/index.tsx @@ -165,7 +165,6 @@ const PromptEditor: FC = ({ externalToolBlock={externalToolBlock} workflowVariableBlock={workflowVariableBlock} /> - { contextBlock?.show && ( <> diff --git a/web/app/components/base/prompt-editor/plugins/context-block/node.tsx b/web/app/components/base/prompt-editor/plugins/context-block/node.tsx index 4bcd49b678..3800b9bb66 100644 --- a/web/app/components/base/prompt-editor/plugins/context-block/node.tsx +++ b/web/app/components/base/prompt-editor/plugins/context-block/node.tsx @@ -15,7 +15,7 @@ export class ContextBlockNode extends DecoratorNode { } static clone(node: ContextBlockNode): ContextBlockNode { - return new ContextBlockNode(node.__datasets, node.__onAddContext) + return new ContextBlockNode(node.__datasets, node.__onAddContext, node.getKey(), node.__canNotAddContext) } isInline(): boolean { @@ -46,7 +46,7 @@ export class ContextBlockNode extends DecoratorNode { nodeKey={this.getKey()} datasets={this.getDatasets()} onAddContext={this.getOnAddContext()} - canNotAddContext={this.__canNotAddContext} + canNotAddContext={this.getCanNotAddContext()} /> ) } @@ -63,6 +63,12 @@ export class ContextBlockNode extends DecoratorNode { return self.__onAddContext } + getCanNotAddContext(): boolean { + const self = this.getLatest() + + return self.__canNotAddContext + } + static importJSON(serializedNode: SerializedNode): ContextBlockNode { const node = $createContextBlockNode(serializedNode.datasets, serializedNode.onAddContext, serializedNode.canNotAddContext) @@ -75,7 +81,7 @@ export class ContextBlockNode extends DecoratorNode { version: 1, datasets: this.getDatasets(), onAddContext: this.getOnAddContext(), - canNotAddContext: this.__canNotAddContext, + canNotAddContext: this.getCanNotAddContext(), } }