写了一个 VS Code 插件:极简 AI 自动生成 Commit Message,支持自定义 OpenAI 兼容接口

1 月 12 日
 handsomebro

大家好,

主要想分享一个刚刚肝出来的 VS Code 插件:WTF Commit

起因: 最近想找个 VS Code 插件来自动生成 Git Commit Message 。试了好几个热门插件,发现大多数都有几个问题:

  1. 太重了:很多都要在侧边栏占个位置,或者强行绑定一堆我不用的功能。
  2. 模型支持有限:我想用 DeepSeek 或者 Moonshot (Kimi) 这种便宜又好用的国产模型,但很多插件只写死了 OpenAI 或 Anthropic ,不支持自定义 Base URL ,或者配置起来非常麻烦。

本来想给某个开源插件提 PR 增加自定义功能,结果发现老代码改起来太痛苦,各种依赖报错。一气之下,决定遵循“奥卡姆剃刀”原则,从零开发一个只做这一件事的极简插件。

核心功能 & 特点:

插件名字由来: 起名废,写代码时就在想 "What The F**k should I name this commit?",于是就叫 WTF Commit 了。希望它能帮你解决写 Commit 时的抓狂。

链接:

代码完全开源,基于 TypeScript 开发,目前非常轻量。如果你也有类似的需求,欢迎试用,也欢迎提 Issue 或 PR !

1707 次点击
所在节点    分享创造
10 条回复
jeffw
1 月 12 日
vscode 不是自带这个功能吗?
ewiglicht
1 月 12 日
@jeffw 这其实是 copilot 的功能。不过确实 copilot 基本是 vscode 的标配了。
aarontian
1 月 12 日
@jeffw 自带的要付费吧
aarontian
1 月 12 日
能配置 commit message 风格提示词吗,我之前在用一个能配的,不过只支持 Anthropic
handsomebro
1 月 12 日
@aarontian 支持自定义 SYSTEM PROMPT ,也就是你说的:commit message 风格提示词
handsomebro
1 月 12 日
@jeffw 之前一直在 GitHub Desktop 上使用,但免费版有次数限制,而且不支持自定义语言(中文)。
jukanntenn
1 月 13 日
我添加了 GLM 的 key ,依然提示错误:OpenAI key not set
jukanntenn
1 月 13 日
好像 custom 有些 bug ,我接入英伟达的接口,模型 minimax2.1 ,返回的结果:

```
<think>The changes are:
1. In `src/pool.rs`:
- Added `use log::error;` import
- Changed two `self.ticks.update(...)` calls from using the try operator (`?`) to using `match` expressions that log an error and return the error if one occurs.

2. In `src/quoter.rs`:
- Added `use log::error;` import
- Changed the `pool.get_output_amount(...)` call from using the try operator (`?`) to using a `match` expression that logs an error and returns the error if one occurs.

The changes are about error handling and logging. They are making the error handling more explicit by logging errors before returning them.

The most significant change is the addition of error logging in both files. This is a fix in the sense that it improves error reporting, but it doesn't fix a bug per se. It's more of a refactor to add logging.

The conventional commit type for such changes would be either `fix` (if we consider it as fixing the lack of logging) or `refactor` (if we consider it as refactoring the error handling). However, since the primary purpose is to add logging for better error reporting, I think `
```
handsomebro
1 月 14 日
@jukanntenn 已经定位问题,正在改进插件选择模型逻辑。默认情况,插件选择的是 OpenAI 模型,如果设置了其他模型的 API KEY ,需要手动在设置页面进行更改。

已经着手改进模型选择的方式,尽量自动切换。

等下可以尝试更新最新版本 0.1.1 来测试。
handsomebro
1 月 14 日
@jukanntenn 有比较大的可能性是因为接口调用兼容性问题。

建议在 GitHub 仓库新开 Issue ,详细描述问题,这样更好定位和解决。

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

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

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

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

© 2021 V2EX