Merge pull request #5783 from ethereum/valid_func_sig

Valid func sig
pull/5776/head
bunsenstraat 6 days ago committed by GitHub
commit f7abd37b6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      apps/remix-ide/src/app/plugins/remixAIPlugin.tsx
  2. 2
      apps/remixdesktop/package.json
  3. 8
      apps/remixdesktop/src/lib/InferenceServerManager.ts
  4. 8
      apps/remixdesktop/src/plugins/remixAIDektop.ts
  5. 10
      apps/remixdesktop/yarn.lock
  6. 16
      libs/remix-api/src/lib/plugins/remixAIDesktop-api.ts
  7. 13
      libs/remix-api/src/lib/plugins/remixai-api.ts
  8. 1
      package.json
  9. 5
      yarn.lock

@ -111,12 +111,12 @@ export class RemixAIPlugin extends ViewPlugin {
async code_completion(prompt: string, promptAfter: string): Promise<any> { async code_completion(prompt: string, promptAfter: string): Promise<any> {
if (this.completionAgent.indexer == null || this.completionAgent.indexer == undefined) await this.completionAgent.indexWorkspace() if (this.completionAgent.indexer == null || this.completionAgent.indexer == undefined) await this.completionAgent.indexWorkspace()
const currentFile = await this.call('fileManager', 'getCurrentFile') const currentFileName = await this.call('fileManager', 'getCurrentFile')
const contextfiles = await this.completionAgent.getContextFiles(prompt) const contextfiles = await this.completionAgent.getContextFiles(prompt)
if (this.isOnDesktop && !this.useRemoteInferencer) { if (this.isOnDesktop && !this.useRemoteInferencer) {
return await this.call(this.remixDesktopPluginName, 'code_completion', prompt, promptAfter) return await this.call(this.remixDesktopPluginName, 'code_completion', prompt, promptAfter, contextfiles, currentFileName)
} else { } else {
return await this.remoteInferencer.code_completion(prompt, promptAfter, contextfiles, currentFile) return await this.remoteInferencer.code_completion(prompt, promptAfter, contextfiles, currentFileName)
} }
} }
@ -177,13 +177,13 @@ export class RemixAIPlugin extends ViewPlugin {
async code_insertion(msg_pfx: string, msg_sfx: string): Promise<any> { async code_insertion(msg_pfx: string, msg_sfx: string): Promise<any> {
if (this.completionAgent.indexer == null || this.completionAgent.indexer == undefined) await this.completionAgent.indexWorkspace() if (this.completionAgent.indexer == null || this.completionAgent.indexer == undefined) await this.completionAgent.indexWorkspace()
const currentFile = await this.call('fileManager', 'getCurrentFile') const currentFileName = await this.call('fileManager', 'getCurrentFile')
const contextfiles = await this.completionAgent.getContextFiles(msg_pfx) const contextfiles = await this.completionAgent.getContextFiles(msg_pfx)
if (this.isOnDesktop && !this.useRemoteInferencer) { if (this.isOnDesktop && !this.useRemoteInferencer) {
return await this.call(this.remixDesktopPluginName, 'code_insertion', msg_pfx, msg_sfx) return await this.call(this.remixDesktopPluginName, 'code_insertion', msg_pfx, msg_sfx, contextfiles, currentFileName)
} else { } else {
return await this.remoteInferencer.code_insertion( msg_pfx, msg_sfx, contextfiles, currentFile) return await this.remoteInferencer.code_insertion( msg_pfx, msg_sfx, contextfiles, currentFileName)
} }
} }

@ -42,6 +42,7 @@
"@electron/notarize": "^2.3.0", "@electron/notarize": "^2.3.0",
"@types/byline": "^4.2.35", "@types/byline": "^4.2.35",
"@types/express": "^4.17.21", "@types/express": "^4.17.21",
"@types/lunr": "^2.3.7",
"@types/nightwatch": "^2.3.23", "@types/nightwatch": "^2.3.23",
"chromedriver": "116", "chromedriver": "116",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
@ -78,6 +79,7 @@
"electron-updater": "^6.1.8", "electron-updater": "^6.1.8",
"express": "^4.20.0", "express": "^4.20.0",
"isomorphic-git": "^1.24.2", "isomorphic-git": "^1.24.2",
"lunr": "^2.3.9",
"matomo-tracker": "^2.2.4", "matomo-tracker": "^2.2.4",
"node-pty": "^1.0.0", "node-pty": "^1.0.0",
"octokit": "^3.1.2", "octokit": "^3.1.2",

@ -453,23 +453,23 @@ export class InferenceManager implements ICompletions {
} }
} }
async code_completion(prompt, promptAfter, params:IParams=CompletionParams): Promise<any> { async code_completion(prompt, promptAfter, ctxFiles, currentFileName , params:IParams=CompletionParams): Promise<any> {
if (!this.isReady) { if (!this.isReady) {
console.log('model not ready yet') console.log('model not ready yet')
return return
} }
// as of now no prompt required // as of now no prompt required
const payload = { prompt, 'context':promptAfter, ...params } const payload = { prompt, 'context':promptAfter, ctxFiles, currentFileName, ...params }
return this._makeInferenceRequest('code_completion', payload, AIRequestType.COMPLETION) return this._makeInferenceRequest('code_completion', payload, AIRequestType.COMPLETION)
} }
async code_insertion(msg_pfx: string, msg_sfx: string, params:IParams=InsertionParams): Promise<any> { async code_insertion(msg_pfx: string, msg_sfx: string, ctxFiles, currentFileName, params:IParams=InsertionParams): Promise<any> {
if (!this.isReady) { if (!this.isReady) {
console.log('model not ready yet') console.log('model not ready yet')
return return
} }
const payload = { code_pfx:msg_pfx, code_sfx:msg_sfx, ...params } const payload = { code_pfx:msg_pfx, code_sfx:msg_sfx, ctxFiles, currentFileName, ...params }
return this._makeInferenceRequest('code_insertion', payload, AIRequestType.COMPLETION) return this._makeInferenceRequest('code_insertion', payload, AIRequestType.COMPLETION)
} }

@ -82,13 +82,13 @@ class RemixAIDesktopPluginClient extends ElectronBasePluginClient {
return true return true
} }
async code_completion(prompt: string, promptAfter: string) { async code_completion(prompt: string, promptAfter: string, ctxFiles=[], fileName: string="") {
// use general purpose model // use general purpose model
return this.desktopInferencer.code_completion(prompt, promptAfter) return this.desktopInferencer.code_completion(prompt, promptAfter, ctxFiles, fileName)
} }
async code_insertion(msg_pfx: string, msg_sfx: string) { async code_insertion(msg_pfx: string, msg_sfx: string, ctxFiles=[], fileName: string="") {
return this.desktopInferencer.code_insertion(msg_pfx, msg_sfx) return this.desktopInferencer.code_insertion(msg_pfx, msg_sfx, ctxFiles, fileName)
} }
async code_generation(prompt: string) { async code_generation(prompt: string) {

@ -1227,6 +1227,11 @@
dependencies: dependencies:
"@types/node" "*" "@types/node" "*"
"@types/lunr@^2.3.7":
version "2.3.7"
resolved "https://registry.yarnpkg.com/@types/lunr/-/lunr-2.3.7.tgz#378a98ecf7a9fafc42466f67f73173c34a6265a0"
integrity sha512-Tb/kUm38e8gmjahQzdCKhbdsvQ9/ppzHFfsJ0dMs3ckqQsRj+P5IkSAwFTBrBxdyr3E/LoMUUrZngjDYAjiE3A==
"@types/mime@*": "@types/mime@*":
version "3.0.4" version "3.0.4"
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-3.0.4.tgz#2198ac274de6017b44d941e00261d5bc6a0e0a45" resolved "https://registry.yarnpkg.com/@types/mime/-/mime-3.0.4.tgz#2198ac274de6017b44d941e00261d5bc6a0e0a45"
@ -4941,6 +4946,11 @@ lru-cache@^6.0.0:
dependencies: dependencies:
yallist "^4.0.0" yallist "^4.0.0"
lunr@^2.3.9:
version "2.3.9"
resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1"
integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==
matcher@^3.0.0: matcher@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz" resolved "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz"

@ -10,14 +10,12 @@ export interface IRemixAID {
} & StatusEvents, } & StatusEvents,
methods: { methods: {
code_completion(context: string): Promise<string> code_completion(prompt: string, context: string, params?): Promise<string>
code_insertion(msg_pfx: string, msg_sfx: string): Promise<string>, code_insertion(msg_pfx: string, msg_sfx: string, params?): Promise<string>,
code_generation(prompt: string): Promise<string | null>, code_generation(prompt: string, params?): Promise<string | null>,
code_explaining(code: string, context?: string): Promise<string | null>, code_explaining(code: string, context?: string, params?): Promise<string | null>,
error_explaining(prompt: string): Promise<string | null>, error_explaining(prompt: string, context?: string, params?): Promise<string | null>,
solidity_answer(prompt: string): Promise<string | null>, solidity_answer(prompt: string, params?): Promise<string | null>,
initializeModelBackend(local: boolean, generalModel?, completionModel?): Promise<boolean>, initializeModelBackend(local: boolean, generalModel?, completionModel?): Promise<void>,
chatPipe(pipeMessage: string): Promise<void>,
ProcessChatRequestBuffer(params:IParams): Promise<void>,
} }
} }

@ -9,15 +9,16 @@ export interface IRemixAI {
onInferenceDone():void, onInferenceDone():void,
} & StatusEvents, } & StatusEvents,
methods: { methods: {
code_completion(context: string): Promise<string> code_completion(prompt: string, context: string, params?): Promise<string>
code_insertion(msg_pfx: string, msg_sfx: string): Promise<string>, code_insertion(msg_pfx: string, msg_sfx: string, params?): Promise<string>,
code_generation(prompt: string): Promise<string | null>, code_generation(prompt: string, params?): Promise<string | null>,
code_explaining(code: string, context?: string): Promise<string | null>, code_explaining(code: string, context?: string, params?): Promise<string | null>,
error_explaining(prompt: string): Promise<string | null>, error_explaining(prompt: string, context?: string, params?): Promise<string | null>,
solidity_answer(prompt: string): Promise<string | null>, solidity_answer(prompt: string, params?): Promise<string | null>,
initializeModelBackend(local: boolean, generalModel?, completionModel?): Promise<void>, initializeModelBackend(local: boolean, generalModel?, completionModel?): Promise<void>,
chatPipe(pipeMessage: string): Promise<void>, chatPipe(pipeMessage: string): Promise<void>,
ProcessChatRequestBuffer(params:IParams): Promise<void>, ProcessChatRequestBuffer(params:IParams): Promise<void>,
initialize(model1?:IModel, model2?:IModel, remoteModel?:IRemoteModel, useRemote?:boolean): Promise<void>, initialize(model1?:IModel, model2?:IModel, remoteModel?:IRemoteModel, useRemote?:boolean): Promise<void>,
vulnerability_check(prompt: string, params?): Promise<string | null>,
} }
} }

@ -265,6 +265,7 @@
"@types/fs-extra": "^9.0.1", "@types/fs-extra": "^9.0.1",
"@types/isomorphic-git__lightning-fs": "^4.4.2", "@types/isomorphic-git__lightning-fs": "^4.4.2",
"@types/lodash": "^4.14.172", "@types/lodash": "^4.14.172",
"@types/lunr": "^2.3.7",
"@types/mocha": "^9.1.1", "@types/mocha": "^9.1.1",
"@types/node": "18.16.1", "@types/node": "18.16.1",
"@types/react": "^18.2.0", "@types/react": "^18.2.0",

@ -7582,6 +7582,11 @@
resolved "https://registry.yarnpkg.com/@types/lru-cache/-/lru-cache-5.1.1.tgz#c48c2e27b65d2a153b19bfc1a317e30872e01eef" resolved "https://registry.yarnpkg.com/@types/lru-cache/-/lru-cache-5.1.1.tgz#c48c2e27b65d2a153b19bfc1a317e30872e01eef"
integrity sha512-ssE3Vlrys7sdIzs5LOxCzTVMsU7i9oa/IaW92wF32JFb3CVczqOkru2xspuKczHEbG3nvmPY7IFqVmGGHdNbYw== integrity sha512-ssE3Vlrys7sdIzs5LOxCzTVMsU7i9oa/IaW92wF32JFb3CVczqOkru2xspuKczHEbG3nvmPY7IFqVmGGHdNbYw==
"@types/lunr@^2.3.7":
version "2.3.7"
resolved "https://registry.yarnpkg.com/@types/lunr/-/lunr-2.3.7.tgz#378a98ecf7a9fafc42466f67f73173c34a6265a0"
integrity sha512-Tb/kUm38e8gmjahQzdCKhbdsvQ9/ppzHFfsJ0dMs3ckqQsRj+P5IkSAwFTBrBxdyr3E/LoMUUrZngjDYAjiE3A==
"@types/mdast@^3.0.0": "@types/mdast@^3.0.0":
version "3.0.10" version "3.0.10"
resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.10.tgz#4724244a82a4598884cbbe9bcfd73dff927ee8af" resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.10.tgz#4724244a82a4598884cbbe9bcfd73dff927ee8af"

Loading…
Cancel
Save