mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 01:39:51 +08:00
* 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>
65 lines
1.9 KiB
TypeScript
65 lines
1.9 KiB
TypeScript
"use client";
|
|
|
|
import { useTranslation } from "react-i18next";
|
|
import { AlertTriangle, CheckCircle2, Clock3 } from "lucide-react";
|
|
import {
|
|
kbHasLiveProgress,
|
|
kbNeedsReindex,
|
|
kbEmbeddingUnavailable,
|
|
resolveKbStatus,
|
|
type KnowledgeBase,
|
|
} from "@/lib/knowledge-helpers";
|
|
|
|
interface KbStatusBadgeProps {
|
|
kb: KnowledgeBase;
|
|
isReindexingLocally?: boolean;
|
|
}
|
|
|
|
export default function KbStatusBadge({
|
|
kb,
|
|
isReindexingLocally = false,
|
|
}: KbStatusBadgeProps) {
|
|
const { t } = useTranslation();
|
|
const status = resolveKbStatus(kb);
|
|
const needsReindex = kbNeedsReindex(kb);
|
|
const isLive = kbHasLiveProgress(kb) || isReindexingLocally;
|
|
const isError = status === "error";
|
|
const embeddingUnavailable = kbEmbeddingUnavailable(kb);
|
|
const isReady = status === "ready" && !needsReindex && !embeddingUnavailable;
|
|
|
|
const tone =
|
|
needsReindex || embeddingUnavailable
|
|
? "bg-amber-100 text-amber-700 dark:bg-amber-950/30 dark:text-amber-300"
|
|
: isError
|
|
? "bg-red-100 text-red-700 dark:bg-red-950/30 dark:text-red-300"
|
|
: isLive
|
|
? "bg-sky-100 text-sky-700 dark:bg-sky-950/30 dark:text-sky-300"
|
|
: "bg-emerald-100 text-emerald-700 dark:bg-emerald-950/30 dark:text-emerald-300";
|
|
|
|
const Icon = isLive ? Clock3 : isReady ? CheckCircle2 : AlertTriangle;
|
|
|
|
const label =
|
|
!isLive && embeddingUnavailable
|
|
? kb.metadata?.embedding_status === "missing"
|
|
? t("Embedding model deleted")
|
|
: t("Check embedding model")
|
|
: needsReindex
|
|
? t("Needs reindex")
|
|
: isError
|
|
? t("Error")
|
|
: isLive
|
|
? t("Processing live")
|
|
: isReady
|
|
? t("Ready")
|
|
: status.replaceAll("_", " ");
|
|
|
|
return (
|
|
<span
|
|
className={`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[12px] font-medium ${tone}`}
|
|
>
|
|
<Icon className="h-3 w-3" />
|
|
{label}
|
|
</span>
|
|
);
|
|
}
|