pull/5370/head
Stéphane Tetsing 9 months ago
parent 0b180cd521
commit 66c298e051
  1. 2
      apps/remix-ide/src/app/plugins/solcoderAI.tsx
  2. 2
      libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts
  3. 72
      libs/remix-ui/editor/src/lib/suggestion-service/suggestion-service.ts
  4. 4
      libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx

@ -35,7 +35,7 @@ export class SolCoder extends Plugin {
body: JSON.stringify({"data":[prompt,false,1000,0.2,0.8,50]}), body: JSON.stringify({"data":[prompt,false,1000,0.2,0.8,50]}),
}) })
).json() ).json()
return result.data[0] return result.data[0]
} catch (e) { } catch (e) {
this.call('terminal', 'log', { type: 'typewritererror', value: `Unable to get a response ${e.message}` }) this.call('terminal', 'log', { type: 'typewritererror', value: `Unable to get a response ${e.message}` })
return return

@ -72,7 +72,7 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli
word.split('\n').at(-1).trimStart().startsWith('/*') || word.split('\n').at(-1).trimStart().startsWith('/*') ||
word.split('\n').at(-1).trimStart().startsWith('*') || word.split('\n').at(-1).trimStart().startsWith('*') ||
word.split('\n').at(-1).trimStart().startsWith('*/') word.split('\n').at(-1).trimStart().startsWith('*/')
){ ){
return; // do not do completion on single and multiline comment return; // do not do completion on single and multiline comment
} }

@ -7,7 +7,7 @@ export class SuggestionService {
constructor() { constructor() {
console.log('SuggestionService instanciate worker') console.log('SuggestionService instanciate worker')
this.worker = new Worker(new URL('./worker.js', import.meta.url), { this.worker = new Worker(new URL('./worker.js', import.meta.url), {
type: 'module' type: 'module'
}); });
this.init() this.init()
this.events = new EventEmitter() this.events = new EventEmitter()
@ -17,46 +17,46 @@ export class SuggestionService {
async init() { async init() {
const onMessageReceived = (e) => { const onMessageReceived = (e) => {
switch (e.data.status) { switch (e.data.status) {
case 'initiate': case 'initiate':
console.log(e.data) console.log(e.data)
this.events.emit(e.data.status, e.data) this.events.emit(e.data.status, e.data)
// Model file start load: add a new progress item to the list. // Model file start load: add a new progress item to the list.
break; break;
case 'progress': case 'progress':
this.events.emit(e.data.status, e.data) this.events.emit(e.data.status, e.data)
console.log(e.data) console.log(e.data)
// Model file progress: update one of the progress items. // Model file progress: update one of the progress items.
break; break;
case 'done': case 'done':
this.events.emit(e.data.status, e.data) this.events.emit(e.data.status, e.data)
console.log(e.data) console.log(e.data)
// Model file loaded: remove the progress item from the list. // Model file loaded: remove the progress item from the list.
break; break;
case 'ready': case 'ready':
this.events.emit(e.data.status, e.data) this.events.emit(e.data.status, e.data)
console.log(e.data) console.log(e.data)
// Pipeline ready: the worker is ready to accept messages. // Pipeline ready: the worker is ready to accept messages.
break; break;
case 'update': case 'update':
this.events.emit(e.data.status, e.data) this.events.emit(e.data.status, e.data)
console.log(e.data) console.log(e.data)
// Generation update: update the output text. // Generation update: update the output text.
break; break;
case 'complete': case 'complete':
console.log(e.data) console.log(e.data)
if (this.responses[e.data.id]) { if (this.responses[e.data.id]) {
this.responses[e.data.id](null, e.data) this.responses[e.data.id](null, e.data)
} else { } else {
console.log('no callback for', e.data) console.log('no callback for', e.data)
} }
// Generation complete: re-enable the "Generate" button // Generation complete: re-enable the "Generate" button
break; break;
} }
}; };

@ -659,8 +659,8 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
/> />
</div> </div>
{aiLoading && <div className="text-center py-5 ml-5"> {aiLoading && <div className="text-center py-5 ml-5">
<i className="fas fa-spinner fa-pulse fa-2x"></i> <i className="fas fa-spinner fa-pulse fa-2x"></i>
<span className="position-absolute">AI Running</span> <span> AI Running ...</span>
</div>} </div>}
</div> </div>

Loading…
Cancel
Save