Skip to content

Commit

Permalink
Merge pull request ethereum#4554 from ethereum/solcoder/explain_contract
Browse files Browse the repository at this point in the history
Solcoder/explain contract
  • Loading branch information
yann300 authored Apr 3, 2024
2 parents a6e6f38 + 060548c commit c951398
Show file tree
Hide file tree
Showing 39 changed files with 627 additions and 437 deletions.
15 changes: 8 additions & 7 deletions apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,14 @@ module.exports = {
.waitForElementVisible('*[data-id="testTabSolidityUnitTestsOutputheader"]', 120000)
.waitForElementPresent('#solidityUnittestsOutput div[class^="testPass"]', 60000)
.waitForElementContainsText('#solidityUnittestsOutput', 'tests/hhLogs_test.sol', 60000)
.assert.containsText('#journal > div:nth-child(3) > span', 'Before all:')
.assert.containsText('#journal > div:nth-child(3) > span', 'Inside beforeAll')
.assert.containsText('#journal > div:nth-child(4) > span', 'Check sender:')
.assert.containsText('#journal > div:nth-child(4) > span', 'msg.sender is 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4')
.assert.containsText('#journal > div:nth-child(5) > span', 'Check int logs:')
.assert.containsText('#journal > div:nth-child(5) > span', '10 20')
.assert.containsText('#journal > div:nth-child(5) > span', 'Number is 25')
.pause(2000)
.assert.containsText('#journal > div:nth-child(4) > span', 'Before all:')
.assert.containsText('#journal > div:nth-child(4) > span', 'Inside beforeAll')
.assert.containsText('#journal > div:nth-child(5) > span', 'Check sender:')
.assert.containsText('#journal > div:nth-child(5) > span', 'msg.sender is 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4')
.assert.containsText('#journal > div:nth-child(6) > span', 'Check int logs:')
.assert.containsText('#journal > div:nth-child(6) > span', '10 20')
.assert.containsText('#journal > div:nth-child(6) > span', 'Number is 25')
.openFile('tests/hhLogs_test.sol')
.removeFile('tests/hhLogs_test.sol', 'workspace_new')
},
Expand Down
8 changes: 5 additions & 3 deletions apps/remix-ide/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import { ripgrepPlugin } from './app/plugins/electron/ripgrepPlugin'
import { compilerLoaderPlugin, compilerLoaderPluginDesktop } from './app/plugins/electron/compilerLoaderPlugin'

import {OpenAIGpt} from './app/plugins/openaigpt'
import {SolCoder} from './app/plugins/solcoderAI'

const isElectron = require('is-electron')

Expand All @@ -67,7 +68,6 @@ const remixLib = require('@remix-project/remix-lib')
import { QueryParams } from '@remix-project/remix-lib'
import { SearchPlugin } from './app/tabs/search'
import { ElectronProvider } from './app/files/electronProvider'
import { CopilotSuggestion } from './app/plugins/copilot/suggestion-service/copilot-suggestion'

const Storage = remixLib.Storage
const RemixDProvider = require('./app/files/remixDProvider')
Expand Down Expand Up @@ -233,7 +233,7 @@ class AppComponent {

// ----------------- AI --------------------------------------
const openaigpt = new OpenAIGpt()
const copilotSuggestion = new CopilotSuggestion()
const solcoder = new SolCoder()

// ----------------- import content service ------------------------
const contentImport = new CompilerImports()
Expand Down Expand Up @@ -362,7 +362,7 @@ class AppComponent {
solidityScript,
templates,
openaigpt,
copilotSuggestion
solcoder,
])

//---- fs plugin
Expand Down Expand Up @@ -517,7 +517,9 @@ class AppComponent {
}
)
await this.appManager.activatePlugin(['solidity-script', 'openaigpt'])
await this.appManager.activatePlugin(['solcoder'])



await this.appManager.activatePlugin(['filePanel'])
// Set workspace after initial activation
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

8 changes: 4 additions & 4 deletions apps/remix-ide/src/app/plugins/openaigpt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class OpenAIGpt extends Plugin {

async message(prompt): Promise<CreateChatCompletionResponse> {
this.call('layout', 'maximizeTerminal')
this.call('terminal', 'log', 'Waiting for GPT answer...')
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: 'Waiting for GPT answer...'})
let result
try {
result = await (
Expand All @@ -38,11 +38,11 @@ export class OpenAIGpt extends Plugin {
}

if (result && result.choices && result.choices.length) {
this.call('terminal', 'log', { type: 'typewriterwarning', value: result.choices[0].message.content })
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result.choices[0].message.content })
} else if (result.error) {
this.call('terminal', 'log', { type: 'typewriterwarning', value: result.error })
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result.error })
} else {
this.call('terminal', 'log', { type: 'typewriterwarning', value: 'No response...' })
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: 'No response...' })
}
return result.data
}
Expand Down
Loading

0 comments on commit c951398

Please sign in to comment.