added support for circom errors and modfied also function explain

pull/5370/head
Stéphane Tetsing 6 months ago committed by Aniket
parent a0edfbb2ab
commit a0c87477eb
  1. 10
      apps/circuit-compiler/src/app/components/container.tsx
  2. 4
      libs/remix-ui/editor/src/lib/remix-ui-editor.tsx

@ -11,6 +11,7 @@ import { WitnessToggler } from './witnessToggler'
import { WitnessSection } from './witness' import { WitnessSection } from './witness'
import { CompilerFeedback } from './feedback' import { CompilerFeedback } from './feedback'
import { CompilerReport, PrimeValue } from '../types' import { CompilerReport, PrimeValue } from '../types'
const _paq = (window._paq = window._paq || [])
export function Container () { export function Container () {
const circuitApp = useContext(CircuitAppContext) const circuitApp = useContext(CircuitAppContext)
@ -73,7 +74,8 @@ export function Container () {
explain why the error occurred and how to fix it. explain why the error occurred and how to fix it.
` `
// @ts-ignore // @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 { } else {
const message = ` const message = `
error message: ${error} error message: ${error}
@ -81,7 +83,8 @@ export function Container () {
explain why the error occurred and how to fix it. explain why the error occurred and how to fix it.
` `
// @ts-ignore // @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 { } else {
const error = report.message const error = report.message
@ -91,7 +94,8 @@ export function Container () {
explain why the error occurred and how to fix it. explain why the error occurred and how to fix it.
` `
// @ts-ignore // @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'])
} }
} }

@ -739,8 +739,8 @@ export const EditorUI = (props: EditorUIProps) => {
const file = await props.plugin.call('fileManager', 'getCurrentFile') const file = await props.plugin.call('fileManager', 'getCurrentFile')
const content = await props.plugin.call('fileManager', 'readFile', file) const content = await props.plugin.call('fileManager', 'readFile', file)
const message = intl.formatMessage({ id: 'editor.explainFunctionByAI' }, { content, currentFunction: currentFunction.current }) const message = intl.formatMessage({ id: 'editor.explainFunctionByAI' }, { content, currentFunction: currentFunction.current })
await props.plugin.call('openaigpt', 'message', message) await props.plugin.call('solcoder', 'code_explaining', message, content)
_paq.push(['trackEvent', 'ai', 'openai', 'explainFunction']) _paq.push(['trackEvent', 'ai', 'solcoder', 'explainFunction'])
}, },
} }

Loading…
Cancel
Save