ClaudeMods
☰
ZH-CN
● — 人在线 · 浏览 — 次
赞助提交作品
GitHub 仓库 · 发布者 berd_is_the_word

一个 Claude Code 模组,在你发送提示之前告诉你需要哪个模型

model-hint 是一个开源的 Claude Code 模组,在你输入提示时建议 haiku、sonnet 或 opus,并在输入框上方的带状区域显示一行理由。它使用 mods(函数钩子)API,例如 prompt.edit、ui.render 和 $.model.complete,通过单词规则提供即时反馈,并在短暂停顿后基于 haiku 进行判断。

已翻译

关于这个 mod

这篇文章描述了构建 model-hint 的过程,这是一个开源的 Claude Code 模组,它会读取你的草稿提示,并在你发送之前显示建议的模型(haiku、sonnet 或 opus)以及一行理由。它使用 mods/函数钩子 API:prompt.edit 读取草稿,ui.render 绘制带状区域,$.model.complete 让 haiku 判断草稿。单词规则提供即时答案,而 300 毫秒的停顿会触发 haiku 判断,该判断在测试提示上得分 10/10,耗时约 1.5 秒。它包含 Switch、Hide 和 Off 按钮,记录了 VS Code 聊天面板的行为,并提到了一项安全审计修复,因此看起来像 API 密钥的草稿永远不会被发送。仓库:https://github.com/hashswingingslasher/model-hint

安装

请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。

claude plugin marketplace add hashswingingslasher/model-hint
claude plugin install model-hint@model-hint
原文 / README

TLDR: Dynamic model suggestions as you are typing a task I typed "build a AAA game like GTA 5" and my first version said sonnet. So I rebuilt it to read the prompt properly. What I built model-hint is an open-source Claude Code mod. As you type, a band above the prompt says haiku, sonnet or opus with a one-line reason, before you hit Enter. Buttons: Switch, Hide, Off. How Claude Code was used I'm not a developer. I built all of it in Claude Code sessions, using the mods (function hooks) API: prompt.edit to read the draft, ui.render to draw the band, and $.model.complete to have haiku judge the draft. Claude Code also wrote the 63 tests and drove live terminal sessions to check the band actually draws before calling anything done. What I learned Word rules are fast and miss intent. Nothing in "GTA 5" says huge. Now the rules answer instantly, and after a 300 ms pause haiku reads the draft. It got 10 out of 10 on my test prompts, in about 1.5 s. Speed is the network, not the model. Haiku 4.5 and 5.5 measured the same. The VS Code chat panel sends mods no keystrokes. From extension 2.1.301 it draws the band, so the mod reads the draft on a timer there. Switch, like /model , saves your default model, not just the session's. Found by testing, and now the toast says it. An independent security audit caught that "off" only hid the band while drafts were still being sent. Fixed, and drafts that look like API keys are never sent. https://github.com/hashswingingslasher/model-hint submitted by /u/berd_is_the_word to r/ClaudeCode [link] [comments]

更多类似作品