Skip to content

Commit

Permalink
Improve changelog generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
shyuep committed Jan 24, 2025
1 parent 8599968 commit 296a0ec
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 37 deletions.
61 changes: 27 additions & 34 deletions docs/CHANGES.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ def update_changelog(ctx: Context, version: str | None = None, dry_run: bool = F

client = OpenAI(api_key=os.environ["OPENAPI_KEY"])

messages = [{"role": "user", "content": f"summarize, include authors: '{body}'"}]
messages = [{"role": "user", "content": f"summarize as a markdown numbered list, include authors: '{body}'"}]
chat = client.chat.completions.create(model="gpt-4o", messages=messages)

reply = chat.choices[0].message.content
body = "\n".join(reply.split("\n")[1:])
body = body.strip()
body = "\n".join(reply.split("\n")[1:-1])
body = body.strip().strip("`")
print(f"ChatGPT Summary of Changes:\n{body}")

except BaseException as ex:
Expand Down

0 comments on commit 296a0ec

Please sign in to comment.