From 2294ac49bf20fbdafc042cfd4df4defce7174270 Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Fri, 1 Nov 2024 17:45:00 +0800 Subject: [PATCH] refactor(editor): conditionally run AI actions before calling LLM commands --- web/core/lib/editor/action/custom-editor-commands.ts | 7 ++++++- web/core/package.json | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/web/core/lib/editor/action/custom-editor-commands.ts b/web/core/lib/editor/action/custom-editor-commands.ts index e1abd2f..0e67065 100644 --- a/web/core/lib/editor/action/custom-editor-commands.ts +++ b/web/core/lib/editor/action/custom-editor-commands.ts @@ -71,7 +71,12 @@ export const CustomEditorCommands = ( runAiAction: (action: PromptAction) => ({ editor }: { editor: Editor }) => { - editor.commands.callLlm(action); + if (action.action) { + action.action(editor).then(() => {}); + return; + } else { + editor.commands.callLlm(action); + } }, callQuickAction: (text: string) => diff --git a/web/core/package.json b/web/core/package.json index 964b5e2..bc388dd 100644 --- a/web/core/package.json +++ b/web/core/package.json @@ -1,6 +1,6 @@ { "name": "@studio-b3/web-core", - "version": "0.8.8", + "version": "0.8.9", "type": "module", "main": "dist/main.js", "types": "dist-types/main.d.ts",