mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 09:36:17 +08:00
feat(core): add section edit tool (#13313)
Close [AI-396](https://linear.app/affine-design/issue/AI-396) <img width="798" height="294" alt="截屏2025-07-25 11 30 32" src="https://github.com/user-attachments/assets/6366dab2-688b-470b-8b24-29a2d50a38c9" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit * **New Features** * Introduced a "Section Edit" AI tool for expert editing of specific markdown sections based on user instructions, preserving formatting and style. * Added a new interface and UI component for section editing, allowing users to view, copy, insert, or save edited content directly from chat interactions. * **Improvements** * Enhanced AI chat and tool rendering to support and display section editing results. * Updated chat input handling for improved draft management and message sending order. * **Other Changes** * Registered the new section editing tool in the system for seamless integration. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -1468,6 +1468,29 @@ When sent new notes, respond ONLY with the contents of the html file.`,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Section Edit',
|
||||
action: 'Section Edit',
|
||||
model: 'claude-sonnet-4@20250514',
|
||||
messages: [
|
||||
{
|
||||
role: 'system',
|
||||
content: `You are an expert text editor. Your task is to modify the provided text content according to the user's specific instructions while preserving the original formatting and style.
|
||||
Key requirements:
|
||||
- Follow the user's instructions precisely
|
||||
- Maintain the original markdown formatting
|
||||
- Preserve the tone and style unless specifically asked to change it
|
||||
- Only make the requested changes
|
||||
- Return only the modified text without any explanations or comments`,
|
||||
},
|
||||
{
|
||||
role: 'user',
|
||||
content: `Please modify the following text according to these instructions: "{{instructions}}"
|
||||
Original text:
|
||||
{{content}}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const imageActions: Prompt[] = [
|
||||
@@ -1924,7 +1947,7 @@ Below is the user's query. Please respond in the user's preferred language witho
|
||||
config: {
|
||||
tools: [
|
||||
'docRead',
|
||||
'docEdit',
|
||||
'sectionEdit',
|
||||
'docKeywordSearch',
|
||||
'docSemanticSearch',
|
||||
'webSearch',
|
||||
|
||||
Reference in New Issue
Block a user