Skip to content

feat(docflow): replace ChatPanel with AgentEditPanel and agent suggestion flow#327

Merged
xun082 merged 2 commits intomainfrom
feat/docflow-agent-edit-panel
Mar 27, 2026
Merged

feat(docflow): replace ChatPanel with AgentEditPanel and agent suggestion flow#327
xun082 merged 2 commits intomainfrom
feat/docflow-agent-edit-panel

Conversation

@xun082
Copy link
Copy Markdown
Owner

@xun082 xun082 commented Mar 27, 2026

PR 描述

PR 类型

  • 🐛 Bug 修复
  • ✨ 新功能
  • 💄 UI/UX 改进
  • ♻️ 重构
  • 🚀 性能优化
  • 📝 文档更新
  • 🔄 其他

Issue 关联

Closes #

其他信息

xun082 added 2 commits March 26, 2026 16:07
…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
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 27, 2026

Deploy Preview for ornate-blancmange-89db6b failed. Why did it fail? →

Name Link
🔨 Latest commit 48d125c
🔍 Latest deploy log https://app.netlify.com/projects/ornate-blancmange-89db6b/deploys/69c5f6b153a8190008ea2958

@xun082 xun082 merged commit 32edc5f into main Mar 27, 2026
0 of 6 checks passed
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +947 to +948
const result: HistoryEntry['result'] =
prevPhase === 'error' ? 'error' : snap.proposals.length > 0 ? 'accepted' : 'error';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

历史记录的交互结果(result)计算不正确。

当前逻辑在 prevPhase 不是 'error' 时,只要 snap.proposals 数组不为空,就将 result 设置为 'accepted'。这会导致即使用户拒绝了所有提案,历史记录中依然显示为“已接受”。

为了正确反映用户的操作,需要跟踪每个提案是被接受还是被拒绝。一个可行的方案是:

  1. AgentEditPanel 组件中,使用 useState 来维护本轮交互中已接受和已拒绝的提案 ID 集合。
  2. onAcceptonReject 的处理函数中,更新这些集合。
  3. phase 变为 'idle' 时,在这里根据已接受和已拒绝的 ID 集合来计算正确的 result 值('accepted', 'rejected', 'partial')。
  4. 在开始新一轮交互时(例如在 handleSendhandleReset 中),清空这些 ID 集合。

这样可以确保历史记录准确地反映出每一轮交互的最终结果。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant