用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/macro-inc/macro --skill upgrade-model命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | upgrade-model |
| description | Upgrade an AI chat model (fast or good) across backend and frontend. |
| allowed-tools | Bash, Read, Write, Edit, Grep, Glob |
Upgrades the AI model used in the chat app. There are two model slots:
CHAT_MODELS)CHAT_MODELS)The user must specify which slot to upgrade and the new model name (e.g. claude-opus-4-6).
Ask the user (if not already provided):
fast or good?claude-opus-4-6)Derive from the model name:
SERDE_NAME: the kebab-case model ID sent over the wire (e.g. claude-opus-4-6)ENUM_VARIANT: PascalCase variant name (e.g. Claude46Opus)CONST_NAME: SCREAMING_SNAKE constant name (e.g. CLAUDE_46_OPUS)CONST_VALUE: display string used by the frontend/provider (e.g. claude-4.6-opus)PRETTY_NAME: human-readable name (e.g. Claude Opus 4.6)File: crates/agent/src/model/predefined_model.rs
Check if the enum variant already exists. If not, add all of the following:
Enum variant in pub enum Model (under the Anthropic section):
#[serde(rename = "{SERDE_NAME}")]
#[strum(serialize = "{SERDE_NAME}")]
{ENUM_VARIANT},
String constant in pub mod constants::models:
pub const {CONST_NAME}: &str = "{CONST_VALUE}";
Match arm in to_provider_model_string():
Model::{ENUM_VARIANT} => (ANTHROPIC, {CONST_NAME}),
Match arm in from_model_str():
{CONST_NAME} => Model::{ENUM_VARIANT},
File: crates/agent/src/model/predefined_model.rs
Metadata in fn metadata():
Model::{ENUM_VARIANT} => ModelMetadata {
context_window: 200_000,
},
Use the correct context window for the model. Anthropic models are typically 200,000.
Provider in fn provider():
Model::{ENUM_VARIANT} => Provider::Anthropic,
File: services/document_cognition_service/src/core/model.rs
CHAT_MODELS and update FALLBACK_MODEL.CHAT_MODELS.File: services/document_cognition_service/src/api/ws/chat_message/mod.rs
Search for the old model variant being used in the model selection logic (e.g. Model::Claude45Opus). Update it to the new variant.
cargo check -p agent -p document_cognition_service
Fix any compilation errors before proceeding.
Run from apps/web/:
cd apps/web && bun install && bun run gen-api
This builds all Rust OpenAPI and models binaries from local code, generates openapi.json, runs orval for TypeScript types, and generates model.ts from the local models binary. All generated files will reflect your local Rust changes.
bun check to find frontend usagescd apps/web && bun check
This will report TypeScript errors everywhere the old model string is used. Fix each one. Common locations:
apps/web/src/lib/core/component/AI/constant/model.ts — MODEL_PRETTYNAME, MODEL_PROVIDER_ICON, SMART_MODE_MODEL / DEFAULT_MODELapps/web/src/lib/core/component/AI/component/input/useChatInput.tsx — hardcoded model referencesapps/web/src/lib/core/component/AI/signal/pendingSend.test.ts — test dataReplace old model strings and update display names.
cd apps/web && bun format && bun check
The only errors remaining should be pre-existing ones unrelated to models (e.g. three, @aws-crypto/sha256-js type issues). All model-related errors must be resolved.
Finally, run the CI check:
cd apps/web && bun run gen-api -- --check
This must pass.
ExhaustiveMap type in constant/model.ts requires an entry for every model in the Model type, so missing entries will cause type errors.SMART_MODE_MODEL constant is the "good" model, DEFAULT_MODEL is the "fast" model.