added agents skeleton

pull/5100/head
STetsing 2 months ago
parent cd54918cd8
commit 187129acb7
  1. 7
      apps/remixdesktop/src/lib/InferenceServerManager.ts
  2. 29
      libs/remix-ai-core/src/agents/codeExplainAgent.ts
  3. 23
      libs/remix-ai-core/src/agents/completionAgent.ts
  4. 29
      libs/remix-ai-core/src/agents/securityAgent.ts

@ -7,6 +7,7 @@ import { ICompletions, IModel, IParams, InsertionParams,
CompletionParams, GenerationParams, ModelType, AIRequestType, CompletionParams, GenerationParams, ModelType, AIRequestType,
IStreamResponse, ChatHistory, downloadLatestReleaseExecutable, IStreamResponse, ChatHistory, downloadLatestReleaseExecutable,
buildSolgptPromt } from "@remix/remix-ai-core" buildSolgptPromt } from "@remix/remix-ai-core"
import { platform } from 'os';
class ServerStatusTimer { class ServerStatusTimer {
private intervalId: NodeJS.Timeout | null = null; private intervalId: NodeJS.Timeout | null = null;
@ -265,11 +266,11 @@ export class InferenceManager implements ICompletions {
// get platform name and return the path to the python script // get platform name and return the path to the python script
let exec_name = '' let exec_name = ''
if (process.platform === 'win32') { if (process.platform === 'win32') {
exec_name = 'InferenceServer_' + process.platform + '.exe' exec_name = 'InferenceServer_' + process.platform + '_' + exec_suffix + '.exe'
} else if (process.platform === 'linux') { } else if (process.platform === 'linux') {
exec_name = 'InferenceServer_' + process.platform exec_name = 'InferenceServer_' + process.platform + '_' + exec_suffix
} else if (process.platform === 'darwin') { } else if (process.platform === 'darwin') {
exec_name = 'InferenceServer_' + process.platform exec_name = 'InferenceServer_' + process.platform + '_' + exec_suffix
} else { } else {
throw new Error('Unsupported platform') throw new Error('Unsupported platform')
} }

@ -0,0 +1,29 @@
// interactive code explaining and highlight security vunerabilities
import * as fs from 'fs';
class CodeExplainAgent {
private codebase: string[]; // list of code base file
public currentFile: string;
constructor(codebasePath: string) {
// git or fs
this.codebase = this.loadCodebase(codebasePath);
}
private loadCodebase(path: string): string[] {
const files = fs.readdirSync(path);
return files
.filter(file => file.endsWith('.ts'))
.flatMap(file => fs.readFileSync(`${path}/${file}`, 'utf-8').split('\n'));
}
public update(currentFile, lineNumber){
}
public getExplanations(currentLine: string, numSuggestions: number = 3): string[] {
// process the code base explaining the current file and highlight some details
const suggestions: string[] = [];
return suggestions;
}
}

@ -0,0 +1,23 @@
import * as fs from 'fs';
class CodeCompletionAgent {
private codebase: string[];
constructor(codebasePath: string) {
// git or fs
this.codebase = this.loadCodebase(codebasePath);
}
private loadCodebase(path: string): string[] {
const files = fs.readdirSync(path);
return files
.filter(file => file.endsWith('.ts'))
.flatMap(file => fs.readFileSync(`${path}/${file}`, 'utf-8').split('\n'));
}
public getSuggestions(currentLine: string, numSuggestions: number = 3): string[] {
const suggestions: string[] = [];
// get `numSuggestions` from the llm
return suggestions;
}
}

@ -0,0 +1,29 @@
// security checks
import * as fs from 'fs';
class SecurityAgent {
private codebase: string[]; // list of code base file
public currentFile: string;
constructor(codebasePath: string) {
// git or fs
this.codebase = this.loadCodebase(codebasePath);
}
private loadCodebase(path: string): string[] {
const files = fs.readdirSync(path);
return files
.filter(file => file.endsWith('.ts'))
.flatMap(file => fs.readFileSync(`${path}/${file}`, 'utf-8').split('\n'));
}
public update(currentFile, lineNumber){
}
public getRecommendations(currentLine: string, numSuggestions: number = 3): string[] {
// process the code base highlighting security vunerabilities and deliver recommendations
const suggestions: string[] = [];
return suggestions;
}
}
Loading…
Cancel
Save