commit
92d7f65a48
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,60 @@ |
||||
{ |
||||
"productName": "Remix-Desktop-Insiders", |
||||
"appId": "org.ethereum.remix-ide", |
||||
"asar": true, |
||||
"generateUpdatesFilesForAllChannels": false, |
||||
"icon": "assets", |
||||
"files": [ |
||||
"build/**/*", |
||||
"node_modules/node-pty/**/*" |
||||
], |
||||
"afterSign": "aftersign.js", |
||||
"afterAllArtifactBuild": "afterbuild.js", |
||||
"publish": [ |
||||
{ |
||||
"provider": "github", |
||||
"owner": "remix-project-org", |
||||
"repo": "remix-desktop-insiders", |
||||
"releaseType": "draft", |
||||
"publishAutoUpdate": true |
||||
} |
||||
], |
||||
"mac": { |
||||
"category": "public.app-category.productivity", |
||||
"icon": "assets/icon.png", |
||||
"darkModeSupport": true, |
||||
"hardenedRuntime": true, |
||||
"gatekeeperAssess": false, |
||||
"entitlements": "entitlements.mac.plist", |
||||
"entitlementsInherit": "entitlements.mac.plist" |
||||
}, |
||||
"dmg": { |
||||
"writeUpdateInfo": true, |
||||
"sign": true |
||||
}, |
||||
"nsis": { |
||||
"createDesktopShortcut": "always", |
||||
"allowToChangeInstallationDirectory": true, |
||||
"oneClick": false, |
||||
"shortcutName": "Remix Desktop Insiders", |
||||
"differentialPackage": false |
||||
}, |
||||
"win": { |
||||
"target": [ |
||||
"nsis" |
||||
], |
||||
"artifactName": "Remix-Desktop-Setup-${version}.${ext}", |
||||
"icon": "assets/icon.png" |
||||
}, |
||||
"deb": {}, |
||||
"linux": { |
||||
"target": [ |
||||
"dir" |
||||
], |
||||
"category": "WebBrowser", |
||||
"icon": "assets" |
||||
}, |
||||
"directories": { |
||||
"output": "release" |
||||
} |
||||
} |
@ -1,29 +1,44 @@ |
||||
// interactive code explaining and highlight security vunerabilities
|
||||
import * as fs from 'fs'; |
||||
|
||||
class CodeExplainAgent { |
||||
export class CodeExplainAgent { |
||||
private codebase: string[]; // list of code base file
|
||||
public currentFile: string; |
||||
plugin |
||||
|
||||
constructor(codebasePath: string) { |
||||
constructor(props) { |
||||
this.plugin = props |
||||
// git or fs
|
||||
this.codebase = this.loadCodebase(codebasePath); |
||||
const 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')); |
||||
return [] |
||||
} |
||||
|
||||
public update(currentFile, lineNumber){ |
||||
|
||||
} |
||||
|
||||
async chatCommand(prompt:string){ |
||||
// change this function with indexer or related
|
||||
try { |
||||
if (prompt.includes('Explain briefly the current file')){ |
||||
const file = await this.plugin.call('fileManager', 'getCurrentFile') |
||||
const content = `Explain this code:\n ${await this.plugin.call('fileManager', 'readFile', file)}` |
||||
return content |
||||
} else return prompt |
||||
} catch { |
||||
console.log('There is No file selected') |
||||
return 'There is No file selected' |
||||
} |
||||
} |
||||
|
||||
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; |
||||
} |
||||
} |
||||
|
||||
// Handle file changed (significantly)
|
||||
|
@ -0,0 +1,62 @@ |
||||
import { ChatHistory } from '../prompts/chat'; |
||||
import { JsonStreamParser } from '../types/types' |
||||
|
||||
export const HandleSimpleResponse = async (response, |
||||
cb?: (streamText: string) => void) => { |
||||
let resultText = '' |
||||
const parser = new JsonStreamParser(); |
||||
|
||||
const chunk = parser.safeJsonParse<{ generatedText: string; isGenerating: boolean }>(response); |
||||
for (const parsedData of chunk) { |
||||
if (parsedData.isGenerating) { |
||||
resultText += parsedData.generatedText |
||||
cb(parsedData.generatedText) |
||||
} else { |
||||
resultText += parsedData.generatedText |
||||
cb(parsedData.generatedText) |
||||
} |
||||
} |
||||
} |
||||
|
||||
export const HandleStreamResponse = async (streamResponse, |
||||
cb: (streamText: string) => void, |
||||
done_cb?: (result: string) => void) => { |
||||
try { |
||||
let resultText = '' |
||||
const parser = new JsonStreamParser(); |
||||
const reader = streamResponse.body?.getReader(); |
||||
const decoder = new TextDecoder(); |
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) { |
||||
const { done, value } = await reader.read(); |
||||
if (done) break; |
||||
|
||||
try { |
||||
const chunk = parser.safeJsonParse<{ generatedText: string; isGenerating: boolean }>(decoder.decode(value, { stream: true })); |
||||
for (const parsedData of chunk) { |
||||
if (parsedData.isGenerating) { |
||||
resultText += parsedData.generatedText |
||||
cb(parsedData.generatedText) |
||||
} else { |
||||
resultText += parsedData.generatedText |
||||
cb(parsedData.generatedText) |
||||
} |
||||
} |
||||
} |
||||
catch (error) { |
||||
console.error('Error parsing JSON:', error); |
||||
} |
||||
} |
||||
if (done_cb) { |
||||
done_cb(resultText) |
||||
} |
||||
} |
||||
catch (error) { |
||||
console.error('Error parsing JSON:', error); |
||||
} |
||||
} |
||||
|
||||
export const UpdtateChatHistory = (userPromptprompt: string, AIAnswer: string) => { |
||||
ChatHistory.pushHistory(userPromptprompt, AIAnswer) |
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"folders": [ |
||||
{ |
||||
"path": "../../../.." |
||||
}, |
||||
{ |
||||
"path": "../../../../../remix-wildcard" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,11 @@ |
||||
import { StatusEvents } from "@remixproject/plugin-utils" |
||||
|
||||
export interface IDgitPlugin { |
||||
events: { |
||||
} & StatusEvents, |
||||
methods: { |
||||
open(panel: string): Promise<void>, |
||||
init(): Promise<void> |
||||
} |
||||
} |
||||
|
@ -0,0 +1,23 @@ |
||||
import { IParams } from "@remix/remix-ai-core"; |
||||
import { StatusEvents } from "@remixproject/plugin-utils"; |
||||
|
||||
export interface IRemixAID { |
||||
events: { |
||||
activated():void, |
||||
onInference():void, |
||||
onInferenceDone():void, |
||||
onStreamResult(streamText: string):void, |
||||
|
||||
} & StatusEvents, |
||||
methods: { |
||||
code_completion(context: string): Promise<string>
|
||||
code_insertion(msg_pfx: string, msg_sfx: string): Promise<string>, |
||||
code_generation(prompt: string): Promise<string | null>, |
||||
code_explaining(code: string, context?: string): Promise<string | null>, |
||||
error_explaining(prompt: string): Promise<string | null>, |
||||
solidity_answer(prompt: string): Promise<string | null>, |
||||
initializeModelBackend(local: boolean, generalModel?, completionModel?): Promise<boolean>, |
||||
chatPipe(pipeMessage: string): Promise<void>, |
||||
ProcessChatRequestBuffer(params:IParams): Promise<void>, |
||||
} |
||||
} |
@ -1 +1 @@ |
||||
export { RemixAITab } from './lib/components/RemixAI' |
||||
export { RemixAITab, ChatApi } from './lib/components/RemixAI' |
@ -1,15 +1,16 @@ |
||||
import React, { useContext } from 'react' |
||||
import '../remix-ai.css' |
||||
import { Default } from './Default' |
||||
import { Default, ChatApi } from './Default' |
||||
|
||||
export const RemixAITab = (props) => { |
||||
|
||||
const plugin = props.plugin |
||||
return ( |
||||
<> |
||||
<div id="remixAITab pr-4 px-2 pb-4"> |
||||
<div id="remixAITab" className="px-2 pb-4"> |
||||
<Default plugin={plugin}></Default> |
||||
</div> |
||||
</> |
||||
) |
||||
} |
||||
} |
||||
export { ChatApi } |
@ -0,0 +1,89 @@ |
||||
.nlux-theme-remix_ai_theme[data-color-scheme='light'] { |
||||
--nlux-ChatRoom--BackgroundColor: var(--text-background); |
||||
} |
||||
|
||||
.nlux-theme-remix_ai_theme[data-color-scheme='dark'] { |
||||
--nlux-ChatRoom--BackgroundColor: var(--text-background); |
||||
} |
||||
|
||||
.nlux-theme-remix_ai_theme { |
||||
|
||||
/* Override top-level chat room colors */ |
||||
--nlux-ChatRoom--BorderColor: #24233d; |
||||
--nlux-ChatRoom-Divider--Color: var(--light); |
||||
/* --nlux-ChatRoom-Divider--BorderWidth:2px; */ |
||||
--nlux-ChatRoom--TextColor: var(--text); |
||||
|
||||
/* Override message bubble colors */ |
||||
--nlux-AiMessage--BackgroundColor: var(--light); |
||||
--nlux-HumanMessage--BackgroundColor: var(--text-background); |
||||
|
||||
/* Override border width */ |
||||
--nlux-ChatRoom--BorderWidth: 0; |
||||
--nlux-SubmitButton--BorderWidth: 0; |
||||
--nlux-ChatItem-Avatar--BorderWidth: 0; |
||||
--nlux-ChatItem-Message-BubbleLayout--BorderWidth: 0; |
||||
--nlux-ConversationStarter--BorderWidth: 1; |
||||
|
||||
/* Override border radius */ |
||||
--nlux-ChatRoom--BorderRadius: 5px; |
||||
--nlux-SubmitButton--BorderRadius: 0 10px 10px 0; |
||||
--nlux-SubmitButton--Width: 73px; |
||||
--nlux-ChatItem-Avatar--BorderRadius: 5px; |
||||
--nlux-ChatItem-Message-BubbleLayout--BorderRadius: 5px; |
||||
--nlux-ConversationStarter--BorderRadius: 5px; |
||||
--nlux-PromptInput-Focus-Outline--Width: 10px; |
||||
--nlux-PromptInput-Max-Height: 50px; |
||||
--nlux-PromptInput--BorderWidth: 0; |
||||
.nlux-comp-composer > textarea {padding: 8px;} |
||||
--nlux-PromptInput--BorderRadius: 10px 0 0 10px; |
||||
--nlux-PromptInput-Height: 50px; |
||||
|
||||
|
||||
/* Override input colors */ |
||||
--nlux-PromptInput--BackgroundColor: var(--light); |
||||
--nlux-PromptInput-Active--BackgroundColor: var(--light); |
||||
--nlux-PromptInput-Disabled--BackgroundColor: var(--dark); |
||||
|
||||
/* Gap between submit button and input */ |
||||
--nlux-Composer--Gap: 0; |
||||
|
||||
/* Override submit button colors */ |
||||
--nlux-SubmitButton--BackgroundColor: var(--primary); |
||||
--nlux-SubmitButton-Active--BackgroundColor:var(--primary); |
||||
--nlux-SubmitButton-Disabled--BackgroundColor: var(--dark); |
||||
--nlux-SubmitButton-Active--TextColor: var(--text); |
||||
--nlux-SubmitButton-Disabled--TextColor: var(--text); |
||||
|
||||
/** Inline code in markdown */ |
||||
--nlux-InlineCode--BorderRadius: 6px; |
||||
--nlux-InlineCode--BorderWidth: 0.5px; |
||||
--nlux-InlineCode--Padding: 0 2px; |
||||
--nlux-InlineCode--FontSize: 14px; |
||||
|
||||
|
||||
/*code block */ |
||||
--nlux-CodeBlock-CopyButton--BackgroundColor: var(--bg-text); |
||||
--nlux-CodeBlock-CopyButton--TextColor: var(--text); |
||||
|
||||
/*codeblock*/ |
||||
/*--nlux-CodeBlock--BackgroundColor: var(--body-bg);*/ |
||||
--nlux-CodeBlock--BackgroundColor: var(--bg-text); |
||||
--nlux-CodeBlock--BorderColor: var(--secondary); |
||||
--nlux-CodeBlock--Padding: 20px; |
||||
--nlux-CodeBlock--TextColor: var(--text); |
||||
--nlux-CodeBlock--FontSize: 14px; |
||||
--nlux-cvStrt--wd: var(--nlux-ConversationStarter--Width, 100px); |
||||
|
||||
/* Conversation starter colors */ |
||||
--nlux-ConversationStarter--BackgroundColor: var(--light); |
||||
--nlux-copy-icon: url('data:image/svg+xml,\ |
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">\ |
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M15 1.25H10.9436C9.10583 1.24998 7.65019 1.24997 6.51098 1.40314C5.33856 1.56076 4.38961 1.89288 3.64124 2.64124C2.89288 3.38961 2.56076 4.33856 2.40314 5.51098C2.24997 6.65019 2.24998 8.10582 2.25 9.94357V16C2.25 17.8722 3.62205 19.424 5.41551 19.7047C5.55348 20.4687 5.81753 21.1208 6.34835 21.6517C6.95027 22.2536 7.70814 22.5125 8.60825 22.6335C9.47522 22.75 10.5775 22.75 11.9451 22.75H15.0549C16.4225 22.75 17.5248 22.75 18.3918 22.6335C19.2919 22.5125 20.0497 22.2536 20.6517 21.6517C21.2536 21.0497 21.5125 20.2919 21.6335 19.3918C21.75 18.5248 21.75 17.4225 21.75 16.0549V10.9451C21.75 9.57754 21.75 8.47522 21.6335 7.60825C21.5125 6.70814 21.2536 5.95027 20.6517 5.34835C20.1208 4.81753 19.4687 4.55348 18.7047 4.41551C18.424 2.62205 16.8722 1.25 15 1.25ZM17.1293 4.27117C16.8265 3.38623 15.9876 2.75 15 2.75H11C9.09318 2.75 7.73851 2.75159 6.71085 2.88976C5.70476 3.02502 5.12511 3.27869 4.7019 3.7019C4.27869 4.12511 4.02502 4.70476 3.88976 5.71085C3.75159 6.73851 3.75 8.09318 3.75 10V16C3.75 16.9876 4.38624 17.8265 5.27117 18.1293C5.24998 17.5194 5.24999 16.8297 5.25 16.0549V10.9451C5.24998 9.57754 5.24996 8.47522 5.36652 7.60825C5.48754 6.70814 5.74643 5.95027 6.34835 5.34835C6.95027 4.74643 7.70814 4.48754 8.60825 4.36652C9.47522 4.24996 10.5775 4.24998 11.9451 4.25H15.0549C15.8297 4.24999 16.5194 4.24998 17.1293 4.27117ZM7.40901 6.40901C7.68577 6.13225 8.07435 5.9518 8.80812 5.85315C9.56347 5.75159 10.5646 5.75 12 5.75H15C16.4354 5.75 17.4365 5.75159 18.1919 5.85315C18.9257 5.9518 19.3142 6.13225 19.591 6.40901C19.8678 6.68577 20.0482 7.07435 20.1469 7.80812C20.2484 8.56347 20.25 9.56458 20.25 11V16C20.25 17.4354 20.2484 18.4365 20.1469 19.1919C20.0482 19.9257 19.8678 20.3142 19.591 20.591C19.3142 20.8678 18.9257 21.0482 18.1919 21.1469C17.4365 21.2484 16.4354 21.25 15 21.25H12C10.5646 21.25 9.56347 21.2484 8.80812 21.1469C8.07435 21.0482 7.68577 20.8678 7.40901 20.591C7.13225 20.3142 6.9518 19.9257 6.85315 19.1919C6.75159 18.4365 6.75 17.4354 6.75 16V11C6.75 9.56458 6.75159 8.56347 6.85315 7.80812C6.9518 7.07435 7.13225 6.68577 7.40901 6.40901Z" fill="currentColor"/>\ |
||||
</svg>\ |
||||
'); |
||||
|
||||
/* Override icon for the send button */ |
||||
--nlux-send-icon: url('data:image/svg+xml, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M0 256a256 256 0 1 0 512 0A256 256 0 1 0 0 256zM297 385c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l71-71L120 280c-13.3 0-24-10.7-24-24s10.7-24 24-24l214.1 0-71-71c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0L409 239c9.4 9.4 9.4 24.6 0 33.9L297 385z"/></svg>'); |
||||
|
||||
} |
@ -0,0 +1,8 @@ |
||||
import { PersonaOptions, UserPersona } from '@nlux/react'; |
||||
|
||||
export const user: UserPersona = { |
||||
name: 'Pipper', |
||||
avatar: 'assets/img/remix-logo-blue.png' |
||||
}; |
||||
|
||||
export const assistantAvatar = 'assets/img/remi-prof.webp'; |
@ -0,0 +1,47 @@ |
||||
|
||||
// const demoProxyServerUrl = 'https://solcoder.remixproject.org';
|
||||
|
||||
// export const send: StreamSend = async (
|
||||
// prompt: string,
|
||||
// observer: StreamingAdapterObserver,
|
||||
// plugin: any,
|
||||
// ) => {
|
||||
// const body = {"data": [prompt, 'solidity_answer', false,2000,0.9,0.8,50]};
|
||||
// const response = await axios(demoProxyServerUrl, {
|
||||
// method: 'POST',
|
||||
// headers: {'Content-Type': 'application/json'},
|
||||
// data: JSON.stringify(body),
|
||||
// });
|
||||
|
||||
// console.log(plugin);
|
||||
// const result = await plugin.call('remixAI', 'solidity_answer', prompt);
|
||||
|
||||
// if (response.status !== 200) {
|
||||
// observer.error(new Error('Failed to connect to the server'));
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (response.statusText !== "OK") {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // Read a stream of server-sent events
|
||||
// // and feed them to the observer as they are being generated
|
||||
// // const reader = response.body.getReader();
|
||||
// // const textDecoder = new TextDecoder();
|
||||
|
||||
// // while (true) {
|
||||
// // const {value, done} = await reader.read();
|
||||
// // if (done) {
|
||||
// // break;
|
||||
// // }
|
||||
|
||||
// // const content = textDecoder.decode(value);
|
||||
// // if (content) {
|
||||
// // observer.next(content);
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// observer.next(response.data.data[0]);
|
||||
// observer.complete();
|
||||
// };
|
Loading…
Reference in new issue