Revert "fix(web): prompt editor"#906
Merged
shuqinzhao merged 1 commit intorelease/v0.3.0from Apr 15, 2026
Merged
Conversation
This reverts commit 71e5b65.
Contributor
审阅者指南回滚之前的流式提示词编辑器行为和面板组件,改为更简单、可滚动的 Lexical 编辑器和通用的 ChatContent 列表,并在 Prompt 和 AiPromptModal 中清理相关的状态和 ref。 SSE 流式写入编辑器和聊天列表的时序图sequenceDiagram
actor User
participant Prompt
participant SSEClient
participant Backend
participant Editor as EditorRef
participant Chat as ChatContent
User->>Prompt: Click send(message)
Prompt->>Backend: createPromptSessions()
Backend-->>Prompt: sessionId
Prompt->>Backend: sendPrompt(sessionId, message)
Backend-->>SSEClient: SSE stream
loop SSE events
SSEClient-->>Prompt: handleStreamMessage(data[])
Prompt->>Prompt: for each item in data
alt event == start
Prompt->>Prompt: currentPromptValueRef = ""
Prompt->>Editor: clear()
else event == message (content)
Prompt->>Prompt: currentPromptValueRef += content
Prompt->>Editor: appendText(content)
Prompt->>Editor: scrollToBottom()
end
alt event == message (desc)
Prompt->>Prompt: chatList.push({role: assistant, content: desc})
Prompt->>Chat: re-render with new data
end
alt event == message (variables)
Prompt->>Prompt: setVariables(variables)
end
alt event == end
Prompt->>Prompt: loading = false
Prompt->>Prompt: form.current_prompt = currentPromptValueRef
end
end
回滚后的提示词编辑器和聊天组件类图classDiagram
class LexicalEditorProps {
+string value
+string placeholder
+function onChange(value)
+number height
+boolean disabled
}
class EditorRef {
+function setContent(value)
+function appendText(text)
+function clear()
+function scrollToBottom()
}
class EditorContent {
+ReactRef editorRef
+function appendText(text)
+function scrollToBottom()
}
class Editor {
+LexicalEditorProps props
+EditorRef ref
}
class ChatItem {
+string role
+string content
}
class ChatContent {
+ChatItem[] data
+boolean streamLoading
+string labelPosition
+string classNames
+string contentClassNames
+ReactNode empty
+function labelFormat(item)
}
class PromptChatPanel {
<<removed>>
+function append(item)
+function clear()
}
class Prompt {
-boolean loading
-FormInstance form
-ChatItem[] chatList
-string[] variables
-string promptSession
-PromptVariableModalRef aiPromptVariableModalRef
-PromptSaveModalRef promptSaveModalRef
-EditorRef editorRef
-string currentPromptValueRef
-HistoryItem editVo
-function handleSend()
-function handleRefresh()
-function updateSession()
}
class AiPromptModal {
-boolean visible
-boolean loading
-FormInstance form
-ChatItem[] chatList
-string[] variables
-string promptSession
-AiPromptVariableModalRef aiPromptVariableModalRef
-EditorRef editorRef
-string currentPromptValueRef
-function handleOpen(initialValue)
-function handleClose()
-function handleSend()
}
Editor o-- LexicalEditorProps
EditorContent ..|> EditorRef
Prompt --> EditorRef
Prompt --> ChatContent
Prompt --> ChatItem
AiPromptModal --> EditorRef
AiPromptModal --> ChatContent
AiPromptModal --> ChatItem
ChatContent --> ChatItem
PromptChatPanel <|.. ChatContent
文件级变更
提示与命令与 Sourcery 交互
自定义你的体验访问你的 dashboard 来:
获取帮助Original review guide in EnglishReviewer's GuideReverts the previous streaming prompt editor behavior and panel component in favor of a simpler, scrollable Lexical editor and a generic ChatContent list, while cleaning up related state and refs in Prompt and AiPromptModal. Sequence diagram for SSE streaming to editor and chat listsequenceDiagram
actor User
participant Prompt
participant SSEClient
participant Backend
participant Editor as EditorRef
participant Chat as ChatContent
User->>Prompt: Click send(message)
Prompt->>Backend: createPromptSessions()
Backend-->>Prompt: sessionId
Prompt->>Backend: sendPrompt(sessionId, message)
Backend-->>SSEClient: SSE stream
loop SSE events
SSEClient-->>Prompt: handleStreamMessage(data[])
Prompt->>Prompt: for each item in data
alt event == start
Prompt->>Prompt: currentPromptValueRef = ""
Prompt->>Editor: clear()
else event == message (content)
Prompt->>Prompt: currentPromptValueRef += content
Prompt->>Editor: appendText(content)
Prompt->>Editor: scrollToBottom()
end
alt event == message (desc)
Prompt->>Prompt: chatList.push({role: assistant, content: desc})
Prompt->>Chat: re-render with new data
end
alt event == message (variables)
Prompt->>Prompt: setVariables(variables)
end
alt event == end
Prompt->>Prompt: loading = false
Prompt->>Prompt: form.current_prompt = currentPromptValueRef
end
end
Class diagram for reverted prompt editor and chat componentsclassDiagram
class LexicalEditorProps {
+string value
+string placeholder
+function onChange(value)
+number height
+boolean disabled
}
class EditorRef {
+function setContent(value)
+function appendText(text)
+function clear()
+function scrollToBottom()
}
class EditorContent {
+ReactRef editorRef
+function appendText(text)
+function scrollToBottom()
}
class Editor {
+LexicalEditorProps props
+EditorRef ref
}
class ChatItem {
+string role
+string content
}
class ChatContent {
+ChatItem[] data
+boolean streamLoading
+string labelPosition
+string classNames
+string contentClassNames
+ReactNode empty
+function labelFormat(item)
}
class PromptChatPanel {
<<removed>>
+function append(item)
+function clear()
}
class Prompt {
-boolean loading
-FormInstance form
-ChatItem[] chatList
-string[] variables
-string promptSession
-PromptVariableModalRef aiPromptVariableModalRef
-PromptSaveModalRef promptSaveModalRef
-EditorRef editorRef
-string currentPromptValueRef
-HistoryItem editVo
-function handleSend()
-function handleRefresh()
-function updateSession()
}
class AiPromptModal {
-boolean visible
-boolean loading
-FormInstance form
-ChatItem[] chatList
-string[] variables
-string promptSession
-AiPromptVariableModalRef aiPromptVariableModalRef
-EditorRef editorRef
-string currentPromptValueRef
-function handleOpen(initialValue)
-function handleClose()
-function handleSend()
}
Editor o-- LexicalEditorProps
EditorContent ..|> EditorRef
Prompt --> EditorRef
Prompt --> ChatContent
Prompt --> ChatItem
AiPromptModal --> EditorRef
AiPromptModal --> ChatContent
AiPromptModal --> ChatItem
ChatContent --> ChatItem
PromptChatPanel <|.. ChatContent
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - 我在这里给出一些整体性的反馈:
LexicalEditorProps中的height属性已经改回为number类型,但在EditorContent中已经不再被使用;建议将其从该接口以及所有调用方中移除,以避免无用属性和潜在的困惑。- 代码里还残留了几处
console.log语句(例如Prompt中的updateSession、以及AiPromptModal中打印values的日志),看起来像是调试遗留,应在合并前移除。
提供给 AI Agent 的提示
Please address the comments from this code review:
## Overall Comments
- The `height` prop in `LexicalEditorProps` has been changed back to `number` but is no longer used anywhere in `EditorContent`; consider removing it from the interface and any callers to avoid dead props and confusion.
- There are a couple of leftover `console.log` statements (e.g., `updateSession` in `Prompt` and the `values` log in `AiPromptModal`) that look like debugging artifacts and should be removed before merging.帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈来改进之后的评审。
Original comment in English
Hey - I've left some high level feedback:
- The
heightprop inLexicalEditorPropshas been changed back tonumberbut is no longer used anywhere inEditorContent; consider removing it from the interface and any callers to avoid dead props and confusion. - There are a couple of leftover
console.logstatements (e.g.,updateSessioninPromptand thevalueslog inAiPromptModal) that look like debugging artifacts and should be removed before merging.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `height` prop in `LexicalEditorProps` has been changed back to `number` but is no longer used anywhere in `EditorContent`; consider removing it from the interface and any callers to avoid dead props and confusion.
- There are a couple of leftover `console.log` statements (e.g., `updateSession` in `Prompt` and the `values` log in `AiPromptModal`) that look like debugging artifacts and should be removed before merging.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This reverts commit 71e5b65.
Summary by Sourcery
用更简单的「聊天列表 + 编辑器」流程替换自定义提示词聊天面板集成,并调整提示词编辑器的滚动和布局行为。
新功能:
ChatContent组件进行提示词会话的就地聊天列表渲染,替代专用的提示词聊天面板。改进:
height属性改为数值类型,并依赖启用overflow的编辑器根节点来处理滚动。hasPrompt/isStreaming标志,仅通过表单状态和appendText驱动编辑器,并启用自动滚动。杂务:
PromptChatPanel组件,并将其使用场景迁移到共享的ChatContent组件上。Original summary in English
Summary by Sourcery
Replace the custom prompt chat panel integration with a simpler chat list + editor flow and adjust the prompt editor’s scrolling and layout behavior.
New Features:
Enhancements:
Chores: