diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js
index c2f59cfd3b..608f917270 100644
--- a/apps/remix-ide/src/app.js
+++ b/apps/remix-ide/src/app.js
@@ -539,7 +539,8 @@ class AppComponent {
'fetchAndCompile',
'contentImport',
'gistHandler',
- 'compilerloader'
+ 'compilerloader',
+ 'remixAI'
])
await this.appManager.activatePlugin(['settings'])
diff --git a/apps/remix-ide/src/app/plugins/electron/remixAIDesktopPlugin.tsx b/apps/remix-ide/src/app/plugins/electron/remixAIDesktopPlugin.tsx
index 81c4705a4f..e9909ebc1f 100644
--- a/apps/remix-ide/src/app/plugins/electron/remixAIDesktopPlugin.tsx
+++ b/apps/remix-ide/src/app/plugins/electron/remixAIDesktopPlugin.tsx
@@ -10,18 +10,17 @@ const desktop_profile = {
description: 'RemixAI provides AI services to Remix IDE Desktop.',
documentation: 'https://remix-ide.readthedocs.io/en/latest/remixai.html',
icon: 'assets/img/remix-logo-blue.png',
- methods: ['downloadModel', 'loadTransformerModel', 'code_completion'],
+ methods: ['initializeModelBackend', 'code_completion', 'code_insertion', 'code_generation', 'code_explaining', 'error_explaining', 'solidity_answer'],
}
export class remixAIDesktopPlugin extends ElectronPlugin {
constructor() {
- console.log('remixAIDesktopPlugin loaded')
super(desktop_profile)
}
onActivation(): void {
- this.on('remixAI', 'enabled', () => {console.log('someone enable the remixAI desktop plugin')} )
- console.log('remixAIDesktopPlugin ---------------------- activated')
+ this.on('remixAI', 'enabled', () => {} )
+ console.log('remixAIDesktopPlugin activated')
}
}
diff --git a/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx b/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx
index dcd78d221a..0fd0917d08 100644
--- a/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx
+++ b/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx
@@ -4,7 +4,6 @@ import { Plugin } from '@remixproject/engine';
import { RemixAITab } from '@remix-ui/remix-ai'
import React from 'react';
import { ICompletions, IModel, RemoteInferencer, IRemoteModel } from '@remix/remix-ai-core';
-import { resourceUsage } from 'process';
const profile = {
name: 'remixAI',
@@ -17,13 +16,13 @@ const profile = {
icon: 'assets/img/remix-logo-blue.png',
description: 'RemixAI provides AI services to Remix IDE.',
kind: '',
- location: 'sidePanel',
+ // location: 'sidePanel',
documentation: 'https://remix-ide.readthedocs.io/en/latest/remixai.html',
version: packageJson.version,
maintainedBy: 'Remix'
}
-export class RemixAIPlugin extends ViewPlugin {
+export class RemixAIPlugin extends Plugin {
isOnDesktop:boolean = false
aiIsActivated:boolean = false
readonly remixDesktopPluginName = 'remixAID'
@@ -31,7 +30,6 @@ export class RemixAIPlugin extends ViewPlugin {
isInferencing: boolean = false
constructor(inDesktop:boolean) {
- console.log('remixAIPlugin loaded')
super(profile)
this.isOnDesktop = inDesktop
@@ -41,16 +39,20 @@ export class RemixAIPlugin extends ViewPlugin {
onActivation(): void {
if (this.isOnDesktop) {
console.log('Activating RemixAIPlugin on desktop')
+ this.on(this.remixDesktopPluginName, 'activated', () => {
+ this.call("remixAI", 'initialize', null, null, null, false);
+ })
} else {
console.log('Activating RemixAIPlugin on browser')
this.initialize()
}
}
- async initialize(model1?:IModel, model2?:IModel, remoteModel?:IRemoteModel){
-
+ async initialize(model1?:IModel, model2?:IModel, remoteModel?:IRemoteModel, useRemote?:boolean){
if (this.isOnDesktop) {
- const res = await this.call(this.remixDesktopPluginName, 'initializeModelBackend', false, model1, model2)
+ // on desktop use remote inferencer -> false
+ console.log('initialize on desktop')
+ const res = await this.call(this.remixDesktopPluginName, 'initializeModelBackend', useRemote, model1, model2)
if (res) {
this.on(this.remixDesktopPluginName, 'onStreamResult', (value) => {
this.call('terminal', 'log', { type: 'log', value: value })
@@ -67,7 +69,6 @@ export class RemixAIPlugin extends ViewPlugin {
} else {
// on browser
- console.log('Initializing RemixAIPlugin on browser')
this.remoteInferencer = new RemoteInferencer(remoteModel?.apiUrl, remoteModel?.completionUrl)
this.remoteInferencer.event.on('onInference', () => {
this.isInferencing = true
@@ -168,9 +169,9 @@ export class RemixAIPlugin extends ViewPlugin {
}
}
- render() {
- return (
-
- )
- }
+ // render() {
+ // return (
+ //
+ // )
+ // }
}
diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js
index 1f080ad7ff..9dab012bd5 100644
--- a/apps/remix-ide/src/remixAppManager.js
+++ b/apps/remix-ide/src/remixAppManager.js
@@ -77,6 +77,7 @@ let requiredModules = [ // services + layout views + system views
'doc-gen',
'remix-templates',
'remixAID',
+ 'remixAI',
'solhint',
'dgit',
'pinnedPanel',
diff --git a/apps/remixdesktop/src/plugins/remixAIDektop.ts b/apps/remixdesktop/src/plugins/remixAIDektop.ts
index 3898ecaf96..f32e36e342 100644
--- a/apps/remixdesktop/src/plugins/remixAIDektop.ts
+++ b/apps/remixdesktop/src/plugins/remixAIDektop.ts
@@ -21,7 +21,6 @@ const profile = {
export class RemixAIDesktopPlugin extends ElectronBasePlugin {
clients: RemixAIDesktopPluginClient[] = []
constructor() {
- console.log("loading the remix plugin main plugin ")
super(profile, clientProfile, RemixAIDesktopPluginClient)
this.methods = [...super.methods]
@@ -54,8 +53,7 @@ class RemixAIDesktopPluginClient extends ElectronBasePluginClient {
async onActivation(): Promise {
console.log("Activation", "loaded the remix plugin client application side")
this.onload(() => {
- this.emit('loaded')
- console.log("loaded the remix plugin client application side")
+ this.emit('activated')
})
}
@@ -65,12 +63,12 @@ class RemixAIDesktopPluginClient extends ElectronBasePluginClient {
}
async initializeModelBackend(local, generalModel?, completionModel?){
- if (local){
- console.log('Initializing Inference model locally')
+ if (!local){
+ console.log('RemixAI remote enpoints')
this.desktopInferencer = new RemoteInferencer()
} else if (generalModel || completionModel){
if (!this.desktopInferencer){
- console.log('Initializing Inference model')
+ console.log('RemixAI local enpoints')
this.desktopInferencer = InferenceManager.getInstance(this.modelCacheDir)
if (this.desktopInferencer instanceof InferenceManager && generalModel) await this.desktopInferencer.init(generalModel)
if (this.desktopInferencer instanceof InferenceManager && completionModel) await this.desktopInferencer.init(completionModel)