Skip to content
Python

feat(memhub): restore the one-click log export entry in settings (#38)

kristinhe11111608a4cfc2ea
diff --git a/memhub/apps/web/src/App.setup.test.tsx b/memhub/apps/web/src/App.setup.test.tsx
index 9c6f1c8..400a8c3 100644
--- a/memhub/apps/web/src/App.setup.test.tsx
+++ b/memhub/apps/web/src/App.setup.test.tsx
@@ -123,7 +123,7 @@ it("enters D47 settings without a tour or mandatory second scope-confirmation fl
expect(screen.queryByRole("button", { name: "管理已有授权" })).toBeNull();
expect(screen.getByRole("button", { name: "模型" })).toBeTruthy();
expect(screen.getByRole("button", { name: "连接其他应用" })).toBeTruthy();
- expect(screen.queryByRole("button", { name: "帮助与诊断" })).toBeNull();
+ expect(screen.getByRole("button", { name: "帮助与诊断" })).toBeTruthy();
noModelWrites();
});
@@ -139,7 +139,7 @@ it("enters the workbench without an automatic tour or removed help section", asy
expect(localStorage.getItem("one-memory.learning.s1-3")).toBeNull();
const nav = screen.getByRole("navigation", { name: "主要导航" });
await userEvent.click(within(nav).getByRole("button", { name: "设置" }));
- expect(screen.queryByRole("button", { name: "帮助与诊断" })).toBeNull();
+ expect(screen.getByRole("button", { name: "帮助与诊断" })).toBeTruthy();
expect(screen.queryByRole("dialog", { name: "功能教学" })).toBeNull();
noModelWrites();
});
diff --git a/memhub/apps/web/src/R6Settings.test.tsx b/memhub/apps/web/src/R6Settings.test.tsx
index 839f81d..896a2db 100644
--- a/memhub/apps/web/src/R6Settings.test.tsx
+++ b/memhub/apps/web/src/R6Settings.test.tsx
@@ -35,13 +35,13 @@ afterEach(() => {
vi.clearAllMocks();
});
-it("hides diagnostics by default and exposes it only when configured", async () => {
+it("shows the help and diagnostics group by default and hides it when opted out", async () => {
const user = userEvent.setup();
const view = render(<R6Settings onDiagnostics={vi.fn()} />);
- expect(screen.queryByRole("button", { name: "帮助与诊断" })).toBeNull();
-
- view.rerender(<R6Settings onDiagnostics={vi.fn()} showDiagnostics={true} />);
await user.click(screen.getByRole("button", { name: "帮助与诊断" }));
expect(screen.getByRole("heading", { name: "帮助与诊断" })).toBeTruthy();
expect(screen.getByRole("heading", { name: "导出日志" })).toBeTruthy();
+
+ view.rerender(<R6Settings onDiagnostics={vi.fn()} showDiagnostics={false} />);
+ expect(screen.queryByRole("button", { name: "帮助与诊断" })).toBeNull();
});
diff --git a/memhub/apps/web/src/R6Settings.tsx b/memhub/apps/web/src/R6Settings.tsx
index 68c5530..2d53eb6 100644
--- a/memhub/apps/web/src/R6Settings.tsx
+++ b/memhub/apps/web/src/R6Settings.tsx
@@ -42,11 +42,11 @@ function safeEndpoint(value: string | null) {
export function R6Settings({
active = true,
onDiagnostics: _onDiagnostics,
- showDiagnostics = import.meta.env.VITE_ENABLE_DIAGNOSTICS === "true",
+ showDiagnostics = import.meta.env.VITE_ENABLE_DIAGNOSTICS !== "false",
}: {
onDiagnostics(): void;
active?: boolean;
- /** Hidden in release builds unless explicitly enabled at build time. */
+ /** Shown by default; a release build may still opt out with VITE_ENABLE_DIAGNOSTICS=false. */
showDiagnostics?: boolean;
}) {
const id = useId();