Skip to content

Commit

Permalink
Remove a common redundant prefix
Browse files Browse the repository at this point in the history
The model oftens starts its responses by 'This pull request' which
is redundant. Let's remove it if that's the case.

I tried to make it respond without it but it was affecting the rest of the results
so I guess this is the 'cheapest' way to remove that prefix.
  • Loading branch information
platisd committed Mar 16, 2023
1 parent fb5702a commit 1136d84
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions autofill_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ def main():
)

generated_pr_description = openai_response.choices[0].message.content
redundant_prefix = "This pull request "
if generated_pr_description.startswith(redundant_prefix):
generated_pr_description = generated_pr_description[len(redundant_prefix) :]
generated_pr_description = (
generated_pr_description[0].upper() + generated_pr_description[1:]
)
print(f"Generated pull request description: '{generated_pr_description}'")
issues_url = "%s/repos/%s/issues/%s" % (
github_api_url,
Expand Down

0 comments on commit 1136d84

Please sign in to comment.