Skip to content

Commit

Permalink
refactor(editor): refactor AiActionExecutor class
Browse files Browse the repository at this point in the history
Refactor AiActionExecutor class by removing private access modifiers from properties and methods. Update method signatures for better consistency and readability.
  • Loading branch information
phodal committed Sep 23, 2024
1 parent 99e3b2a commit 5be173f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions web/core/lib/editor/action/AiActionExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
}
Expand All @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 5be173f

Please sign in to comment.