Skip to content

Commit

Permalink
fix(editor): conditionally execute menu action after LLM call
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 1, 2024
1 parent 13583ff commit 45172d9
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions web/core/lib/editor/menu/menu-bubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,17 @@ export const MenuBubble = ({ editor, customActions } : {
setIsOpen(false);
setLoading(true);

const text = await editor.commands?.callLlm(menu)
setLoading(false);
if (!menu.action) {
const text = await editor.commands?.callLlm(menu)
setLoading(false);

const newComment = newAdvice(text || '');
editor.commands?.setAdvice(newComment.id);
editor.commands?.setAdviceCommand(newComment);
} else {
menu.action?.(editor);
}

const newComment = newAdvice(text || '');
editor.commands?.setAdvice(newComment.id);
editor.commands?.setAdviceCommand(newComment);
menu.action?.(editor);
editor.view?.focus();
}}
>
Expand Down

0 comments on commit 45172d9

Please sign in to comment.