From bd67db5e1f519219727290a96a296fc03dfb711d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Tetsing?= Date: Wed, 22 May 2024 14:58:02 +0200 Subject: [PATCH] moved logs to solcoderAI.tsx --- .../src/app/components/container.tsx | 6 +----- apps/remix-ide/src/app/plugins/solcoderAI.tsx | 13 +++++++++++++ apps/vyper/src/app/utils/remix-client.tsx | 3 --- .../src/lib/providers/inlineCompletionProvider.ts | 3 --- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/apps/circuit-compiler/src/app/components/container.tsx b/apps/circuit-compiler/src/app/components/container.tsx index 0b67e6b153..40cf20f5df 100644 --- a/apps/circuit-compiler/src/app/components/container.tsx +++ b/apps/circuit-compiler/src/app/components/container.tsx @@ -11,7 +11,6 @@ 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) @@ -54,7 +53,7 @@ export function Container () { const handleCircuitAutoCompile = (value: boolean) => { circuitApp.dispatch({ type: 'SET_AUTO_COMPILE', payload: value }) } - + const handleCircuitHideWarnings = (value: boolean) => { circuitApp.dispatch({ type: 'SET_HIDE_WARNINGS', payload: value }) } @@ -75,7 +74,6 @@ export function Container () { ` // @ts-ignore await circuitApp.plugin.call('solcoder', 'error_explaining', message) - _paq.push(['trackEvent', 'ai', 'solcoder', 'error_explaining_circom']) } else { const message = ` error message: ${error} @@ -84,7 +82,6 @@ export function Container () { ` // @ts-ignore await circuitApp.plugin.call('solcoder', 'error_explaining', message) - _paq.push(['trackEvent', 'ai', 'solcoder', 'error_explaining_circom']) } } else { const error = report.message @@ -95,7 +92,6 @@ export function Container () { ` // @ts-ignore await circuitApp.plugin.call('solcoder', 'error_explaining', message) - _paq.push(['trackEvent', 'ai', 'solcoder', 'error_explaining_circom']) } } diff --git a/apps/remix-ide/src/app/plugins/solcoderAI.tsx b/apps/remix-ide/src/app/plugins/solcoderAI.tsx index 44e7a8121e..6e5efcf7bd 100644 --- a/apps/remix-ide/src/app/plugins/solcoderAI.tsx +++ b/apps/remix-ide/src/app/plugins/solcoderAI.tsx @@ -50,6 +50,8 @@ export class SolCoder extends Plugin { async code_generation(prompt): Promise { this.emit("aiInfering") this.call('layout', 'maximizeTerminal') + _paq.push(['trackEvent', 'ai', 'solcoder', 'code_generation']) + let result try { result = await( @@ -78,6 +80,9 @@ export class SolCoder extends Plugin { async solidity_answer(prompt): Promise { this.emit("aiInfering") this.call('layout', 'maximizeTerminal') + this.call('terminal', 'log', { type: 'aitypewriterwarning', value: `\n\nWaiting for SOL-GPT answer...` }) + _paq.push(['trackEvent', 'ai', 'solcoder', 'answering']) + let result try { const main_prompt = this._build_solgpt_promt(prompt) @@ -112,6 +117,9 @@ export class SolCoder extends Plugin { async code_explaining(prompt, context:string=""): Promise { this.emit("aiInfering") this.call('layout', 'maximizeTerminal') + this.call('terminal', 'log', { type: 'aitypewriterwarning', value: `\n\nWaiting for SOL-GPT answer...` }) + _paq.push(['trackEvent', 'ai', 'solcoder', 'explaining']) + let result try { result = await( @@ -138,6 +146,8 @@ export class SolCoder extends Plugin { async code_completion(prompt, options:SuggestOptions=null): Promise { this.emit("aiInfering") + _paq.push(['trackEvent', 'ai', 'solcoder', 'code_completion']) + let result try { result = await( @@ -184,6 +194,8 @@ export class SolCoder extends Plugin { async code_insertion(msg_pfx, msg_sfx): Promise { this.emit("aiInfering") + _paq.push(['trackEvent', 'ai', 'solcoder', 'code_insertion']) + let result try { result = await( @@ -222,6 +234,7 @@ export class SolCoder extends Plugin { this.emit("aiInfering") this.call('layout', 'maximizeTerminal') this.call('terminal', 'log', { type: 'aitypewriterwarning', value: `\n\nWaiting for SOL-GPT answer...` }) + _paq.push(['trackEvent', 'ai', 'solcoder', 'explaining']) let result try { diff --git a/apps/vyper/src/app/utils/remix-client.tsx b/apps/vyper/src/app/utils/remix-client.tsx index 3de036f352..cbfa5eb87e 100644 --- a/apps/vyper/src/app/utils/remix-client.tsx +++ b/apps/vyper/src/app/utils/remix-client.tsx @@ -5,8 +5,6 @@ import {PluginClient} from '@remixproject/plugin' import {Contract, compileContract} from './compiler' import {ExampleContract} from '../components/VyperResult' import EventEmitter from 'events' -const _paq = (window._paq = window._paq || []) - export type VyperComplierAddress = 'https://vyper2.remixproject.org/' | 'http://localhost:8000/' export class RemixClient extends PluginClient { @@ -73,7 +71,6 @@ export class RemixClient extends PluginClient { can you explain why this error occurred and how to fix it? ` await this.client.call('solcoder' as any, 'error_explaining', message) - _paq.push(['trackEvent', 'ai', 'solcoder', 'error_explaining']) } catch (err) { console.error('unable to askGpt') console.error(err) diff --git a/libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts b/libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts index 92c79914b5..ce274d57b5 100644 --- a/libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts @@ -66,7 +66,6 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli this.props.plugin.call('terminal', 'log', { type: 'aitypewriterwarning', value: 'Solcoder - generating code for following comment: ' + ask.replace('///', '') }) const data = await this.props.plugin.call('solcoder', 'code_generation', word) - _paq.push(['trackEvent', 'ai', 'solcoder', 'code_generation']) const parsedData = data[0].trimStart() //JSON.parse(data).trimStart() const item: monacoTypes.languages.InlineCompletion = { @@ -105,7 +104,6 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli // Code insertion try { const output = await this.props.plugin.call('solcoder', 'code_insertion', word, word_after) - _paq.push(['trackEvent', 'ai', 'solcoder', 'code_insertion']) const generatedText = output[0] // no need to clean it. should already be const item: monacoTypes.languages.InlineCompletion = { @@ -130,7 +128,6 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli try { // Code completion const output = await this.props.plugin.call('solcoder', 'code_completion', word) - _paq.push(['trackEvent', 'ai', 'solcoder', 'code_completion']) const generatedText = output[0] let clean = generatedText