added platform bins

pull/5370/head
Stéphane Tetsing 7 months ago
parent 9ef419b1ca
commit d9c9cadb41
  1. 4
      apps/remix-ide/src/app/plugins/remixAIPlugin.tsx
  2. 38
      apps/remixdesktop/src/lib/InferenceServerManager.ts
  3. 2
      libs/remix-ui/remix-ai/src/lib/components/Default.tsx

@ -116,7 +116,7 @@ export class RemixAIPlugin extends ViewPlugin {
} else { } else {
result = await this.remoteInferencer.solidity_answer(prompt) result = await this.remoteInferencer.solidity_answer(prompt)
} }
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result }) if (result) this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result })
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: "RemixAI Done" }) this.call('terminal', 'log', { type: 'aitypewriterwarning', value: "RemixAI Done" })
} }
@ -153,7 +153,7 @@ export class RemixAIPlugin extends ViewPlugin {
} else { } else {
result = await this.remoteInferencer.error_explaining(prompt) result = await this.remoteInferencer.error_explaining(prompt)
} }
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result }) if (result) this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result })
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: "RemixAI Done" }) this.call('terminal', 'log', { type: 'aitypewriterwarning', value: "RemixAI Done" })
} }

@ -194,13 +194,43 @@ export class InferenceManager implements ICompletions {
} }
} }
getPythonScriptPath() { private _getServerPath() {
return path.join(process.cwd(), 'dist', 'InferenceServer'); // get cpu arch
const arch = process.arch
let exec_suffix = ''
if (arch === 'x64') {
exec_suffix = 'x64'
} else if (arch === 'arm' || arch === 'arm64') {
exec_suffix = 'arm'
} else {
throw new Error('Unsupported CPU architecture')
}
// get platform name and return the path to the python script
let exec_name = ''
if (process.platform === 'win32') {
exec_name = 'InferenceServer_' + process.platform + exec_suffix + '.exe'
} else if (process.platform === 'linux') {
exec_name = 'InferenceServer_' + process.platform + exec_suffix
} else if (process.platform === 'darwin') {
exec_name = 'InferenceServer_' + process.platform + exec_suffix
} else {
throw new Error('Unsupported platform')
}
return path.join(process.cwd(), 'dist', exec_name);
} }
private _startServer() { private _startServer() {
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
const serverPath = this.getPythonScriptPath(); let serverPath = ""
try {
serverPath = this._getServerPath();
} catch (error) {
console.error('Error script path:', error);
return reject(error)
}
// Check if the file exists // Check if the file exists
if (!fs.existsSync(serverPath)) { if (!fs.existsSync(serverPath)) {
@ -231,7 +261,7 @@ export class InferenceManager implements ICompletions {
console.error(`Inference log: ${data}`); console.error(`Inference log: ${data}`);
if (data.includes('Address already in use')) { if (data.includes('Address already in use')) {
console.error(`Port ${this.port} is already in use. Please stop the existing server and try again`); console.error(`Port ${this.port} is already in use. Please stop the existing server and try again`);
reject(new Error(`Port ${this.port} is already in use`)); return reject(new Error(`Port ${this.port} is already in use`));
} }
resolve(); resolve();
}); });

@ -70,7 +70,7 @@ export const Default = (props) => {
<button className="remix_ai_plugin_download_button text-ai pl-2 pr-0 py-0 d-flex" <button className="remix_ai_plugin_download_button text-ai pl-2 pr-0 py-0 d-flex"
onClick={async () => { onClick={async () => {
props.plugin.call("remixAI", 'initialize', DefaultModels()[1]); props.plugin.call("remixAI", 'initialize', DefaultModels()[3], DefaultModels()[1]);
}} }}
> Init Model </button> > Init Model </button>
</div> </div>

Loading…
Cancel
Save