M25: expose provenance-aware knowledge statistics
This commit is contained in:
@@ -215,7 +215,18 @@ export function Automation() {
|
||||
? t("cards.checking")
|
||||
: knowledge
|
||||
? knowledge.document_count === null
|
||||
? t("cards.knowledgeSummaryIndexUnknown", { collection: knowledge.collection })
|
||||
? knowledge.statistics_state === "sync_reported"
|
||||
? t("cards.knowledgeSummarySyncReported", {
|
||||
collection: knowledge.collection,
|
||||
sourceCount: knowledge.source_document_count,
|
||||
synced: knowledge.reported_synced_document_count,
|
||||
failed: knowledge.reported_failed_document_count,
|
||||
when: knowledge.last_sync_at ? formatDateTime(knowledge.last_sync_at) : "—",
|
||||
})
|
||||
: t("cards.knowledgeSummaryIndexUnknown", {
|
||||
collection: knowledge.collection,
|
||||
sourceCount: knowledge.source_document_count,
|
||||
})
|
||||
: t(knowledge.provider === "ragcore" ? "cards.knowledgeSummaryRagcore" : "cards.knowledgeSummaryDemo", {
|
||||
count: knowledge.document_count,
|
||||
collection: knowledge.collection,
|
||||
|
||||
@@ -245,7 +245,7 @@ export function Dashboard() {
|
||||
<IntegrationMark kind="rag" />
|
||||
<div>
|
||||
<strong>{t("integrationPulse.knowledgeTitle")}</strong>
|
||||
<span>{knowledge ? (knowledge.document_count === null ? t("integrationPulse.knowledgeIndexUnknown") : t("integrationPulse.knowledgeSummary", { count: knowledge.document_count })) : t("integrationPulse.knowledgeUnavailable")}</span>
|
||||
<span>{knowledge ? (knowledge.document_count === null ? t("integrationPulse.knowledgeIndexUnknown", { count: knowledge.source_document_count }) : t("integrationPulse.knowledgeSummary", { count: knowledge.document_count })) : t("integrationPulse.knowledgeUnavailable")}</span>
|
||||
</div>
|
||||
<StatusBadge
|
||||
status={knowledge?.available ? "available" : "unavailable"}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { describeApiError, type ApiErrorInfo } from "../api/errorMessages";
|
||||
import type { GroundedAnswer, KnowledgeHealth } from "../api/types";
|
||||
import { Icon } from "../components/Icons";
|
||||
import { ApiErrorNotice, PageHeader } from "../components/PageChrome";
|
||||
import { useLocaleFormat } from "../i18n/format";
|
||||
import { PRODUCT_NAME } from "../product";
|
||||
|
||||
interface Exchange {
|
||||
@@ -21,6 +22,7 @@ function isOpaqueVersion(value: string): boolean {
|
||||
|
||||
export function Knowledge() {
|
||||
const { t, i18n } = useTranslation(["knowledge", "errors"]);
|
||||
const { formatDateTime } = useLocaleFormat();
|
||||
const [status, setStatus] = useState<KnowledgeHealth | null>(null);
|
||||
const [statusSettled, setStatusSettled] = useState(false);
|
||||
const [question, setQuestion] = useState("");
|
||||
@@ -138,6 +140,24 @@ export function Knowledge() {
|
||||
{statusSettled && status?.provider === "demo" && (
|
||||
<p className="knowledge-provider-note"><Icon name="shield" /> {t("providerNote")}</p>
|
||||
)}
|
||||
{statusSettled && status?.provider === "ragcore" && (
|
||||
<div className="knowledge-index-evidence" role="status">
|
||||
<div><strong>{status.source_document_count}</strong><span>{t("statistics.sourceDocuments")}</span></div>
|
||||
<div>
|
||||
<strong>{status.reported_synced_document_count ?? "—"}</strong>
|
||||
<span>{t("statistics.reportedSynced")}</span>
|
||||
</div>
|
||||
<div>
|
||||
<strong>{status.reported_failed_document_count ?? "—"}</strong>
|
||||
<span>{t("statistics.reportedFailed")}</span>
|
||||
</div>
|
||||
<p>
|
||||
{status.last_sync_at
|
||||
? t("statistics.lastSync", { when: formatDateTime(status.last_sync_at) })
|
||||
: t("statistics.noSyncReport")}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<form className="panel knowledge-form" onSubmit={handleSubmit} aria-labelledby="ask-heading">
|
||||
<div className="ask-heading">
|
||||
|
||||
Reference in New Issue
Block a user