Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: auto prompt (#2768)
zxhlyh9beefd7d5ade
diff --git a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsxindex 9ed2464598a..01a3b3e7af6 100644--- a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx+++ b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx@@ -26,6 +26,7 @@ import { ArrowNarrowRight } from '@/app/components/base/icons/src/vender/line/arimport { useEventEmitterContextContext } from '@/context/event-emitter'import { ADD_EXTERNAL_DATA_TOOL } from '@/app/components/app/configuration/config-var'import { INSERT_VARIABLE_VALUE_BLOCK_COMMAND } from '@/app/components/base/prompt-editor/plugins/variable-block'+import { PROMPT_EDITOR_UPDATE_VALUE_BY_EVENT_EMITTER } from '@/app/components/base/prompt-editor/plugins/update-block'export type ISimplePromptInput = {mode: AppType@@ -125,6 +126,10 @@ const Prompt: FC<ISimplePromptInput> = ({if (mode === AppType.chat)setIntroduction(res.opening_statement)showAutomaticFalse()+ eventEmitter?.emit({+ type: PROMPT_EDITOR_UPDATE_VALUE_BY_EVENT_EMITTER,+ payload: res.prompt,+ } as any)}const minHeight = 228const [editorHeight, setEditorHeight] = useState(minHeight)diff --git a/web/app/components/base/prompt-editor/index.tsx b/web/app/components/base/prompt-editor/index.tsxindex cadfce14405..c0ff99e4d89 100644--- a/web/app/components/base/prompt-editor/index.tsx+++ b/web/app/components/base/prompt-editor/index.tsx@@ -32,6 +32,7 @@ import VariableValueBlock from './plugins/variable-value-block'import { VariableValueBlockNode } from './plugins/variable-value-block/node'import { CustomTextNode } from './plugins/custom-text/node'import OnBlurBlock from './plugins/on-blur-block'+import UpdateBlock from './plugins/update-block'import { textToEditorState } from './utils'import type { Dataset } from './plugins/context-block'import type { RoleName } from './plugins/history-block'@@ -222,6 +223,7 @@ const PromptEditor: FC<PromptEditorProps> = ({<VariableValueBlock /><OnChangePlugin onChange={handleEditorChange} /><OnBlurBlock onBlur={onBlur} />+ <UpdateBlock />{/* <TreeView /> */}</div></LexicalComposer>diff --git a/web/app/components/base/prompt-editor/plugins/update-block.tsx b/web/app/components/base/prompt-editor/plugins/update-block.tsxnew file mode 100644index 00000000000..df84aa02e6c--- /dev/null+++ b/web/app/components/base/prompt-editor/plugins/update-block.tsx@@ -0,0 +1,21 @@+import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'+import { textToEditorState } from '../utils'+import { useEventEmitterContextContext } from '@/context/event-emitter'++export const PROMPT_EDITOR_UPDATE_VALUE_BY_EVENT_EMITTER = 'PROMPT_EDITOR_UPDATE_VALUE_BY_EVENT_EMITTER'++const UpdateBlock = () => {+ const { eventEmitter } = useEventEmitterContextContext()+ const [editor] = useLexicalComposerContext()++ eventEmitter?.useSubscription((v: any) => {+ if (v.type === PROMPT_EDITOR_UPDATE_VALUE_BY_EVENT_EMITTER) {+ const editorState = editor.parseEditorState(textToEditorState(v.payload))+ editor.setEditorState(editorState)+ }+ })++ return null+}++export default UpdateBlock