fix the generated text removing a space from the input & linting

pull/4175/head
yann300 1 year ago
parent da63ad5834
commit 3387591190
  1. 1
      apps/remix-ide/src/app/plugins/copilot/suggestion-service/suggestion-service.ts
  2. 5
      libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts

@ -4,6 +4,7 @@ export type SuggestOptions = { max_new_tokens: number, temperature: number, top_
export class SuggestionService { export class SuggestionService {
worker: Worker worker: Worker
// eslint-disable-next-line @typescript-eslint/ban-types
responses: { [key: number]: Function } responses: { [key: number]: Function }
events: EventEmitter events: EventEmitter
current: number current: number

@ -43,9 +43,8 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli
} }
const generatedText = (result as any).output[0].generated_text as string const generatedText = (result as any).output[0].generated_text as string
// console.log(word, result) // the generated text remove a space from the context. that why we need to remove all the spaces
const clean = generatedText.replace(/ /g, '').replace(word.replace(/ /g, ''), '')
const clean = generatedText.replace(word, '')
console.log('suggest result', clean) console.log('suggest result', clean)
const item: monacoTypes.languages.InlineCompletion = { const item: monacoTypes.languages.InlineCompletion = {
insertText: clean insertText: clean

Loading…
Cancel
Save