From eb878ff000e970776a3c3b524b7625e4fb0bfc6b Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Thu, 7 Nov 2024 11:06:45 +0100 Subject: [PATCH] explain this code calls the pop up AI panel --- libs/remix-ui/editor/src/lib/remix-ui-editor.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index d487090522..62be310b54 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -829,7 +829,11 @@ export const EditorUI = (props: EditorUIProps) => { const file = await props.plugin.call('fileManager', 'getCurrentFile') const context = await props.plugin.call('fileManager', 'readFile', file) const message = intl.formatMessage({ id: 'editor.explainFunctionByAI' }, { content:context, currentFunction: currentFunction.current }) - await props.plugin.call('remixAI' as any, 'chatPipe', 'code_explaining', message, context) + + await props.plugin.call('popupPanel', 'showPopupPanel', true) + setTimeout(async () => { + await props.plugin.call('remixAI' as any, 'chatPipe', 'code_explaining', message, context) + }, 500) _paq.push(['trackEvent', 'ai', 'remixAI', 'explainFunction']) }, } @@ -850,7 +854,10 @@ export const EditorUI = (props: EditorUIProps) => { const selectedCode = editor.getModel().getValueInRange(editor.getSelection()) const pipeMessage = intl.formatMessage({ id: 'editor.ExplainPipeMessage' }, { content:selectedCode }) - await props.plugin.call('remixAI' as any, 'chatPipe', 'code_explaining', selectedCode, content, pipeMessage) + await props.plugin.call('popupPanel', 'showPopupPanel', true) + setTimeout(async () => { + await props.plugin.call('remixAI' as any, 'chatPipe', 'code_explaining', selectedCode, content, pipeMessage) + }, 500) _paq.push(['trackEvent', 'ai', 'remixAI', 'explainFunction']) }, }