跳到正文
cccskills
免费在 GitHub 公开

upgrade-model

Upgrade the chat app’s fast or good model slot across Rust backend code and the frontend. Updates model definitions, selection logic, generated types, and display names, then checks compilation and consistency.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Upgrade an AI chat model (fast or good) across backend and frontend.

查看安装方法

适用场景

  • Upgrade the default chat model
  • Replace the smart mode model
  • Align backend definitions with frontend model labels
  • Regenerate types and check model-related errors

包含的文件(1)

  • SKILL.md4.4 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Upgrade Chat Model

Upgrades the AI model used in the chat app. There are two model slots:

  • fast (Enter): default/fallback model (first entry in CHAT_MODELS)
  • good (Cmd+Enter): smart mode model (second entry in CHAT_MODELS)

The user must specify which slot to upgrade and the new model name (e.g. claude-opus-4-6).

Steps

1. Determine the change

Ask the user (if not already provided):

  • Which slot: fast or good?
  • What is the new model name? (e.g. 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)

2. Add model to AI crate (if it doesn't already exist)

File: crates/agent/src/model/predefined_model.rs

Check if the enum variant already exists. If not, add all of the following:

  1. Enum variant in pub enum Model (under the Anthropic section):

    #[serde(rename = "{SERDE_NAME}")]
    #[strum(serialize = "{SERDE_NAME}")]
    {ENUM_VARIANT},
    
  2. String constant in pub mod constants::models:

    pub const {CONST_NAME}: &str = "{CONST_VALUE}";
    
  3. Match arm in to_provider_model_string():

    Model::{ENUM_VARIANT} => (ANTHROPIC, {CONST_NAME}),
    
  4. Match arm in from_model_str():

    {CONST_NAME} => Model::{ENUM_VARIANT},
    

File: crates/agent/src/model/predefined_model.rs

  1. 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.

  2. Provider in fn provider():

    Model::{ENUM_VARIANT} => Provider::Anthropic,
    

3. Update DCS constants

File: services/document_cognition_service/src/core/model.rs

  • If upgrading the fast slot: change the first entry in CHAT_MODELS and update FALLBACK_MODEL.
  • If upgrading the good slot: change the second entry in CHAT_MODELS.

4. Update DCS chat message handler

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.

5. Verify Rust compiles

cargo check -p agent -p document_cognition_service

Fix any compilation errors before proceeding.

6. Generate frontend types

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.

7. Run bun check to find frontend usages

cd 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_MODEL
  • apps/web/src/lib/core/component/AI/component/input/useChatInput.tsx — hardcoded model references
  • apps/web/src/lib/core/component/AI/signal/pendingSend.test.ts — test data

Replace old model strings and update display names.

8. Format and verify

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.

Notes

  • We only support Anthropic models for chat. Other providers exist in the AI crate but are not used for the chat feature.
  • The ExhaustiveMap type in constant/model.ts requires an entry for every model in the Model type, so missing entries will cause type errors.
  • The SMART_MODE_MODEL constant is the "good" model, DEFAULT_MODEL is the "fast" model.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Expose new backend API endpoints through the TypeScript SDK, or record intentional exclusions. Follow existing entity and client conventions, check generated request types, and verify that each endpoint is either used by the SDK or explicitly skipped.

中文简介正在准备中。当前显示英语简介。

  • Adding SDK support for a new Rust service endpoint
  • Investigating endpoints reported as uncovered
  • Recording agreed SDK exclusions
macro-inc/macro47722026年10月20日 更新

add-tour

免费

Add or update guided feature tours in the web app. Covers registering interface targets, writing steps, guiding users toward hidden controls, and checking the tour with saved progress and different sidebar states.

中文简介正在准备中。当前显示英语简介。

  • Add a guided tour to a view
  • Revise tour steps and their target controls
  • Guide users toward controls in a collapsed sidebar
macro-inc/macro47722026年10月20日 更新

audit

免费

Identify the checks required for changed files, run tests, and review applicable project rules. Get a table of passed, failed, and skipped checks with evidence, helping you verify changes before handoff or pushing code.

中文简介正在准备中。当前显示英语简介。

  • Checking changes before reporting work complete
  • Reviewing required checks before pushing code
  • Finding missing tests or documentation updates
macro-inc/macro47722026年10月20日 更新

Review and structure Rust backend changes using hexagonal architecture, which separates business rules from external interfaces. Check dependency direction, place authorization policy in domain services, and keep database operations and external clients behind defined interfaces.

中文简介正在准备中。当前显示英语简介。

  • Reviewing layer boundaries before Rust backend changes
  • Moving permission decisions into domain services
  • Separating database and external client implementations
macro-inc/macro47722026年10月20日 更新

Guide the integration of collaboratively edited Markdown fields into an application feature. It explains service selection, permissions inherited from parent records, content storage in Loro sessions, and how to initialize and retire each editing surface.

中文简介正在准备中。当前显示英语简介。

  • Adding a collaboratively edited description field
  • Implementing shared input through a public API
  • Connecting editing permissions to a parent record
macro-inc/macro47722026年10月20日 更新

Add a new AI tool to an existing Rust application, from implementation and service connections to infrastructure configuration, generated TypeScript types, and a frontend component that displays the tool's results.

中文简介正在准备中。当前显示英语简介。

  • Adding an AI tool to an existing Rust application
  • Connecting a tool to services and environment variables
  • Generating frontend types from tool schemas
macro-inc/macro47722026年10月20日 更新

查看 macro-inc 的全部技能

报告此技能的问题