Skip to content

Commit

Permalink
use llm
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 committed Nov 19, 2023
1 parent 913522d commit 4286790
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { EditorUIProps, monacoTypes } from '@remix-ui/editor';
import axios, {AxiosResponse} from 'axios'
const controller = new AbortController();
const { signal } = controller;
const result: string = ''
Expand Down Expand Up @@ -29,12 +30,26 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli
return;
}

const generativeComment = word.match(/\/\/(.*)\n /)
if (generativeComment[1]) {
// use the code generation model
const {data} = await axios.post('https://llm.remix-project.org', {comment: generativeComment[1]})
const item: monacoTypes.languages.InlineCompletion = {
insertText: data
};
return {
items: [item],
enableForwardStability: true
}
}

// abort if there is a signal
if (token.isCancellationRequested) {
console.log('aborted')
return
}

console.log(word)
let result
try {
result = await this.props.plugin.call('copilot-suggestion', 'suggest', word)
Expand Down

0 comments on commit 4286790

Please sign in to comment.