From 5be173f1c4b2246262c9ee5af6207e50e66b31b8 Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Mon, 23 Sep 2024 14:09:14 +0800 Subject: [PATCH] refactor(editor): refactor AiActionExecutor class Refactor AiActionExecutor class by removing private access modifiers from properties and methods. Update method signatures for better consistency and readability. --- web/core/lib/editor/action/AiActionExecutor.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web/core/lib/editor/action/AiActionExecutor.ts b/web/core/lib/editor/action/AiActionExecutor.ts index 0d09f12..032835b 100644 --- a/web/core/lib/editor/action/AiActionExecutor.ts +++ b/web/core/lib/editor/action/AiActionExecutor.ts @@ -5,8 +5,8 @@ import { MarkdownParser } from '@/../node_modules/tiptap-markdown/src/parse/Mark import { BuiltinFunctionExecutor } from '@/editor/action/BuiltinFunctionExecutor'; export class AiActionExecutor { - private editor: Editor; - private endpointUrl: string = '/api/completion/mock'; + editor: Editor; + endpointUrl: string = '/api/completion/mock'; constructor() { } @@ -28,11 +28,11 @@ export class AiActionExecutor { * TODO: will according the {@link PromptAction.useModel} to return the endpoint in future * @param action */ - endpoint(_action: PromptAction) { + endpoint(action: PromptAction) { return this.endpointUrl; } - private async handleStreaming(action: PromptAction, prompt: string) { + async handleStreaming(action: PromptAction, prompt: string) { this.editor.setEditable(false); const originalSelection = this.editor.state.selection; @@ -112,7 +112,7 @@ export class AiActionExecutor { this.editor.setEditable(true); } - public async execute(action: PromptAction) { + async execute(action: PromptAction) { console.info('execute action', action); if (action.builtinFunction) { const executor = new BuiltinFunctionExecutor(this.editor);