mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
fix(core): in edgeless mode, an error occurs when asking AI questions without selecting any content (#12437)
### TL;DR fix: in edgeless mode, an error occurs when asking AI questions without selecting any content > CLOSE AI-133 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added support for asking AI input in edgeless mode when no content is selected. - Enhanced AI panel behavior with improved input handling and chat message sending in edgeless mode. - **Bug Fixes** - Improved handling of AI chat input visibility and context extraction in edgeless mode. - **Tests** - Introduced new end-to-end tests to verify chat interactions with AI in edgeless mode. - Centralized editor content removal logic in test utilities for better maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -386,14 +386,18 @@ export class EditorUtils {
|
||||
);
|
||||
}
|
||||
|
||||
public static async removeAll(page: Page) {
|
||||
await selectAllByKeyboard(page);
|
||||
await page.keyboard.press('Delete');
|
||||
}
|
||||
|
||||
public static async askAIWithEdgeless(
|
||||
page: Page,
|
||||
createBlock: () => Promise<void>,
|
||||
afterSelected?: () => Promise<void>
|
||||
) {
|
||||
await this.switchToEdgelessMode(page);
|
||||
await selectAllByKeyboard(page);
|
||||
await page.keyboard.press('Delete');
|
||||
await this.removeAll(page);
|
||||
await createBlock();
|
||||
await pressEscape(page, 5);
|
||||
await selectAllByKeyboard(page);
|
||||
|
||||
Reference in New Issue
Block a user