Skip to content

Commit

Permalink
fix using regex
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 authored and joeizang committed Nov 23, 2023
1 parent fdaaa25 commit 2026999
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli
console.log('not a trigger char')
return;
}

const generativeComment = word.match(/\/\/(.*)\n /)
if (generativeComment[1]) {
let regex = new RegExp('\/\/(.*)\n ', 'g')

const generativeComment = [...p.matchAll(regex)]
if (generativeComment && generativeComment.length) {
// use the code generation model
const {data} = await axios.post('https://gpt-chat.remixproject.org/infer', {comment: generativeComment[1]})
const {data} = await axios.post('https://gpt-chat.remixproject.org/infer', {comment: generativeComment[generativeComment.length - 1]})
const item: monacoTypes.languages.InlineCompletion = {
insertText: data
};
Expand Down

0 comments on commit 2026999

Please sign in to comment.