continue icon indicating copy to clipboard operation
continue copied to clipboard

Trim off <|file_separator|> from autocomplete completion for Google Models

Open hayden-cardwell opened this issue 4 months ago • 1 comments

Validations

  • [x] I believe this is a way to improve. I'll try to join the Continue Discord for questions
  • [x] I'm not able to find an open issue that requests the same enhancement

Problem

When using Google models for FIM/AutoComplete, they will sometimes return <|file_separator|> at the end of their completion. This results in the end-users inability to use the autocomplete completion without removing <|file_separator|> manually for each suggestion.

Solution

Add the following bit of code to the postprocessCompletion function within core/autocomplete/postprocessing/index.ts

if (
    (llm.model.includes("gemini") || llm.model.includes("gemma")) &&
    completion.endsWith("<|file_separator|>")
  ) {
    // "<|file_separator|>" is 18 characters long
    completion = completion.slice(0, -18);
  }

I would like to submit the PR to have this merged, but I'm attempting to follow the contribution guide by creating an issue first. Please let me know how to proceed.

hayden-cardwell avatar Jun 10 '25 15:06 hayden-cardwell