feat(docflow): replace ChatPanel with AgentEditPanel and agent suggestion flow#327
feat(docflow): replace ChatPanel with AgentEditPanel and agent suggestion flow#327
Conversation
…tion flow remove legacy ChatPanel components and wire AgentEditPanel into docs page add agent suggestion extension/collaboration modules and update chat store/request client/style entry
…n various components
❌ Deploy Preview for ornate-blancmange-89db6b failed. Why did it fail? →
|
There was a problem hiding this comment.
Code Review
This pull request replaces the existing chat and brainstorm features with a new AI-powered document editing agent. Key additions include the AgentEditPanel component, a useDocumentEdit hook for managing multi-step streaming (intent, anchor, proposal), and a custom TipTap extension, AgentSuggestion, for handling diff-style highlights. Feedback highlights a logic error in the AgentEditPanel where history results are incorrectly marked as 'accepted' regardless of whether the user actually accepted or rejected the proposals.
| const result: HistoryEntry['result'] = | ||
| prevPhase === 'error' ? 'error' : snap.proposals.length > 0 ? 'accepted' : 'error'; |
There was a problem hiding this comment.
历史记录的交互结果(result)计算不正确。
当前逻辑在 prevPhase 不是 'error' 时,只要 snap.proposals 数组不为空,就将 result 设置为 'accepted'。这会导致即使用户拒绝了所有提案,历史记录中依然显示为“已接受”。
为了正确反映用户的操作,需要跟踪每个提案是被接受还是被拒绝。一个可行的方案是:
- 在
AgentEditPanel组件中,使用useState来维护本轮交互中已接受和已拒绝的提案 ID 集合。 - 在
onAccept和onReject的处理函数中,更新这些集合。 - 当
phase变为'idle'时,在这里根据已接受和已拒绝的 ID 集合来计算正确的result值('accepted','rejected','partial')。 - 在开始新一轮交互时(例如在
handleSend或handleReset中),清空这些 ID 集合。
这样可以确保历史记录准确地反映出每一轮交互的最终结果。
PR 描述
PR 类型
Issue 关联
Closes #
其他信息