fix(*): 模型选择 - 修复系统渠道 Logo 搜索与前台模型模式误判
This commit is contained in:
@@ -10,7 +10,7 @@ type LobeIconComponent = ComponentType<SVGProps<SVGSVGElement> & { size?: number
|
||||
|
||||
// 只允许按需加载 Mono 组件。这里不能使用 eager glob:模型 Logo 目录有数百个 provider 模块,
|
||||
// eager 会让每次进入工作区都发起数百个开发模块请求,即使用户从未打开 Logo 选择器。
|
||||
const iconModules = import.meta.glob?.("../../node_modules/@lobehub/icons/es/*/components/Mono.js", { import: "default" }) || {};
|
||||
const iconModules = import.meta.glob("../../node_modules/@lobehub/icons/es/*/components/Mono.js", { import: "default" });
|
||||
const iconLoaders = Object.fromEntries(
|
||||
Object.entries(iconModules)
|
||||
.map(([path, loader]) => [path.match(/\/([^/]+)\/components\/Mono\.js$/)?.[1], loader])
|
||||
@@ -19,7 +19,7 @@ const iconLoaders = Object.fromEntries(
|
||||
const iconRegistry = new Map<string, LobeIconComponent>();
|
||||
const iconLoadPromises = new Map<string, Promise<LobeIconComponent | undefined>>();
|
||||
const iconOptions = toc
|
||||
.filter((item) => item.group === "model" || item.group === "provider")
|
||||
.filter((item) => item.group === "model" || item.group === "provider" || item.group === "application")
|
||||
.map((item) => ({ id: item.id, title: item.fullTitle || item.title }))
|
||||
.filter((item) => Boolean(iconLoaders[item.id]));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user