Skip to content

Generate agent #5870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 107 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
ab4e81b
initial commit
STetsing Mar 12, 2025
655c06d
minor
STetsing Mar 12, 2025
3a55986
revised workspace
STetsing Mar 13, 2025
eb94671
tests on ts
STetsing Mar 13, 2025
3528efb
enabled error correction
STetsing Mar 13, 2025
01ecb20
added anthropic and mistralai
STetsing Mar 18, 2025
833800f
minor
STetsing Mar 19, 2025
3a53244
Merge branch 'master' into generate_agent
STetsing Mar 19, 2025
20fb2f5
minor
STetsing Mar 19, 2025
4697ac8
Merge branch 'generate_agent' of https://github.com/ethereum/remix-pr…
STetsing Mar 19, 2025
278d6a5
lint
STetsing Mar 19, 2025
0904e3c
logs
STetsing Mar 19, 2025
8c421ff
added provider select command
STetsing Mar 24, 2025
0e0b6ec
runpod request
STetsing Apr 3, 2025
b4b5f5d
Merge branch 'master' into generate_agent
STetsing Apr 3, 2025
694765f
initial rag
STetsing Apr 4, 2025
4aad873
initial rag
STetsing Apr 4, 2025
ac2006d
lint
STetsing Apr 7, 2025
6b60e4e
added workspace commanf
STetsing Apr 15, 2025
d0f79dd
Merge branch 'master' into generate_agent
STetsing Apr 15, 2025
404bcf8
workspace chat with provider
STetsing Apr 15, 2025
a0cca0f
adding test to workspace
STetsing Apr 17, 2025
07738dd
create initial ai assistant plugin
joeizang Apr 22, 2025
4425dd9
minor
STetsing Apr 23, 2025
1f76be1
add v4-core-github resolver
yann300 Apr 23, 2025
6fa8bf6
Merge branch 'generate_agent' of github.com:ethereum/remix-project in…
yann300 Apr 23, 2025
88338f4
start assistant on the right. position things properly
joeizang Apr 23, 2025
60108e6
Merge branch 'master' into remix-ai-assistant
joeizang Apr 23, 2025
d78c8f5
create smaller components
joeizang Apr 28, 2025
b2f9afc
Merge branch 'master' into remix-ai-assistant
joeizang Apr 28, 2025
9660086
minor
STetsing Apr 28, 2025
d5d1df1
changes
joeizang Apr 29, 2025
60dc7f6
Merge branch 'master' into remix-ai-assistant
joeizang Apr 29, 2025
48da1aa
better error insersion
STetsing Apr 29, 2025
d883884
main prompt on error recursion
STetsing Apr 29, 2025
5119bb0
clean
STetsing Apr 29, 2025
09be783
improved commands
STetsing Apr 30, 2025
cb18d2d
fix response styling
joeizang Apr 30, 2025
d04081f
uniswap v4 and ollama init impl
STetsing May 2, 2025
04e54dd
minor
STetsing May 5, 2025
d70ce3e
minor
STetsing May 6, 2025
14552dd
create initial ai assistant plugin
joeizang Apr 22, 2025
a182ced
start assistant on the right. position things properly
joeizang Apr 23, 2025
8053ec1
create smaller components
joeizang Apr 28, 2025
219ee73
changes
joeizang Apr 29, 2025
ef9f156
fix response styling
joeizang Apr 30, 2025
41ee3f0
fix styles. maximize aiassistant. custom promptzone
joeizang May 6, 2025
f2fcfdc
update dev deps
joeizang May 7, 2025
2ab9075
yarn install for rebase. update gitignore to avoid dev packages
joeizang May 7, 2025
90e29d1
Merge branch 'master' into generate_agent
STetsing May 9, 2025
af365ee
added context on sol answer
STetsing May 12, 2025
a68bca2
minor
STetsing May 12, 2025
a3593cd
upload files context
STetsing May 12, 2025
53329ba
generate
STetsing May 12, 2025
b0dca79
disable log
STetsing May 12, 2025
3bd3ba2
reolving uniswap to main
STetsing May 12, 2025
7ef6e4b
Merge branch 'master' into remix-ai-assistant
joeizang May 12, 2025
1143654
cleanup. updates to promptzone which updates composer in nlux
joeizang May 12, 2025
79a5581
solve merge conflicts
STetsing May 13, 2025
3cc33ac
Merge branch 'generate_agent' into remix-ai-assistant
STetsing May 13, 2025
48e8d46
refining context
STetsing May 13, 2025
3a1d395
adding agent call
STetsing May 13, 2025
ec6f5f1
Merge pull request #6019 from ethereum/remix-ai-assistant
STetsing May 13, 2025
c0f3f35
resolve @uniswap/v4-periph
STetsing May 14, 2025
7a88dcd
added short commands
STetsing May 14, 2025
dce2118
add Aigen template
joeizang May 14, 2025
6c0e641
add modal to generate workspace. show info and update starters.
joeizang May 16, 2025
5c22a81
compile one time
STetsing May 16, 2025
a5f122e
#6020
STetsing May 19, 2025
32d031b
rm comments
STetsing May 19, 2025
0931de6
rm comments
STetsing May 19, 2025
3939854
remove old chat window
joeizang May 19, 2025
d548f79
custom nlux
STetsing May 19, 2025
115b111
rm yalc folder
STetsing May 19, 2025
8aa0a64
changes as discussed by @STetsing
joeizang May 19, 2025
5173e33
added generation events
STetsing May 19, 2025
bfe0ba2
git commit add changes
joeizang May 19, 2025
f858536
Merge pull request #6034 from ethereum/nlux_import
STetsing May 19, 2025
080633c
updated nlux
STetsing May 19, 2025
2cce3d3
fix ai modal check
joeizang May 19, 2025
32bda2f
changes while working with @STetsing
joeizang May 19, 2025
4a97566
simple generate
STetsing May 20, 2025
f84c51c
Merge pull request #6028 from ethereum/aimodal-features
STetsing May 20, 2025
a6ebdc9
disabled old remixaitab
STetsing May 20, 2025
4b4e915
resolved comments
STetsing May 20, 2025
6007cba
code review fixes
joeizang May 20, 2025
8a10442
resolved merge conflicts
STetsing May 21, 2025
4e500d7
Merge branch 'generate_agent' of https://github.com/ethereum/remix-pr…
STetsing May 21, 2025
fd57195
Merge branch 'master' into generate_agent
STetsing May 21, 2025
a336201
fix comma. yarn install
joeizang May 21, 2025
e065660
change ai icon. update props
joeizang May 22, 2025
632574d
update remix-project-org nlux
joeizang May 22, 2025
c1473db
Merge branch 'master' into generate_agent
joeizang May 24, 2025
4b22499
add check to make sure remixai assist is active.
joeizang May 24, 2025
c59b8c2
Merge branch 'fix-driver-metamask' of https://github.com/ethereum/rem…
STetsing May 28, 2025
8977dd2
initial working test
STetsing May 30, 2025
c728966
added all provider tests
STetsing Jun 3, 2025
8ed3412
added all provider tests generate workspace
STetsing Jun 3, 2025
e54518c
Merge branch 'master' into generate_agent
STetsing Jun 3, 2025
148204e
linting
STetsing Jun 3, 2025
8292826
Merge pull request #6078 from ethereum/remixAI_tests
STetsing Jun 3, 2025
5e46649
minor
STetsing Jun 3, 2025
01e3ccb
added timeout on setassistant
STetsing Jun 3, 2025
2f7dc3e
typo correct
STetsing Jun 3, 2025
f31bd16
adding ai pauses
STetsing Jun 3, 2025
98c32eb
refreshing for firefox
STetsing Jun 3, 2025
7d9778a
Update assistantSetProvider.ts
yann300 Jun 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions apps/remix-ide/src/app/plugins/remixAIPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React, { useCallback } from 'react';
import { ICompletions, IModel, RemoteInferencer, IRemoteModel, IParams, GenerationParams, CodeExplainAgent, SecurityAgent } from '@remix/remix-ai-core';
import { CustomRemixApi } from '@remix-api'
import { PluginViewWrapper } from '@remix-ui/helper'
import { CodeCompletionAgent } from '@remix/remix-ai-core';
import { CodeCompletionAgent, ContractAgent } from '@remix/remix-ai-core';
const _paq = (window._paq = window._paq || [])

type chatRequestBufferT<T> = {
Expand All @@ -18,7 +18,7 @@ const profile = {
displayName: 'RemixAI',
methods: ['code_generation', 'code_completion',
"solidity_answer", "code_explaining",
"code_insertion", "error_explaining", "vulnerability_check",
"code_insertion", "error_explaining", "vulnerability_check", 'generate',
"initialize", 'chatPipe', 'ProcessChatRequestBuffer', 'isChatRequestPending'],
events: [],
icon: 'assets/img/remix-logo-blue.png',
Expand All @@ -40,14 +40,14 @@ export class RemixAIPlugin extends ViewPlugin {
chatRequestBuffer: chatRequestBufferT<any> = null
codeExpAgent: CodeExplainAgent
securityAgent: SecurityAgent
contractor: ContractAgent
useRemoteInferencer:boolean = false
dispatch: any
completionAgent: CodeCompletionAgent

constructor(inDesktop:boolean) {
super(profile)
this.isOnDesktop = inDesktop
this.codeExpAgent = new CodeExplainAgent(this)
// user machine dont use ressource for remote inferencing
}

Expand All @@ -66,6 +66,8 @@ export class RemixAIPlugin extends ViewPlugin {
}
this.completionAgent = new CodeCompletionAgent(this)
this.securityAgent = new SecurityAgent(this)
this.codeExpAgent = new CodeExplainAgent(this)
this.contractor = new ContractAgent(this)
}

async initialize(model1?:IModel, model2?:IModel, remoteModel?:IRemoteModel, useRemote?:boolean){
Expand Down Expand Up @@ -174,6 +176,34 @@ export class RemixAIPlugin extends ViewPlugin {
return this.securityAgent.getReport(file)
}

async generate(userPrompt: string, params: IParams=GenerationParams, newThreadID:string=""): Promise<any> {
params.stream_result = false // enforce no stream result
params.threadId = newThreadID
console.log('Generating code for prompt:', userPrompt)

let result = {
"projectName": "SimpleStorage",
"files": [
{
"fileName": "contracts/SimpleStorage.sol",
"content": "pragma solidity ^0.8.0; contract SimpleStorage { uint256 private storedData; function set(uint256 x) public { storedData = x; } function get() public view returns (uint256) { return storedData; } }"
},
{
"fileName": "tests/SimpleStorageTest.sol",
"content": "pragma solidity ^0.8.0; import \"truffle/Assert.sol\"; import \"truffle/DeployedAddresses.sol\"; import \"./SimpleStorage.sol\"; contract SimpleStorageTest { function testInitialValue() public { SimpleStorage simpleStorage = SimpleStorage(DeployedAddresses.SimpleStorage()); uint256 expected = 0; Assert.equal(simpleStorage.get(), expected, \"Initially, the stored data should be zero.\"); } function testSetValue() public { SimpleStorage simpleStorage = new SimpleStorage(); simpleStorage.set(42); Assert.equal(simpleStorage.get(), 42, \"Stored data should be 42.\"); } }"
}
],
"threadID": "thread_5T3AwgoicnkkabuIy2fuGS6t"
}
// if (this.isOnDesktop && !this.useRemoteInferencer) {
// result = await this.call(this.remixDesktopPluginName, 'generate', userPrompt, params)
// } else {
// result = await this.remoteInferencer.generate(userPrompt, params)
// }

return this.contractor.writeContracts(result, userPrompt)
}

async code_insertion(msg_pfx: string, msg_sfx: string): Promise<any> {
if (this.completionAgent.indexer == null || this.completionAgent.indexer == undefined) await this.completionAgent.indexWorkspace()

Expand Down
14 changes: 13 additions & 1 deletion apps/remix-ide/src/assets/list.json
Original file line number Diff line number Diff line change
Expand Up @@ -1044,9 +1044,21 @@
"urls": [
"dweb:/ipfs/QmVtdNYdUC4aX6Uk5LrxDT55B7NgGLnLcA2wTecF5xUbSS"
]
},
{
"path": "soljson-v0.8.29+commit.ab55807c.js",
"version": "0.8.29",
"build": "commit.ab55807c",
"longVersion": "0.8.29+commit.ab55807c",
"keccak256": "0x9545790fce7fb78eba3b4af7f72d179cafd4b05ea9de6a3276e871f040736417",
"sha256": "0x87616a5fc7ab3551f4133bbd2c3e1be123eae219facc2a56f8f3a4366520c67b",
"urls": [
"dweb:/ipfs/QmRoJqB44QhLFfuLEK8axiuLw7V23tSJQkitz6qMPX9wT4"
]
}
],
"releases": {
"0.8.29": "soljson-v0.8.29+commit.ab55807c.js",
"0.8.28": "soljson-v0.8.28+commit.7893614a.js",
"0.8.27": "soljson-v0.8.27+commit.40a35a09.js",
"0.8.26": "soljson-v0.8.26+commit.8a97fa7a.js",
Expand Down Expand Up @@ -1143,5 +1155,5 @@
"0.4.0": "soljson-v0.4.0+commit.acd334c9.js",
"0.3.6": "soljson-v0.3.6+commit.3fc68da5.js"
},
"latestRelease": "0.8.28"
"latestRelease": "0.8.29"
}
6 changes: 6 additions & 0 deletions apps/remixdesktop/src/lib/InferenceServerManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,4 +526,10 @@ export class InferenceManager implements ICompletions {
}
}

async generate(userPrompt, options:IParams=GenerationParams): Promise<any> {
const payload = { prompt: userPrompt, "endpoint":"generate", ...options }
if (options.stream_result) return this._streamInferenceRequest(payload, AIRequestType.GENERAL)
else return this._makeRequest(payload, AIRequestType.GENERAL)
}

}
6 changes: 5 additions & 1 deletion apps/remixdesktop/src/plugins/remixAIDektop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const clientProfile: Profile = {
description: 'RemixAI provides AI services to Remix IDE Desktop.',
kind: '',
documentation: 'https://remix-ide.readthedocs.io/en/latest/ai.html',
methods: ['initializeModelBackend', 'code_completion', 'code_insertion', 'code_generation', 'code_explaining', 'error_explaining', 'solidity_answer']
methods: ['initializeModelBackend', 'code_completion', 'code_insertion', 'code_generation', 'code_explaining', 'error_explaining', 'solidity_answer', 'generate']
}

class RemixAIDesktopPluginClient extends ElectronBasePluginClient {
Expand Down Expand Up @@ -107,6 +107,10 @@ class RemixAIDesktopPluginClient extends ElectronBasePluginClient {
return this.desktopInferencer.solidity_answer(prompt)
}

async generate(userPrompt): Promise<any> {
return this.desktopInferencer.generate(userPrompt)
}

changemodel(newModel: any){
/// dereference the current static inference object
/// set new one
Expand Down
116 changes: 116 additions & 0 deletions libs/remix-ai-core/src/agents/contractAgent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import { parse } from "path";

const compilationParams = {
optimize: false,
evmVersion: null,
language: 'Solidity',
version: '0.8.28+commit.7893614a'
}

interface CompilationResult {
compilationSucceeded: boolean
errors: string
}

export class ContractAgent {
plugin: any;
readonly generationAttempts: number = 3
nAttempts: number = 0
generationThreadID: string= ''
workspaceName: string = ''

constructor(props) {
this.plugin = props;
}

async writeContracts(payload, userPrompt) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a documentation for this function?

try {
console.log('Writing contracts', payload)
const parsedFiles = payload
this.generationThreadID = parsedFiles['threadID']
this.workspaceName = parsedFiles['projectName']

this.nAttempts += 1
if (this.nAttempts > this.generationAttempts) {
console.error('Failed to generate the code')
return "Failed to generate secure code on this prompt ````" + userPrompt + "````"
}

const contracts = {}
for (const file of parsedFiles.files) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't handle yet solidity import?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I handle imports by adding all files for compilation see line 33, which make sense, the generation must be complete ( from a compilation point of view)

if (file.fileName.endsWith('.sol')) {
const result:CompilationResult = await this.compilecontracts(file.fileName, file.content)
console.log('compilation result', result)
if (!result.compilationSucceeded) {
// nasty recursion
console.log('compilation failed')
// const newPrompt = `I couldn't compile the contract ${file.fileName}. ${result.errors}. Please try again.`
// await this.plugin.call('remixAI', 'generate', newPrompt, this.generationThreadID); // reuse the same thread
}
}
}

console.log('All source files are compiling')
return "New workspace created: " + this.workspaceName + "\nUse the Hamburger menu to select it!"
} catch (error) {
console.log('Error writing contracts', error)
this.deleteWorkspace(this.workspaceName )
return "Failed to generate secure code on this prompt ```" + userPrompt + "```"
}

}

createWorkspace(workspaceName) {
// first get the workspace names
const ws = this.plugin.call('filePanel', 'getWorkspaces')

if (ws.includes(workspaceName)) {
const newWorkspaceName = workspaceName + '_1'
ws.includes(newWorkspaceName) ?
this.plugin.call('filePanel', 'createWorkspace', newWorkspaceName+'_1', true)
: this.plugin.call('filePanel', 'createWorkspace', workspaceName, true)
}
this.plugin.call('filePanel', 'createWorkspace', workspaceName, true)
}

deleteWorkspace(workspaceName) {
this.plugin.call('filePanel', 'deleteWorkspace', workspaceName)
}

async compilecontracts(fileName, fileContent): Promise<CompilationResult> {

const contract = {}
contract[fileName] = { content : fileContent }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have to put all the files in there:

contract[fileName1] = { content : fileContent1 }
contract[fileName2] = { content : fileContent2 }

etc...

so you should not loop over the files and compile them one by one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already tried this, the issue might me the import name not including the folder

console.log('compiling contract', contract)
const result = await this.plugin.call('solidity' as any, 'compileWithParameters', contract, compilationParams)
console.log('compilation result', result)
const data = result.data
const error = data.errors.find((error) => error.type !== 'Warning')
if (data.errors && data.errors.length && error) {
const msg = `
- Compilation errors: ${data.errors.map((e) => e.formattedMessage)}.
`
return { compilationSucceeded: false, errors: msg }

}

return { compilationSucceeded: true, errors: null }
}

extractImportPaths(text) {

// Define the regex pattern to match import paths
const regex = /import\s*\"([^\"]+)\"\s*;/g;
const paths = [];
let match;

// Use the regex to find all matches in the text
while ((match = regex.exec(text)) !== null) {
// Push the captured path to the paths array
paths.push(match[1]);
}

return paths;
}

}
5 changes: 5 additions & 0 deletions libs/remix-ai-core/src/helpers/streamHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,8 @@ export const HandleStreamResponse = async (streamResponse,
export const UpdateChatHistory = (userPrompt: string, AIAnswer: string) => {
ChatHistory.pushHistory(userPrompt, AIAnswer)
}

export const parseUserInput = (input: string) => {
if (input.trimStart().startsWith('/generate')) return [true, input.replace('/generate', '').trimStart()]
else return [false, input]
}
1 change: 1 addition & 0 deletions libs/remix-ai-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ export * from './helpers/streamHandler'
export * from './agents/codeExplainAgent'
export * from './agents/completionAgent'
export * from './agents/securityAgent'
export * from './agents/contractAgent'
8 changes: 7 additions & 1 deletion libs/remix-ai-core/src/inferencers/remote/remoteInference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class RemoteInferencer implements ICompletions {
max_history = 7
model_op = RemoteBackendOPModel.CODELLAMA // default model operation change this to llama if necessary
event: EventEmitter
test_env=false
test_env=true
test_url="http://solcodertest.org"

constructor(apiUrl?:string, completionUrl?:string) {
Expand Down Expand Up @@ -152,4 +152,10 @@ export class RemoteInferencer implements ICompletions {
if (options.stream_result) return this._streamInferenceRequest(payload, AIRequestType.GENERAL)
else return this._makeRequest(payload, AIRequestType.GENERAL)
}

async generate(userPrompt, options:IParams=GenerationParams): Promise<any> {
const payload = { prompt: userPrompt, "endpoint":"generate", ...options }
if (options.stream_result) return this._streamInferenceRequest(payload, AIRequestType.GENERAL)
else return this._makeRequest(payload, AIRequestType.GENERAL)
}
}
1 change: 1 addition & 0 deletions libs/remix-ai-core/src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export interface IParams {
temp?: number;
return_stream_response?: boolean;
terminal_output?: boolean;
threadId?: string;
}

export enum AIRequestType {
Expand Down
10 changes: 0 additions & 10 deletions libs/remix-ui/editor/src/lib/remix-ui-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { solidityTokensProvider, solidityLanguageConfig } from './syntaxes/solid
import { cairoTokensProvider, cairoLanguageConfig } from './syntaxes/cairo'
import { zokratesTokensProvider, zokratesLanguageConfig } from './syntaxes/zokrates'
import { moveTokenProvider, moveLanguageConfig } from './syntaxes/move'
import { vyperTokenProvider, vyperLanguageConfig } from './syntaxes/vyper'
import { tomlLanguageConfig, tomlTokenProvider } from './syntaxes/toml'
import { monacoTypes } from '@remix-ui/editor'
import { loadTypes } from './web-types'
Expand Down Expand Up @@ -370,8 +369,6 @@ export const EditorUI = (props: EditorUIProps) => {
monacoRef.current.editor.setModelLanguage(file.model, 'remix-toml')
} else if (file.language === 'noir') {
monacoRef.current.editor.setModelLanguage(file.model, 'remix-noir')
} else if (file.language === 'python') {
monacoRef.current.editor.setModelLanguage(file.model, 'remix-vyper')
}
}, [props.currentFile, props.isDiff])

Expand Down Expand Up @@ -994,7 +991,6 @@ export const EditorUI = (props: EditorUIProps) => {
monacoRef.current.languages.register({ id: 'remix-zokrates' })
monacoRef.current.languages.register({ id: 'remix-move' })
monacoRef.current.languages.register({ id: 'remix-circom' })
monacoRef.current.languages.register({ id: 'remix-vyper' })
monacoRef.current.languages.register({ id: 'remix-toml' })
monacoRef.current.languages.register({ id: 'remix-noir' })

Expand All @@ -1019,7 +1015,6 @@ export const EditorUI = (props: EditorUIProps) => {

monacoRef.current.languages.setMonarchTokensProvider('remix-circom', circomTokensProvider as any)
monacoRef.current.languages.setLanguageConfiguration('remix-circom', circomLanguageConfig(monacoRef.current) as any)
monacoRef.current.languages.registerInlineCompletionsProvider('remix-circom', inlineCompletionProvider)

monacoRef.current.languages.setMonarchTokensProvider('remix-toml', tomlTokenProvider as any)
monacoRef.current.languages.setLanguageConfiguration('remix-toml', tomlLanguageConfig as any)
Expand All @@ -1035,11 +1030,6 @@ export const EditorUI = (props: EditorUIProps) => {
monacoRef.current.languages.registerInlineCompletionsProvider('remix-solidity', inlineCompletionProvider)
monaco.languages.registerCodeActionProvider('remix-solidity', new RemixCodeActionProvider(props, monaco))

monacoRef.current.languages.setMonarchTokensProvider('remix-vyper', vyperTokenProvider as any)
monacoRef.current.languages.setLanguageConfiguration('remix-vyper', vyperLanguageConfig as any)
monacoRef.current.languages.registerCompletionItemProvider('remix-vyper', new RemixCompletionProvider(props, monaco))
monacoRef.current.languages.registerInlineCompletionsProvider('remix-vyper', inlineCompletionProvider)

loadTypes(monacoRef.current)
}

Expand Down
10 changes: 9 additions & 1 deletion libs/remix-ui/remix-ai/src/lib/components/Default.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react'
import '../remix-ai.css'
import { DefaultModels, GenerationParams, ChatHistory, HandleStreamResponse } from '@remix/remix-ai-core';
import { DefaultModels, GenerationParams, ChatHistory, HandleStreamResponse, parseUserInput } from '@remix/remix-ai-core';
import { ConversationStarter, StreamSend, StreamingAdapterObserver, useAiChatApi } from '@nlux/react';
import { AiChat, useAsStreamAdapter, ChatItem } from '@nlux/react';
import { user, assistantAvatar } from './personas';
Expand Down Expand Up @@ -43,9 +43,17 @@ export const Default = (props) => {
setIS_streaming(true)
GenerationParams.return_stream_response = GenerationParams.stream_result

const userInput = parseUserInput(prompt)
const isGeneratePrompt = userInput[0]
const newprompt = userInput[1]

let response = null
if (await props.plugin.call('remixAI', 'isChatRequestPending')){
response = await props.plugin.call('remixAI', 'ProcessChatRequestBuffer', GenerationParams);
} else if (isGeneratePrompt) {
GenerationParams.return_stream_response = false
GenerationParams.stream_result = false
response = await props.plugin.call('remixAI', 'generate', newprompt, GenerationParams);
} else {
response = await props.plugin.call('remixAI', 'solidity_answer', prompt, GenerationParams);
}
Expand Down
2 changes: 1 addition & 1 deletion libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export const TabsUI = (props: TabsUIProps) => {
data-id="remix_ai_switch"
id='remix_ai_switch'
className="btn ai-switch text-ai pl-2 pr-0 py-0"
disabled={!((tabsState.currentExt === 'sol') || (tabsState.currentExt === 'vy') || (tabsState.currentExt === 'circom') )}
disabled={!(tabsState.currentExt === 'sol')}
onClick={async () => {
await props.plugin.call('settings', 'updateCopilotChoice', !ai_switch)
setAI_switch(!ai_switch)
Expand Down