用 AI 撰寫有效的 commit 訊息
你現在要提交由 AI 產生的 docstring,以及一些小修正。由於你對模型在產生 docstring 的表現相當滿意,你決定也用它來為以 git diff 顯示的程式碼變更產生有意義的 commit 訊息。到目前為止,你寫了以下提示:
Based on the following code diff, write a commit message:
🟥 -def is_valid_account_number(account: str) -> bool:
🟥 - return account.isdigit()
🟩 +def is_valid_account_number(account: str) -> bool:
🟩 + if not account.isdigit():
🟩 + return False
🟩 + if len(account) != 10:
🟩 + return False
🟩 + return True
這個提示缺了哪一點,才能更有效地引導模型?
本練習屬於課程
