Files
DeepTutor/web/components/knowledge/KnowledgeEngineIcon.tsx
Antonio-Faure 75636f0735 perf(web): improve knowledge-base and settings accessibility and payload (#3139)
* fix(web): refine knowledge and settings accessibility and layout

Name row controls from their visible titles, portal tooltip descriptions out of tablists, and make the knowledge tabs keyboard-complete. Also stack the KB master-detail on phones, add a section-scroll hint, demote the indexing diagnostic to its detail tab, and consolidate the knowledge type scale.

* perf(web): cut knowledge and settings payload

Serve raster engine marks through next/image, stop preloading the serif face on pages that do not use it, and prefetch settings routes only on hover or keyboard focus instead of on first paint.

* docs(perf): record knowledge and settings audit

Document the protocol, baseline and after medians, payload and accessibility results, limits, and reproduction commands, with mobile before/after screenshots.

* test(web): match the model row's visible accessible name

The row no longer overrides its name with a provider-first aria-label; select it by the model-first text a screen reader now reads, which also contains the visible default/task badge.

* fix(web): keep the MinerU download-type name in the locale catalog

Reuse the existing Download models and Type strings instead of introducing a new t() literal, so the strict i18n audit stays green.

* docs(perf): link the UI audit from the handbook index

The docs contract requires every guide under docs-for-dev to be reachable from README.md.

* docs(perf): record the isolated knowledge-detail LCP

Re-measured the detail route with the host pinned away from unrelated work; the 668 ms row was contention, while the isolated median is 568 ms and the stable repeats overlap the baseline.

---------

Co-authored-by: Antonio-Faure <209759495+Antonio-Faure@users.noreply.github.com>
2026-12-01 17:12:12 +08:00

69 lines
2.0 KiB
TypeScript

import Image from "next/image";
import { Database } from "lucide-react";
/**
* Brand marks for knowledge engines and live knowledge sources.
*
* Assets are vendored under /public so the Knowledge Center keeps working in
* offline/self-hosted deployments. LightRAG deliberately uses the HKUDS
* organization avatar for both its embedded and server variants.
*/
const KNOWLEDGE_ICONS: Record<string, string> = {
llamaindex: "/knowledge-engine-icons/llamaindex.png",
pageindex: "/knowledge-engine-icons/pageindex.png",
"pageindex-oss": "/knowledge-engine-icons/pageindex.png",
graphrag: "/knowledge-engine-icons/graphrag.png",
lightrag: "/knowledge-engine-icons/lightrag.jpg",
"lightrag-server": "/knowledge-engine-icons/lightrag.jpg",
ima: "/knowledge-engine-icons/tencent-ima.svg",
obsidian: "/knowledge-engine-icons/obsidian.svg",
marginnote4: "/knowledge-engine-icons/marginnote.png",
};
export function knowledgeSourceIconId(input: {
provider?: string | null;
type?: string | null;
}): string {
if (input.type === "obsidian") return "obsidian";
if (input.type === "marginnote4") return "marginnote4";
return input.provider || "llamaindex";
}
export default function KnowledgeEngineIcon({
engine,
size = 20,
className = "",
}: {
engine?: string | null;
size?: number;
className?: string;
}) {
const source = engine ? KNOWLEDGE_ICONS[engine] : undefined;
if (!source) {
return (
<Database
size={size}
strokeWidth={1.7}
className={`shrink-0 ${className}`.trim()}
/>
);
}
return (
<Image
src={source}
alt=""
aria-hidden
width={size}
height={size}
sizes={`${size}px`}
quality={75}
// The optimizer rejects SVG without `dangerouslyAllowSVG`; those two
// marks are already small vectors, so serve them untouched.
unoptimized={source.endsWith(".svg")}
draggable={false}
className={`shrink-0 select-none object-contain ${className}`.trim()}
/>
);
}