Repository navigation
新增:QuWork 的 provider 图标;docs:前端(UI 岛)构建与产物同步说明 - #506
Open
a137460387 wants to merge 1 commit into
Open
a137460387 wants to merge 1 commit into
a137460387 wants to merge 1 commit into
Conversation
一、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」的理由。 本次未改动任何运行期逻辑:图标是纯静态资源 + 一张映射表,文档是新增文件。
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
现象
插件家(不在
ProviderKind枚举里的 runtime id)在界面上没有图标,五处都退成首字母徽章(quwork显示成一个「Q」):插件页那张卡片有图标,容易让人以为「图标已经加过了」。
根因
这些位置读的是同一张硬编码表(
ui-islands/src/islands/add-provider-pick.tsx):表里没有
quwork,于是走到字母兜底。而插件页那张图标走的是另一条通道 ——pack.json的icons目录,由plugin_host::pack_view内联成 data URI 塞进/api/plugins。两条通道互不相通,所以只补插件图标不会影响这五个面板。改动
desktop-tauri/ui/assets/providers/quwork.png—— 图标取自 QuWork 客户端安装目录的QuWork.exe(解析 PE 资源,取RT_GROUP_ICON里最大的条目,256×256),未重采样、未改色;PROVIDER_ICONS增加quwork一条(内置家与插件家共用这张表,因此这一条同时覆盖上面五处);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' typeui-kit的@base-ui/react类型解析不到,回调参数退化成anyvite 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 --noEmitexit 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.