爱意满满的作品展示区。
handsomebro

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

  •  
  •   handsomebro · Jan 12 · 1500 views
    This topic created in 150 days ago, the information mentioned may be changed or developed.

    大家好,

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

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

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

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

    核心功能 & 特点:

    • 极致简约:没有侧边栏 Webview ,入口直接集成在 Source Control 面板的标题栏(一个小星星图标 ✨)。
    • 模型自由:内置了 DeepSeek / Moonshot (Kimi) / 智谱 GLM 的预设,同时也支持 Custom 模式。只要是兼容 OpenAI 格式的接口(包括本地的 Ollama )都能用。
    • 安全第一:API Key 不会明文存在 settings.json 里,而是走 VS Code 原生的 SecretStorage 安全存储。
    • 懒人模式:支持配置快捷键(默认 Cmd+Opt+G),可选开启 Auto CommitAuto Push。按一下,直接生成 -> 提交 -> 推送一条龙。

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

    链接:

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

    10 replies    2026-01-14 11:14:54 +08:00
    jeffw
        1
    jeffw  
       Jan 12
    vscode 不是自带这个功能吗?
    ewiglicht
        2
    ewiglicht  
       Jan 12
    @jeffw 这其实是 copilot 的功能。不过确实 copilot 基本是 vscode 的标配了。
    aarontian
        3
    aarontian  
       Jan 12
    @jeffw 自带的要付费吧
    aarontian
        4
    aarontian  
       Jan 12
    能配置 commit message 风格提示词吗,我之前在用一个能配的,不过只支持 Anthropic
    handsomebro
        5
    handsomebro  
    OP
       Jan 12
    @aarontian 支持自定义 SYSTEM PROMPT ,也就是你说的:commit message 风格提示词
    handsomebro
        6
    handsomebro  
    OP
       Jan 12
    @jeffw 之前一直在 GitHub Desktop 上使用,但免费版有次数限制,而且不支持自定义语言(中文)。
    jukanntenn
        7
    jukanntenn  
       Jan 13
    我添加了 GLM 的 key ,依然提示错误:OpenAI key not set
    jukanntenn
        8
    jukanntenn  
       Jan 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
        9
    handsomebro  
    OP
       Jan 14
    @jukanntenn 已经定位问题,正在改进插件选择模型逻辑。默认情况,插件选择的是 OpenAI 模型,如果设置了其他模型的 API KEY ,需要手动在设置页面进行更改。

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

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

    建议在 GitHub 仓库新开 Issue ,详细描述问题,这样更好定位和解决。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3055 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 00:27 · PVG 08:27 · LAX 17:27 · JFK 20:27
    ♥ Do have faith in what you're doing.