From a0c87477eb7a6214e31e79f50af6b8e348b8af7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Tetsing?= Date: Wed, 22 May 2024 14:28:02 +0200 Subject: [PATCH] added support for circom errors and modfied also function explain --- apps/circuit-compiler/src/app/components/container.tsx | 10 +++++++--- libs/remix-ui/editor/src/lib/remix-ui-editor.tsx | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/circuit-compiler/src/app/components/container.tsx b/apps/circuit-compiler/src/app/components/container.tsx index 51cc280594..0b67e6b153 100644 --- a/apps/circuit-compiler/src/app/components/container.tsx +++ b/apps/circuit-compiler/src/app/components/container.tsx @@ -11,6 +11,7 @@ import { WitnessToggler } from './witnessToggler' import { WitnessSection } from './witness' import { CompilerFeedback } from './feedback' import { CompilerReport, PrimeValue } from '../types' +const _paq = (window._paq = window._paq || []) export function Container () { const circuitApp = useContext(CircuitAppContext) @@ -73,7 +74,8 @@ export function Container () { explain why the error occurred and how to fix it. ` // @ts-ignore - await circuitApp.plugin.call('openaigpt', 'message', message) + await circuitApp.plugin.call('solcoder', 'error_explaining', message) + _paq.push(['trackEvent', 'ai', 'solcoder', 'error_explaining_circom']) } else { const message = ` error message: ${error} @@ -81,7 +83,8 @@ export function Container () { explain why the error occurred and how to fix it. ` // @ts-ignore - await circuitApp.plugin.call('openaigpt', 'message', message) + await circuitApp.plugin.call('solcoder', 'error_explaining', message) + _paq.push(['trackEvent', 'ai', 'solcoder', 'error_explaining_circom']) } } else { const error = report.message @@ -91,7 +94,8 @@ export function Container () { explain why the error occurred and how to fix it. ` // @ts-ignore - await circuitApp.plugin.call('openaigpt', 'message', message) + await circuitApp.plugin.call('solcoder', 'error_explaining', message) + _paq.push(['trackEvent', 'ai', 'solcoder', 'error_explaining_circom']) } } 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 a0ed7626aa..b29586115e 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -739,8 +739,8 @@ export const EditorUI = (props: EditorUIProps) => { const file = await props.plugin.call('fileManager', 'getCurrentFile') const content = await props.plugin.call('fileManager', 'readFile', file) const message = intl.formatMessage({ id: 'editor.explainFunctionByAI' }, { content, currentFunction: currentFunction.current }) - await props.plugin.call('openaigpt', 'message', message) - _paq.push(['trackEvent', 'ai', 'openai', 'explainFunction']) + await props.plugin.call('solcoder', 'code_explaining', message, content) + _paq.push(['trackEvent', 'ai', 'solcoder', 'explainFunction']) }, }