Skip to content

Your lightweight open-source personal agent.

fix(webui): show all channels when only WebUI is enabled

chengyongru78cdf53ac3a7
diff --git a/webui/src/components/settings/system/ChannelsSettings.tsx b/webui/src/components/settings/system/ChannelsSettings.tsx
index e809ec75a..ff8e599f1 100644
--- a/webui/src/components/settings/system/ChannelsSettings.tsx
+++ b/webui/src/components/settings/system/ChannelsSettings.tsx
@@ -49,13 +49,14 @@ export function ChannelsSettings({
.filter((feature) => feature.type === "channel" && feature.settings_visible !== false)
.sort((left, right) => Number(!left.ready) - Number(!right.ready)
|| localizedChannelDisplayName(left, t).localeCompare(localizedChannelDisplayName(right, t)));
- const hasEnabledChannels = channels.some((feature) => feature.enabled);
+ const hasEnabledConfigurableChannels = channels.some((feature) =>
+ feature.enabled && !feature.capabilities?.includes("always_enabled"));
const restartRequired = requiresRestartPending || Boolean(nanobotFeatures?.requires_restart);
useLayoutEffect(() => {
if (!nanobotFeatures || filterInitializedRef.current) return;
filterInitializedRef.current = true;
- setFilter(hasEnabledChannels ? "enabled" : "all");
- }, [hasEnabledChannels, nanobotFeatures]);
+ setFilter(hasEnabledConfigurableChannels ? "enabled" : "all");
+ }, [hasEnabledConfigurableChannels, nanobotFeatures]);
const visibleChannels = channels.filter((feature) =>
(filter === "all" || feature.enabled)
&& `${feature.name} ${localizedChannelDisplayName(feature, t)}`.toLocaleLowerCase()
diff --git a/webui/src/tests/settings-channels.test.tsx b/webui/src/tests/settings-channels.test.tsx
index 50e19e17e..a241bd551 100644
--- a/webui/src/tests/settings-channels.test.tsx
+++ b/webui/src/tests/settings-channels.test.tsx
@@ -369,6 +369,29 @@ describe("Settings channels", () => {
expect(screen.getByRole("button", { name: "All" })).toHaveAttribute("aria-pressed", "true");
});
+ it("shows all channels by default when only the always-enabled WebUI is enabled", async () => {
+ const websocket = {
+ ...catalogFeature("websocket", true),
+ display_name: "nanobot WebUI",
+ capabilities: ["always_enabled"],
+ };
+ const disabled = catalogFeature("Disabled channel", false);
+ vi.stubGlobal("fetch", vi.fn(async (input: RequestInfo | URL) => {
+ const url = String(input);
+ if (url === "/api/settings") return jsonResponse(settingsPayload());
+ if (url === "/api/settings/nanobot-features") {
+ return jsonResponse({ features: [websocket, disabled], enabled_count: 1 });
+ }
+ return jsonResponse({});
+ }));
+
+ renderSettingsView({ initialSection: "channels" });
+
+ expect(await screen.findByText("nanobot WebUI")).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "View Disabled channel settings" })).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "All" })).toHaveAttribute("aria-pressed", "true");
+ });
+
it("requires a restart before enabling newly installed channel support", async () => {
const whatsappFeature = {
name: "whatsapp",