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:
@@ -29,6 +29,7 @@ import {
|
||||
createDocSemanticSearchTool,
|
||||
createExaCrawlTool,
|
||||
createExaSearchTool,
|
||||
createSectionEditTool,
|
||||
} from '../tools';
|
||||
import { CopilotProviderFactory } from './factory';
|
||||
import {
|
||||
@@ -224,6 +225,10 @@ export abstract class CopilotProvider<C = any> {
|
||||
tools.doc_compose = createDocComposeTool(prompt, this.factory);
|
||||
break;
|
||||
}
|
||||
case 'sectionEdit': {
|
||||
tools.section_edit = createSectionEditTool(prompt, this.factory);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return tools;
|
||||
|
||||
@@ -73,6 +73,8 @@ export const PromptConfigStrictSchema = z.object({
|
||||
'webSearch',
|
||||
// artifact tools
|
||||
'docCompose',
|
||||
// section editing
|
||||
'sectionEdit',
|
||||
])
|
||||
.array()
|
||||
.nullable()
|
||||
|
||||
Reference in New Issue
Block a user