explain this code calls the pop up AI panel

pull/5386/head
STetsing 2 weeks ago committed by Aniket
parent a59c052733
commit eb878ff000
  1. 7
      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 file = await props.plugin.call('fileManager', 'getCurrentFile')
const context = await props.plugin.call('fileManager', 'readFile', file) const context = await props.plugin.call('fileManager', 'readFile', file)
const message = intl.formatMessage({ id: 'editor.explainFunctionByAI' }, { content:context, currentFunction: currentFunction.current }) const message = intl.formatMessage({ id: 'editor.explainFunctionByAI' }, { content:context, currentFunction: currentFunction.current })
await props.plugin.call('popupPanel', 'showPopupPanel', true)
setTimeout(async () => {
await props.plugin.call('remixAI' as any, 'chatPipe', 'code_explaining', message, context) await props.plugin.call('remixAI' as any, 'chatPipe', 'code_explaining', message, context)
}, 500)
_paq.push(['trackEvent', 'ai', 'remixAI', 'explainFunction']) _paq.push(['trackEvent', 'ai', 'remixAI', 'explainFunction'])
}, },
} }
@ -850,7 +854,10 @@ export const EditorUI = (props: EditorUIProps) => {
const selectedCode = editor.getModel().getValueInRange(editor.getSelection()) const selectedCode = editor.getModel().getValueInRange(editor.getSelection())
const pipeMessage = intl.formatMessage({ id: 'editor.ExplainPipeMessage' }, { content:selectedCode }) const pipeMessage = intl.formatMessage({ id: 'editor.ExplainPipeMessage' }, { content:selectedCode })
await props.plugin.call('popupPanel', 'showPopupPanel', true)
setTimeout(async () => {
await props.plugin.call('remixAI' as any, 'chatPipe', 'code_explaining', selectedCode, content, pipeMessage) await props.plugin.call('remixAI' as any, 'chatPipe', 'code_explaining', selectedCode, content, pipeMessage)
}, 500)
_paq.push(['trackEvent', 'ai', 'remixAI', 'explainFunction']) _paq.push(['trackEvent', 'ai', 'remixAI', 'explainFunction'])
}, },
} }

Loading…
Cancel
Save