remove prefix and suffix if they are outputted by the model
This commit is contained in:
parent
5da6577d62
commit
0eb6d13e2c
1 changed files with 6 additions and 0 deletions
|
|
@ -187,6 +187,12 @@ class DefaultModelEditCodeStep(Step):
|
|||
eot_token = "<|endoftext|>"
|
||||
completion = completion.removesuffix(eot_token)
|
||||
|
||||
# Remove tags and If it accidentally includes prefix or suffix, remove it
|
||||
completion = completion.replace("<file_prefix>", "").replace("<file_suffix>", "").replace(
|
||||
"<commit_before>", "").replace("<commit_msg>", "").replace("<commit_after>", "")
|
||||
completion = completion.removeprefix(segs[0])
|
||||
completion = completion.removesuffix(segs[1])
|
||||
|
||||
self._prompt_and_completion += prompt + completion
|
||||
|
||||
diff = list(difflib.ndiff(rif.contents.splitlines(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue