Repository navigation
Conversation
哨兵 id 'custom-all' 以 custom- 开头,被 isCustom 的前缀判定误中成一家不存在的记录: 1. viewData 的聚合分支排在 isCustom 之后永远走不到 → 聚合列表恒为空(左栏计数读目录缓存所以正常,页面却空表) 2. refreshModels 对聚合视图传空 providerId,被弹窗入口 if (!providerId) return 静默吞掉 → 获取模型点了没反应;同时 custom 布尔误真、name 顶成哨兵原文。改为豁免哨兵 + providerId 传 'all'(内置分支请求体不含它,仅标题回落用) 3. openCustomModel 同源误判 → locked=true 且预选哨兵,添加模型下拉锁死、保存必报「提供商已不存在」。改为豁免哨兵:不锁定、不预选 4. matches 无聚合守卫,行上真实 provider 对不上哨兵 → 即使数据回来也会被筛光。补聚合豁免 验证:3066 隔离实例 + 独立数据目录,浏览器实测聚合列表/分组/统计、获取模型弹窗、添加模型选自定义家保存落真实家、聚合视图内开关写路由、三连刷记忆恢复、单家与内置全部回归;tsc + vite 通过,ui/islands/ui.js 已随提交重建
Closed
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.
问题(v3.0.4 ~ v3.0.6 发布版实测)
自定义供应商的「全部」聚合视图入口与计数正常,但:
custom-all)根因
聚合视图的哨兵 id 是
'custom-all',它以custom-开头,被isCustom()(startsWith('custom-'),与后端is_custom_provider_id同判据)误中成「一家 id 叫 custom-all 的自定义家」——而目录里没有这条记录。四条代码路径因此失效:viewData()isCustom(provider)分支排在ALL_CUSTOM之前,哨兵走单家路径 →record()为 null → 返回空视图(左栏计数读目录缓存不经 viewData,所以入口/计数正常)refreshModels()custom误判为 true、providerId传空串,被models-fetch-modal.tsx入口的if (!options?.providerId) return静默吞掉 → 按钮点了没反应openCustomModel()locked=true且preselect='custom-all'→ 供应商下拉锁死;保存会提交到不存在的记录matches()修复(最小 diff,4 处)
models-panel-state.tsviewData():聚合分支提到isCustom之前(附根因注释)models-panel-state.tsrefreshModels():哨兵豁免custom判定;providerId改传'all'(真值过弹窗守卫;内置分支的刷新请求体只含{accounts, providers},不会把该值发给后端,仅作标题回落而name已显式传入)models-panel-state.tsopenCustomModel():哨兵豁免 → 不锁定、不预选,交给弹窗自选(与内置「全部」同一行为)models-page.tsxmatches():补provider !== 'custom-all'豁免不改动
isCustom()本身(保留纯前缀语义),沿用现有「哨兵在各调用点单独分流」的风格。验证(headless 二进制 + 独立数据目录 + 3066 端口隔离实例,浏览器实测)
custom-all;选中自定义家保存 → 后端该家记录正确新增(toast「已登记模型」),聚合视图实时出现新行custom-all;单家视图 / 内置「全部」回归正常(列显隐、分组带、家名标题)tsc --noEmit+vite build通过,ui/islands/ui.js构建产物随提交更新🤖 本条回复由 AI Agent 生成