Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

feat(web): word the graph-unavailable state in the interface language

Kilynf3fee9001ee6
diff --git a/apps/web/src/features/memory/wiki-graph-page.test.tsx b/apps/web/src/features/memory/wiki-graph-page.test.tsx
index 4902e7bb..399aa15c 100644
--- a/apps/web/src/features/memory/wiki-graph-page.test.tsx
+++ b/apps/web/src/features/memory/wiki-graph-page.test.tsx
@@ -20,6 +20,7 @@ import { defineGlobalProperty } from "@/test/global-properties";
import { createTestTeamHubRuntime } from "@/test/teamhub-test-runtime";
import { LibraryLayout } from "@/features/library/library-layout";
+import { TeamHubError } from "@/features/teamhub/teamhub-error";
import { TeamHubRuntimeProvider } from "@/features/teamhub/teamhub-runtime";
import type {
TeamHubPersonalWiki,
@@ -336,6 +337,28 @@ describe("WikiGraphPage", () => {
expect(await screen.findByTitle("Personal knowledge graph")).toBeVisible();
});
+ it("words the graph-unavailable state itself and keeps other errors as sent", async () => {
+ const runtime = await loggedInRuntime();
+ vi.spyOn(
+ runtime.client,
+ "getPersonalKnowledgeGraphVisualization",
+ ).mockRejectedValue(
+ new TeamHubError({
+ code: "GRAPH_UNAVAILABLE",
+ message: "words from the server",
+ status: 503,
+ }),
+ );
+ renderPage(runtime);
+
+ expect(
+ await screen.findByRole("alert", {
+ name: "Personal Knowledge Graph is unavailable",
+ }),
+ ).toBeVisible();
+ expect(screen.queryByText("words from the server")).toBeNull();
+ });
+
it("shows generation progress instead of a graph failure before the first revision", async () => {
const runtime = await loggedInRuntime();
serveWikiStatus(runtime).mockResolvedValue(
diff --git a/apps/web/src/features/memory/wiki-graph-page.tsx b/apps/web/src/features/memory/wiki-graph-page.tsx
index f115af3c..d45195a2 100644
--- a/apps/web/src/features/memory/wiki-graph-page.tsx
+++ b/apps/web/src/features/memory/wiki-graph-page.tsx
@@ -10,7 +10,9 @@ import { useParams, useSearchParams } from "react-router";
import { Button } from "@/components/ui/button";
import { requireRoomRouteParam } from "@/features/rooms/room-route-params";
+import { TeamHubError } from "@/features/teamhub/teamhub-error";
import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
+import type { Translate } from "@/i18n/language";
import { useT } from "@/i18n/use-translation";
import {
@@ -37,6 +39,15 @@ const ReportCards = lazy(async () => {
return { default: WikiGraphReportCards };
});
+// TeamHub names this state with a code, so it can be worded in the language
+// on screen; any other error keeps the words it arrived with.
+function graphErrorText(error: Error, t: Translate) {
+ if (error instanceof TeamHubError && error.code === "GRAPH_UNAVAILABLE") {
+ return t(m.graphUnavailable);
+ }
+ return error.message || t(m.unavailable);
+}
+
export function WikiGraphPage() {
const t = useT();
const { client } = useTeamHubRuntime();
@@ -112,7 +123,7 @@ export function WikiGraphPage() {
</div>
) : graph.error ? (
<div
- aria-label={graph.error.message || t(m.unavailable)}
+ aria-label={graphErrorText(graph.error, t)}
className="flex h-full min-h-[480px] flex-col items-center justify-center text-center"
role="alert"
>
@@ -122,7 +133,7 @@ export function WikiGraphPage() {
size={24}
/>
<p className="text-sm text-app-danger">
- {graph.error.message || t(m.unavailable)}
+ {graphErrorText(graph.error, t)}
</p>
<Button
className="mt-3"
diff --git a/apps/web/src/features/memory/wiki-timeline.messages.ts b/apps/web/src/features/memory/wiki-timeline.messages.ts
index dc011330..76e05cf0 100644
--- a/apps/web/src/features/memory/wiki-timeline.messages.ts
+++ b/apps/web/src/features/memory/wiki-timeline.messages.ts
@@ -11,6 +11,7 @@ export const wikiTimelineMessages = defineMessages("wikiTimeline", {
},
generating: "Wiki is being generated…",
unavailable: "Timeline is unavailable.",
+ graphUnavailable: "Personal Knowledge Graph is unavailable",
retryGraph: "Retry graph",
hiddenPreferences:
"This graph cannot display your hidden-file preferences. Refresh the graph to load the current view.",
diff --git a/apps/web/src/i18n/locales/zh-CN.json b/apps/web/src/i18n/locales/zh-CN.json
index a4eca426..5693dac3 100644
--- a/apps/web/src/i18n/locales/zh-CN.json
+++ b/apps/web/src/i18n/locales/zh-CN.json
@@ -2470,6 +2470,7 @@
"reportCount": { "other": "{count} 份报告 · 按天浏览" },
"generating": "正在生成 Wiki…",
"unavailable": "时间线不可用。",
+ "graphUnavailable": "个人知识图谱暂不可用",
"retryGraph": "重试加载图谱",
"hiddenPreferences": "这个图谱无法按你隐藏文件的设置显示。请刷新图谱以加载当前视图。",
"graphFrame": "个人知识图谱",