From 9201938def47962aabd7db16b52bafcc75148e58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Tetsing?= Date: Mon, 27 May 2024 12:13:30 +0200 Subject: [PATCH] rm openai bindings --- apps/remix-ide/src/app.js | 6 +-- apps/remix-ide/src/app/plugins/openaigpt.tsx | 49 -------------------- apps/remix-ide/src/remixAppManager.js | 1 - apps/remix-ide/src/remixEngine.js | 1 - 4 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 apps/remix-ide/src/app/plugins/openaigpt.tsx diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index 1fa9e2f8f7..5a2ddf2a47 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -54,8 +54,6 @@ import { electronTemplates } from './app/plugins/electron/templatesPlugin' import { xtermPlugin } from './app/plugins/electron/xtermPlugin' 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') @@ -233,7 +231,6 @@ class AppComponent { const contractFlattener = new ContractFlattener() // ----------------- AI -------------------------------------- - const openaigpt = new OpenAIGpt() const solcoder = new SolCoder() // ----------------- import content service ------------------------ @@ -352,7 +349,6 @@ class AppComponent { contractFlattener, solidityScript, templates, - openaigpt, solcoder, pluginStateLogger ]) @@ -512,7 +508,7 @@ class AppComponent { await this.appManager.registerContextMenuItems() } ) - await this.appManager.activatePlugin(['solidity-script', 'openaigpt']) + await this.appManager.activatePlugin(['solidity-script']) await this.appManager.activatePlugin(['solcoder']) diff --git a/apps/remix-ide/src/app/plugins/openaigpt.tsx b/apps/remix-ide/src/app/plugins/openaigpt.tsx deleted file mode 100644 index e436d7c9d7..0000000000 --- a/apps/remix-ide/src/app/plugins/openaigpt.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { Plugin } from '@remixproject/engine' -import { CreateChatCompletionResponse } from 'openai' - -const _paq = (window._paq = window._paq || []) - -const profile = { - name: 'openaigpt', - displayName: 'openaigpt', - description: 'openaigpt', - methods: ['message'], - events: [], - maintainedBy: 'Remix', -} - -export class OpenAIGpt extends Plugin { - constructor() { - super(profile) - } - - async message(prompt): Promise { - this.call('layout', 'maximizeTerminal') - this.call('terminal', 'log', { type: 'aitypewriterwarning', value: 'Waiting for GPT answer...' }) - let result - try { - result = await ( - await fetch('https://openai-gpt.remixproject.org', { - method: 'POST', - headers: { - Accept: 'application/json', - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ prompt }), - }) - ).json() - } catch (e) { - this.call('terminal', 'log', { type: 'typewritererror', value: `Unable to get a response ${e.message}` }) - return - } - - if (result && result.choices && result.choices.length) { - this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result.choices[0].message.content }) - } else if (result.error) { - this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result.error }) - } else { - this.call('terminal', 'log', { type: 'aitypewriterwarning', value: 'No response...' }) - } - return result.data - } -} diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index df13ce19c0..c52b50c081 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -71,7 +71,6 @@ let requiredModules = [ // services + layout views + system views 'vyperCompilationDetails', 'contractflattener', 'solidity-script', - 'openaigpt', 'solcoder', 'home', 'doc-viewer', diff --git a/apps/remix-ide/src/remixEngine.js b/apps/remix-ide/src/remixEngine.js index 948eca47bc..baaf75deda 100644 --- a/apps/remix-ide/src/remixEngine.js +++ b/apps/remix-ide/src/remixEngine.js @@ -26,7 +26,6 @@ export class RemixEngine extends Engine { if (name === 'compilerloader') return { queueTimeout: 60000 * 4 } if (name === 'filePanel') return { queueTimeout: 60000 * 20 } if (name === 'fileManager') return { queueTimeout: 60000 * 20 } - if (name === 'openaigpt') return { queueTimeout: 60000 * 2 } if (name === 'solcoder') return { queueTimeout: 60000 * 2 } if (name === 'cookbookdev') return { queueTimeout: 60000 * 3 } return { queueTimeout: 10000 }