Skip to content

Commit

Permalink
Merge pull request #4275 from ethereum/add_matomo_key
Browse files Browse the repository at this point in the history
add missing matomo keys
  • Loading branch information
yann300 authored Nov 29, 2023
2 parents 80c4817 + 23d8aa8 commit 2675918
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 7 deletions.
6 changes: 3 additions & 3 deletions apps/remix-ide/src/app/plugins/openaigpt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ export class OpenAIGpt extends Plugin {
}

if (result && result.choices && result.choices.length) {
this.call('terminal', 'log', { type: 'typewritersuccess', value: result.choices[0].message.content })
this.call('terminal', 'log', { type: 'typewriterwarning', value: result.choices[0].message.content })
} else if (result.error) {
this.call('terminal', 'log', { type: 'typewritersuccess', value: result.error })
this.call('terminal', 'log', { type: 'typewriterwarning', value: result.error })
} else {
this.call('terminal', 'log', { type: 'typewritersuccess', value: 'No response...' })
this.call('terminal', 'log', { type: 'typewriterwarning', value: 'No response...' })
}
return result.data
}
Expand Down
1 change: 1 addition & 0 deletions apps/remix-ide/src/remixEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class RemixEngine extends Engine {
if (name === 'udapp') return { queueTimeout: 60000 * 4 }
if (name === 'circuit-compiler') return { queueTimeout: 60000 * 4 }
if (name === 'filePanel') return { queueTimeout: 60000 * 20 }
if (name === 'openaigpt') return { queueTimeout: 60000 * 2 }
return { queueTimeout: 10000 }
}

Expand Down
3 changes: 3 additions & 0 deletions libs/remix-ui/editor/src/lib/remix-ui-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import './remix-ui-editor.css'
import { circomLanguageConfig, circomTokensProvider } from './syntaxes/circom'
import { IPosition } from 'monaco-editor'
import { RemixInLineCompletionProvider } from './providers/inlineCompletionProvider'
const _paq = (window._paq = window._paq || [])

enum MarkerSeverity {
Hint = 1,
Expand Down Expand Up @@ -709,6 +710,7 @@ export const EditorUI = (props: EditorUIProps) => {
Generate the documentation for the function ${currentFunction.current} using the Doxygen style syntax
`
await props.plugin.call('openaigpt', 'message', message)
_paq.push(['trackEvent', 'ai', 'openai', 'generateDocumentation'])
},
}

Expand All @@ -727,6 +729,7 @@ export const EditorUI = (props: EditorUIProps) => {
Explain the function ${currentFunction.current}
`
await props.plugin.call('openaigpt', 'message', message)
_paq.push(['trackEvent', 'ai', 'openai', 'explainFunction'])
},
}

Expand Down
2 changes: 1 addition & 1 deletion libs/remix-ui/renderer/src/lib/renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const Renderer = ({message, opt = {}, plugin}: RendererProps) => {
explain why the error occurred and how to fix it.
`
await plugin.call('openaigpt', 'message', message)
_paq.push(['trackEvent', 'GPTSupport', 'askGPT'])
_paq.push(['trackEvent', 'ai', 'openai', 'explainSolidityError'])
} catch (err) {
console.error('unable to askGtp')
console.error(err)
Expand Down
5 changes: 5 additions & 0 deletions libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import RenderKnownTransactions from './components/RenderKnownTransactions' // es
import parse from 'html-react-parser'
import { EMPTY_BLOCK, KNOWN_TRANSACTION, RemixUiTerminalProps, UNKNOWN_TRANSACTION } from './types/terminalTypes'
import { wrapScript } from './utils/wrapScript'
const _paq = (window._paq = window._paq || [])

/* eslint-disable-next-line */
export interface ClipboardEvent<T = Element> extends SyntheticEvent<T, any> {
Expand Down Expand Up @@ -229,6 +230,10 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
try {
if (script.trim().startsWith('git')) {
// await this.call('git', 'execute', script) code might be used in the future
} else if (script.trim().startsWith('gpt')) {
call('terminal', 'log',{ type: 'warn', value: `> ${script}` })
await call('openaigpt', 'message', script)
_paq.push(['trackEvent', 'ai', 'openai', 'askFromTerminal'])
} else {
await call('scriptRunner', 'execute', script)
}
Expand Down
6 changes: 4 additions & 2 deletions libs/remix-ui/terminal/src/lib/terminalWelcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,17 @@ const TerminalWelcomeMessage = ({packageJson, storage}) => {
<ul className="ml-0 mr-4">
<li key="web3-152">
<a target="_blank" href="https://web3js.readthedocs.io/en/1.0/">
web3 version 1.5.2
web3.js
</a>
</li>
<li key="ethers-console">
<a target="_blank" href="https://docs.ethers.io">
ethers.js
</a>{' '}
</li>
<li key="remix-console">remix</li>
<li key="ethers-console">
gpt <i>your question</i> {' '}
</li>
</ul>
<div>
<FormattedMessage id="terminal.welcomeText10" />.
Expand Down
2 changes: 1 addition & 1 deletion libs/remix-ui/terminal/src/lib/utils/wrapScript.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const wrapScript = (script) => {
const isKnownScript = ['remix.', 'console.', 'git'].some(prefix => script.trim().startsWith(prefix))
const isKnownScript = ['remix.', 'console.', 'git', 'gpt'].some(prefix => script.trim().startsWith(prefix))
if (isKnownScript) return script
return `
try {
Expand Down

0 comments on commit 2675918

Please sign in to comment.