一个基于 GPT-3 小玩具,根据输入生成标准的 commit 消息

2023-02-13 17:19:28 +08:00
 HsuanLee

周末写了个小玩具,让 AI 帮你生成(翻译 ) 标准的 commit 信息。

Github : https://github.com/hsuanxyz/commit-gpt

在线使用: https://commit.hsuan.xyz

1861 次点击
所在节点    程序员
15 条回复
kerb15
2023-02-13 17:42:55 +08:00
没懂,是翻译?
zsljava
2023-02-13 17:45:21 +08:00
还不错哦,就是速度太慢了

> 增加用户修改数据权限
✔ The GPT provides the following suggestions (click to copy to clipboard)

feat(permission): change user data permission
docs(permission): update docs related to user data permission change
test(permission): add tests for user data permission changes
refactor(permission): refactor permission logic related to user data permission changes
style(permission): update style of permission logic related to user data permission changes
chore(permission): update dependency related to user data permission changes
LittleYangYang
2023-02-13 17:45:32 +08:00
感觉思路不错,star 了

有两个小问题,
一个是光标左移困难,退格键删除汉字的时候需要点击两次
还有一个是不能一次生成多行 commit 信息,比如同时有 add 和 fix 的时候好像没法放在一起生成?
huang82
2023-02-13 17:49:09 +08:00
好东西
HsuanLee
2023-02-13 17:51:03 +08:00
@kerb15 有翻译的作用,主要目的是生成 https://www.conventionalcommits.org/ 规范的格式
EastLord
2023-02-13 18:02:11 +08:00
我以为是根据要提交的代码来生成提交信息
Zizpop
2023-02-13 18:02:14 +08:00
能做成`curl cheat.sh/curl` 这样通过命令行获取的就更棒了,
`curl commit.hsuan.xyz/支持上传用户头像`
Rehtt
2023-02-13 18:06:18 +08:00
请问这个实现的原理是什么,向 gpt 发送了什么内容
Zizpop
2023-02-13 18:23:34 +08:00
curl -X POST https://commit.hsuan.xyz/api/commit -H 'Content-Type: application/json' -d '{ "message": "支持上传用户头像" }' | jq -r '.text' | jq -C

完成命令行了, 就是参数有点多
HsuanLee
2023-02-13 18:32:25 +08:00
@Rehtt prompt 可以在仓库里看 https://github.com/hsuanxyz/commit-gpt/blob/main/pages/api/commit.ts#L18

根据我的尝试,让它完成代码可以得到比较稳定的可序列化数据,比如

```
# Python

"""
生成 10 个随机数,用 List 保存
"""
answer=
```
sparklee
2023-02-13 18:44:29 +08:00
可以收集本地的文件变更生成对应的 commit 信息吗
HsuanLee
2023-02-13 18:53:57 +08:00
@sparklee 批处理的话有更好的 prompt ,这段不适合,不过你可以参考一下这个仓库的。
HsuanLee
2023-02-13 19:45:48 +08:00
@sparklee 抱歉,刚才理解错成了通过本地 log 生成,这重新回答一下。

关于这个问题可以参考这篇贴的讨论 https://news.ycombinator.com/item?id=33947087
zcf0508
2023-02-14 09:29:34 +08:00
Vitta
2023-02-14 09:45:17 +08:00
👍🏻

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/915750

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX