feat: ai apply ui (#12962)

## New Features
* **Block Meta Markdown Adapter**:Inject the Block's metadata into
Markdown.
* **UI**:Apply interaction
   * **Widget**
* Block-Level Widget: Displays the diffs of individual blocks within the
main content and supports accepting/rejecting individual diffs.
* Page-Level Widget: Displays global options (Accept all/Reject all).
   * **Block Diff Service**:Bridge widget and diff data
* Widget subscribes to DiffMap(RenderDiff) data, refreshing the view
when the data changes.
* Widget performs operations such as Accept/Reject via methods provided
by Service.
   * **Doc Edit Tool Card**:
     * Display apply preview of semantic doc edit
     * Support apply & accept/reject to the main content
* **Apply Playground**:A devtool for testing apply new content to
current

> CLOSE AI-274 AI-275 AI-276  AI-278 

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Introduced block-level markdown diffing with accept/reject controls
for insertions, deletions, and updates.
* Added block diff widgets for individual blocks and pages, featuring
navigation and bulk accept/reject actions.
* Provided a block diff playground for testing and previewing markdown
changes (development mode only).
* Added a new document editing AI tool component with interactive diff
viewing and change application.
* Supported rendering of the document editing tool within AI chat
content streams.

* **Improvements**
* Enhanced widget rendering in list, paragraph, data view, and database
blocks for improved extensibility.
* Improved widget flavour matching with hierarchical wildcard support
for more flexible UI integration.

* **Chores**
* Updated the "@toeverything/theme" dependency to version ^1.1.16 across
multiple packages.
* Added new workspace dependencies for core frontend packages to improve
module linkage.
* Extended global styles with visual highlights for deleted blocks in AI
block diff feature.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
德布劳外 · 贾贵
2025-07-08 11:44:44 +08:00
committed by GitHub
parent 810143be87
commit 6fd9524521
88 changed files with 1873 additions and 152 deletions

View File

@@ -50,7 +50,7 @@ Important Instructions:
Example Input Document:
\`\`\`md
<!-- block_id=block-001 type=h1 -->
<!-- block_id=block-001 type=paragraph -->
# My Holiday Plan
<!-- block_id=block-002 type=paragraph -->
@@ -60,15 +60,24 @@ I plan to travel to Paris, France, where I will visit the Eiffel Tower, the Louv
I love Paris.
<!-- block_id=block-004 type=paragraph -->
This plan has been brewing for a long time, but I always postponed it because I was too busy with work.
## Reason for the delay
<!-- block_id=block-005 type=paragraph -->
- Book flight tickets
- Reserve a hotel
- Prepare visa documents
- Plan the itinerary
This plan has been brewing for a long time, but I always postponed it because I was too busy with work.
<!-- block_id=block-006 type=paragraph -->
## Trip Steps
<!-- block_id=block-007 type=list -->
- Book flight tickets
<!-- block_id=block-008 type=list -->
- Reserve a hotel
<!-- block_id=block-009 type=list -->
- Prepare visa documents
<!-- block_id=block-010 type=list -->
- Plan the itinerary
<!-- block_id=block-011 type=paragraph -->
Additionally, I plan to learn some basic French to make communication easier during the trip.
\`\`\`
@@ -91,15 +100,23 @@ I love Paris.
<!-- delete block-004 -->
<!-- block_id=block-005 type=paragraph -->
<!-- delete block-005 -->
<!-- block_id=block-006 type=paragraph -->
## Trip Steps
<!-- block_id=block-007 type=list -->
- 订机票
<!-- block_id=block-008 type=list -->
- 预定酒店
<!-- block_id=block-009 type=list -->
- 准备签证材料
<!-- block_id=block-010 type=list -->
- 规划行程
<!-- existing blocks ... -->
<!-- block_id=block-006 type=paragraph -->
<!-- block_id=block-011 type=paragraph -->
**Additionally, I plan to learn some basic French to make communication easier during the trip.**
\`\`\`
You should specify the following arguments before the others: [doc_id], [origin_content]
@@ -149,6 +166,7 @@ You should specify the following arguments before the others: [doc_id], [origin_
content: `<code>${content}</code>\n<update>${code_edit}</update>`,
},
]);
return { result };
} catch {
return 'Failed to apply edit to the doc';