Skip to content

新增:QuWork 的 provider 图标;docs:前端(UI 岛)构建与产物同步说明 - #506

Open
a137460387 wants to merge 1 commit into
aimod-cc:betafrom
a137460387:fix/quwork-icon-and-ui-build-docs
Open

a137460387 wants to merge 1 commit into
aimod-cc:betafrom
a137460387:fix/quwork-icon-and-ui-build-docs

Conversation

@a137460387

Copy link
Copy Markdown

现象

插件家(不在 ProviderKind 枚举里的 runtime id)在界面上没有图标,五处都退成首字母徽章(quwork 显示成一个「Q」):

  • 账号列表的提供商分组标题
  • 「添加账号」弹窗的提供商卡片
  • 签到中心的提供商分组
  • 模型管理左栏
  • 路由画布的提供商标记

插件页那张卡片有图标,容易让人以为「图标已经加过了」。

根因

这些位置读的是同一张硬编码表(ui-islands/src/islands/add-provider-pick.tsx):

export const PROVIDER_ICONS: Record<string, string> = {
  workbuddy: 'assets/providers/workbuddy.png',
  ...
}

表里没有 quwork,于是走到字母兜底。而插件页那张图标走的是另一条通道 —— pack.json 的 icons 目录,由 plugin_host::pack_view 内联成 data URI 塞进 /api/plugins。两条通道互不相通,所以只补插件图标不会影响这五个面板。

改动

  1. desktop-tauri/ui/assets/providers/quwork.png —— 图标取自 QuWork 客户端安装目录的 QuWork.exe(解析 PE 资源,取 RT_GROUP_ICON 里最大的条目,256×256),未重采样、未改色;
  2. PROVIDER_ICONS 增加 quwork 一条(内置家与插件家共用这张表,因此这一条同时覆盖上面五处);
  3. 按仓库既有工作流重建 UI 岛产物并一并更新(ui.js / ui.css / login.js 都是检入仓库的)。

顺带:前端构建文档

接入过程中踩到一个容易重复踩的坑,一并补文档:

vite.config.ts 把 @ui 别名指向 ../ui-kit/src(源码),而 ui-kit 有独立的 package.json。只装 ui-islands 依赖时会出现两个看不出因果的症状:

症状 真因
tsc --noEmit 报一片 Parameter 'value' implicitly has an 'any' type ui-kit 的 @base-ui/react 类型解析不到,回调参数退化成 any
跳过 tsc 后 vite build 报 Can't resolve 'tw-animate-css' 那是 ui-kit 的 devDependency,由 ui-kit/styles/globals.css 引入

两处都在装完 ui-kit 依赖后同时消失。据此新增:

  • desktop-tauri/ui-islands/README.md:最短可用说明(先装两个包、构建命令、产物去向、pnpm 的两个坑、别手改 minified 产物);
  • docs/ui-build.md:完整版,补上「headless 网关读的是 dist/ui/,要额外同步一次」与「新增静态资源两边都要放」。

影响面

纯静态资源 + 一张映射表 + 新增文档,没有运行期逻辑改动。未装插件或没有 quwork 账号时,这张表多一条不存在的 provider 也只是一个键值对,不影响其他家。

验证

  • tsc --noEmit exit 0;vite build 与 vite build --config vite.login.config.ts 均成功;
  • 产物同步到 dist/ui 后,网关实测 GET /islands/ui.js 与 GET /assets/providers/quwork.png 均 200,且产物内含 quwork:"assets/providers/quwork.png";
  • 五个面板刷新后显示真实图标(此前为字母 Q)。

🤖 本条回复由 AI Agent 生成
Generated by an AI agent.

一、QuWork 图标

`quwork` 是插件家(不在内置枚举里),界面上一直没有图标 —— 账号列表、添加账号、
签到中心、模型管理、路由画布都退成首字母徽章「Q」。根因是这些位置统一读
`ui-islands/src/islands/add-provider-pick.tsx` 里那张 `PROVIDER_ICONS` 硬编码表
(`providerId → assets/providers/<file>.png`),表里没有 `quwork` 就兜底成字母。
插件卡片上的图标走的是另一条通道(`pack.json` 的 `icons` 目录),所以只加了插件
图标并不会让这些面板显示出来。

- `desktop-tauri/ui/assets/providers/quwork.png`:图标取自 QuWork 客户端安装目录
  的 `QuWork.exe`(`RT_GROUP_ICON` 最大条目,256×256),未做重采样;
- `PROVIDER_ICONS` 增加 `quwork` 一条,指向上面那张图;
- 重建 UI 岛产物(`ui.js` / `ui.css` / `login.js` 已检入,按仓库既有工作流一并更新)。

二、前端构建文档

这次接入时踩到一个会重复踩的坑:`vite.config.ts` 把 `@ui` 别名指向 `../ui-kit/src`
(源码),而 `ui-kit` 有独立的 `package.json`。只装 `ui-islands` 的依赖时会出现两个
互相看不出因果的症状:

1. `tsc --noEmit` 报一片 `Parameter 'value' implicitly has an 'any' type` —— 实际是
   `ui-kit` 的 `@base-ui/react` 类型解析不到,回调参数退化成 `any`;
2. 跳过 tsc 后 `vite build` 报 `Can't resolve 'tw-animate-css'` —— 那是 `ui-kit` 的
   devDependency,由 `ui-kit/styles/globals.css` 引入。

两处都在装完 `ui-kit` 依赖后同时消失。据此新增:

- `desktop-tauri/ui-islands/README.md`:最短可用说明(先装两个包、构建命令、产物去向、
  pnpm 的两个坑、别手改 minified 产物);
- `docs/ui-build.md`:完整版,补上 headless 网关读的是 `dist/ui/`(需要额外同步一次)、
  新增静态资源两边都要放、以及「别只改 dist/ui」的理由。

本次未改动任何运行期逻辑:图标是纯静态资源 + 一张映射表,文档是新增文件。
@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 044dcbcf-1c7d-4e32-a33b-20ef4e26570a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant