rm openai bindings

pull/4809/head
Stéphane Tetsing 5 months ago committed by Aniket
parent 6b345a1259
commit e4dd8dfc77
  1. 6
      apps/remix-ide/src/app.js
  2. 49
      apps/remix-ide/src/app/plugins/openaigpt.tsx
  3. 1
      apps/remix-ide/src/remixAppManager.js
  4. 1
      apps/remix-ide/src/remixEngine.js

@ -54,8 +54,6 @@ import { electronTemplates } from './app/plugins/electron/templatesPlugin'
import { xtermPlugin } from './app/plugins/electron/xtermPlugin' import { xtermPlugin } from './app/plugins/electron/xtermPlugin'
import { ripgrepPlugin } from './app/plugins/electron/ripgrepPlugin' import { ripgrepPlugin } from './app/plugins/electron/ripgrepPlugin'
import { compilerLoaderPlugin, compilerLoaderPluginDesktop } from './app/plugins/electron/compilerLoaderPlugin' import { compilerLoaderPlugin, compilerLoaderPluginDesktop } from './app/plugins/electron/compilerLoaderPlugin'
import {OpenAIGpt} from './app/plugins/openaigpt'
import {SolCoder} from './app/plugins/solcoderAI' import {SolCoder} from './app/plugins/solcoderAI'
const isElectron = require('is-electron') const isElectron = require('is-electron')
@ -233,7 +231,6 @@ class AppComponent {
const contractFlattener = new ContractFlattener() const contractFlattener = new ContractFlattener()
// ----------------- AI -------------------------------------- // ----------------- AI --------------------------------------
const openaigpt = new OpenAIGpt()
const solcoder = new SolCoder() const solcoder = new SolCoder()
// ----------------- import content service ------------------------ // ----------------- import content service ------------------------
@ -352,7 +349,6 @@ class AppComponent {
contractFlattener, contractFlattener,
solidityScript, solidityScript,
templates, templates,
openaigpt,
solcoder, solcoder,
pluginStateLogger pluginStateLogger
]) ])
@ -512,7 +508,7 @@ class AppComponent {
await this.appManager.registerContextMenuItems() await this.appManager.registerContextMenuItems()
} }
) )
await this.appManager.activatePlugin(['solidity-script', 'openaigpt']) await this.appManager.activatePlugin(['solidity-script'])
await this.appManager.activatePlugin(['solcoder']) await this.appManager.activatePlugin(['solcoder'])

@ -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<CreateChatCompletionResponse> {
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
}
}

@ -71,7 +71,6 @@ let requiredModules = [ // services + layout views + system views
'vyperCompilationDetails', 'vyperCompilationDetails',
'contractflattener', 'contractflattener',
'solidity-script', 'solidity-script',
'openaigpt',
'solcoder', 'solcoder',
'home', 'home',
'doc-viewer', 'doc-viewer',

@ -26,7 +26,6 @@ export class RemixEngine extends Engine {
if (name === 'compilerloader') return { queueTimeout: 60000 * 4 } if (name === 'compilerloader') return { queueTimeout: 60000 * 4 }
if (name === 'filePanel') return { queueTimeout: 60000 * 20 } if (name === 'filePanel') return { queueTimeout: 60000 * 20 }
if (name === 'fileManager') 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 === 'solcoder') return { queueTimeout: 60000 * 2 }
if (name === 'cookbookdev') return { queueTimeout: 60000 * 3 } if (name === 'cookbookdev') return { queueTimeout: 60000 * 3 }
return { queueTimeout: 10000 } return { queueTimeout: 10000 }

Loading…
Cancel
Save