feat(webui): expand and organize settings with autosave (#5704)
* feat(webui): expand settings with autosave and live configuration * feat(memory): add long-term memory and idle compaction switches * refactor(webui): clarify settings hierarchy and align compact controls * refactor(webui): keep only memory consolidation in memory settings * refactor(webui): defer runtime changes until explicit restart * refactor(webui): remove default workspace setting * fix(webui): align model lists and remove preset counters * fix(i18n): use natural Chinese labels for chat platforms * fix(i18n): shorten chat settings navigation label * fix(webui): match settings navigation icons to text size * refactor(webui): remove redundant settings sidebar heading * refactor(webui): use icon-only back navigation in settings * fix(webui): remove back arrow hover hint * refactor(webui): remove redundant overview details * refactor(webui): hide secondary descriptions in settings rows * style(webui): replace settings dividers with rounded highlights * refactor(webui): remove redundant model list subtitles and badges * fix(i18n): restore chat translation namespace boundaries * fix(i18n): complete settings translations for all locales * fix(webui): reveal settings only for enabled capabilities * fix(webui): consolidate capabilities and isolate settings feedback * fix(webui): clear restart notices when settings are reverted * fix(webui): anchor restart controls in settings sidebar * fix(webui): shorten sidebar restart label * fix(webui): align settings spacing and control sizes * refactor(webui): unify settings dialogs and interaction feedback * fix(webui): keep settings option groups on one line without scrolling * refactor(webui): align settings spacing and sidebar icon proportions * style(webui): match main sidebar typography to settings * style(webui): use monospace for sidebar session handles * refactor(webui): remove heartbeat configuration from automations * feat(webui): expose configuration actions beside capability toggles * style(webui): remove ellipsis from configuration actions * refactor(webui): remove redundant app configuration controls * feat(webui): add compact sidebar navigation and shortcut hints * fix(webui): synchronize npm dependency lockfile * test(webui): align input radius expectation with pill styling * feat(webui): show daily token usage and cache breakdown * feat(webui): add model usage details and cache hit rates * feat(webui): chart daily token usage by model * refactor(webui): simplify usage details and model labels * fix(webui): hide usage dialog date range * refactor(webui): consolidate model usage into chart legends * fix(webui): enforce restart choices and correct settings test route * fix(webui): polish settings localization and controls * fix(webui): avoid repeated usage legend labels * fix(webui): skip empty usage columns in keyboard navigation * test(webui): assert settings behavior positively * feat(webui): refine sidebar navigation and add drag resizing * style(webui): soften sidebar scroll edges * style(webui): harmonize sidebar typography and text colors * feat(webui): move channels to the main sidebar * style(webui): remove dotted underlines from settings hints * fix(webui): unify tooltip hover delay * fix(webui): support Seatbelt sandbox settings * fix(webui): remove unused appearance density preference * fix(webui): align settings input values consistently * style(webui): group compact settings controls before inputs * feat(webui): edit multiline settings in compact dialogs * feat(webui): add continuous settings scrolling with gentle snapping * Revert "feat(webui): add continuous settings scrolling with gentle snapping" This reverts commit f0978c261a53c844185eeab4d0c3190fbd196fe6.
This commit is contained in:
1 parent
20f115bf46
commit
8ea683679d
244 files changed
+6929
-3900
No files matched your search
@@ -1,4 +1,10 @@
|
||||
import { ChevronLeft, Loader2 } from "lucide-react";
|
||||
import { useCallback, useEffect, useState, type ReactNode } from "react";
|
||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogLayoutContext, DialogTitle } from "@/components/ui/dialog";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import type { SettingsExitGuard } from "@/components/settings/contracts";
|
||||
import { isCapabilitySection, type SettingsSectionKey } from "@/components/settings/contracts";
|
||||
import { SettingsFeature } from "@/components/settings/shared/SettingsFeature";
|
||||
|
||||
import { SkillsCatalogSettings } from "@/components/settings/SkillsCatalogSettings";
|
||||
import { ImageGenerationSettings } from "@/components/settings/capabilities/ImageGenerationSettings";
|
||||
@@ -14,12 +20,14 @@ import {
|
||||
ProvidersSettings,
|
||||
providerFormFromRow,
|
||||
} from "@/components/settings/models/ProviderSettings";
|
||||
import { AppearanceSettings, OverviewSettings } from "@/components/settings/overview/OverviewSettings";
|
||||
import { AboutSettings, AppearanceSettings, OverviewSettings } from "@/components/settings/overview/OverviewSettings";
|
||||
import { SettingsSidebar, standaloneSectionTitle } from "@/components/settings/SettingsSidebar";
|
||||
import {
|
||||
NanobotFeatureInstallDialog,
|
||||
SettingsGroup,
|
||||
SettingsRow,
|
||||
SettingsSectionTitle,
|
||||
RestartRequiredNotice,
|
||||
} from "@/components/settings/shared/SettingsControls";
|
||||
import { AppsCatalogSettings } from "@/components/settings/system/AppsSettings";
|
||||
import {
|
||||
@@ -28,12 +36,15 @@ import {
|
||||
AutomationsSettings,
|
||||
} from "@/components/settings/system/AutomationsSettings";
|
||||
import { ChannelsSettings } from "@/components/settings/system/ChannelsSettings";
|
||||
import { RUNTIME_CONFIG_FIELDS, type RuntimeConfigPage } from "@/components/settings/system/runtime-config-fields";
|
||||
import { RuntimeConfigSettings } from "@/components/settings/system/RuntimeConfigSettings";
|
||||
import { RuntimeSettings } from "@/components/settings/system/RuntimeSettings";
|
||||
import type { SettingsController } from "@/components/settings/useSettingsController";
|
||||
import type { SkillSummary } from "@/lib/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
interface SettingsPageProps {
|
||||
registerExitGuard?: (guard: SettingsExitGuard | null) => void;
|
||||
controller: SettingsController;
|
||||
theme: "light" | "dark";
|
||||
showSidebar: boolean;
|
||||
@@ -46,6 +57,7 @@ interface SettingsPageProps {
|
||||
}
|
||||
|
||||
export function SettingsPage({
|
||||
registerExitGuard,
|
||||
controller,
|
||||
theme,
|
||||
showSidebar,
|
||||
@@ -56,6 +68,8 @@ export function SettingsPage({
|
||||
isRestarting,
|
||||
hostChromeInset,
|
||||
}: SettingsPageProps) {
|
||||
const [dialogLayoutAnchor, setDialogLayoutAnchor] = useState<HTMLDivElement | null>(null);
|
||||
const [pendingExit, setPendingExit] = useState<(() => void) | null>(null);
|
||||
const {
|
||||
activeSection,
|
||||
apiService,
|
||||
@@ -76,7 +90,6 @@ export function SettingsPage({
|
||||
beginModelPresetCreation,
|
||||
cancelModelPresetCreation,
|
||||
changeModelCallOrder,
|
||||
channelsQuery,
|
||||
cliApps,
|
||||
cliAppsAction,
|
||||
cliAppsError,
|
||||
@@ -109,7 +122,6 @@ export function SettingsPage({
|
||||
handleSaveCustomMcp,
|
||||
handleToggleProvider,
|
||||
handleWebSearchProviderChange,
|
||||
hasPendingRestart,
|
||||
hostEngineApplying,
|
||||
imageGenerationDirty,
|
||||
imageGenerationForm,
|
||||
@@ -147,7 +159,7 @@ export function SettingsPage({
|
||||
networkSafetyDirty,
|
||||
networkSafetyForm,
|
||||
networkSafetySaving,
|
||||
pendingRestartSections,
|
||||
pendingRestartSections: controllerPendingRestartSections,
|
||||
providerForms,
|
||||
providerOAuthCompleting,
|
||||
providerOAuthDialogError,
|
||||
@@ -173,7 +185,6 @@ export function SettingsPage({
|
||||
setAutomationsFilter,
|
||||
setAutomationsQuery,
|
||||
setAutomationsSort,
|
||||
setChannelsQuery,
|
||||
setCliAppsError,
|
||||
setCliAppsMessage,
|
||||
setCustomMcpForm,
|
||||
@@ -216,18 +227,95 @@ export function SettingsPage({
|
||||
webSearchSaving,
|
||||
} = controller;
|
||||
|
||||
const renderSection = () => {
|
||||
const restartInProgress = isRestarting || hostEngineApplying;
|
||||
const requestExit = useCallback<SettingsExitGuard>((leave) => {
|
||||
if (settings?.requires_restart && !restartInProgress) setPendingExit(() => leave);
|
||||
else leave();
|
||||
}, [settings?.requires_restart, restartInProgress]);
|
||||
useEffect(() => {
|
||||
registerExitGuard?.(requestExit);
|
||||
return () => registerExitGuard?.(null);
|
||||
}, [registerExitGuard, requestExit]);
|
||||
const backToChat = () => registerExitGuard ? onBackToChat() : requestExit(onBackToChat);
|
||||
const pendingRestartSections = showSidebar
|
||||
? { runtime: false, image: false, browser: false }
|
||||
: controllerPendingRestartSections;
|
||||
|
||||
const runtimeConfiguration = (page: RuntimeConfigPage) => settings && (
|
||||
<RuntimeConfigSettings page={page} settings={settings} state={controller.runtimeConfigState}
|
||||
onRestart={showSidebar ? undefined : restartViaSettingsSurface} isRestarting={restartInProgress}
|
||||
remoteBrowserAccess={remoteBrowserAccess}>
|
||||
{page === "advanced" ? (
|
||||
<AdvancedSettings
|
||||
error={controller.capabilityErrors.safety}
|
||||
form={networkSafetyForm}
|
||||
dirty={networkSafetyDirty}
|
||||
saving={networkSafetySaving}
|
||||
isNativeHostSurface={(settings.surface ?? settings.runtime_surface) === "native"}
|
||||
onChangeForm={setNetworkSafetyForm}
|
||||
onSave={saveNetworkSafetySettings}
|
||||
onRestart={restartViaSettingsSurface}
|
||||
isRestarting={restartInProgress}
|
||||
requiresRestartPending={pendingRestartSections.runtime}
|
||||
/>
|
||||
) : null}
|
||||
</RuntimeConfigSettings>
|
||||
);
|
||||
|
||||
const renderSection = (section: SettingsSectionKey, embedded = false): ReactNode => {
|
||||
if (!settings) return null;
|
||||
switch (activeSection) {
|
||||
switch (section) {
|
||||
case "capabilities": {
|
||||
const state = controller.runtimeConfigState;
|
||||
const toggleRuntime = (path: string, enabled: boolean) => {
|
||||
const field = RUNTIME_CONFIG_FIELDS.find((item) => item.path === path);
|
||||
if (field) state.change(field, enabled);
|
||||
};
|
||||
return (
|
||||
<section className="settings-stack">
|
||||
<div className="settings-section-heading">
|
||||
<SettingsSectionTitle>{t("settings.nav.capabilities")}</SettingsSectionTitle>
|
||||
{!showSidebar && settings.requires_restart ? <RestartRequiredNotice message={t("settings.status.savedRestartApply")}
|
||||
onRestart={restartViaSettingsSurface} isRestarting={restartInProgress} /> : null}
|
||||
</div>
|
||||
<SettingsFeature title={t("settings.rows.imageGeneration")} enabled={imageGenerationForm.enabled}
|
||||
error={imageGenerationForm.enabled && !settings.image_generation.providers.find((provider) => provider.name === imageGenerationForm.provider)?.configured
|
||||
? t("settings.image.missingCredential") : controller.capabilityErrors.image}
|
||||
disabled={restartInProgress || imageGenerationSaving} initialOpen={activeSection === "image"}
|
||||
onChange={(enabled) => setImageGenerationForm((prev) => ({ ...prev, enabled }))}>
|
||||
{renderSection("image", true)}
|
||||
</SettingsFeature>
|
||||
<SettingsFeature title={t("settings.rows.transcription")} enabled={transcriptionForm.enabled}
|
||||
error={controller.capabilityErrors.voice}
|
||||
disabled={restartInProgress || transcriptionSaving} initialOpen={activeSection === "voice"}
|
||||
onChange={(enabled) => setTranscriptionForm((prev) => ({ ...prev, enabled }))}>
|
||||
{renderSection("voice", true)}
|
||||
</SettingsFeature>
|
||||
<SettingsFeature title={t("settings.runtimeConfig.groups.web.title")}
|
||||
enabled={settings.runtime_config ? state.value("tools.web.enable") === true : settings.web.enable}
|
||||
disabled={restartInProgress || state.saving === "web" || !settings.runtime_config}
|
||||
initialOpen={activeSection === "browser"} error={state.errors.web || controller.capabilityErrors.web}
|
||||
onChange={(enabled) => toggleRuntime("tools.web.enable", enabled)}>
|
||||
{renderSection("browser", true)}
|
||||
</SettingsFeature>
|
||||
<SettingsFeature title={t("settings.runtimeConfig.fields.agents_defaults_dream_enabled.label")}
|
||||
enabled={state.value("agents.defaults.dream.enabled") === true}
|
||||
disabled={restartInProgress || state.saving === "memory" || !settings.runtime_config} error={state.errors.memory}
|
||||
onChange={(enabled) => toggleRuntime("agents.defaults.dream.enabled", enabled)} />
|
||||
{!settings.runtime_config ? <p className="settings-list-inset text-[13px] text-muted-foreground">{t("settings.runtimeConfig.unavailable")}</p> : null}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
case "overview":
|
||||
return (
|
||||
<OverviewSettings
|
||||
settings={settings}
|
||||
requiresRestart={hasPendingRestart}
|
||||
showBrandLogos={localPrefs.brandLogos}
|
||||
onSelectSection={selectSection}
|
||||
/>
|
||||
);
|
||||
case "about":
|
||||
return <AboutSettings currentVersion={settings.version?.current} />;
|
||||
case "appearance":
|
||||
return (
|
||||
<AppearanceSettings
|
||||
@@ -239,7 +327,7 @@ export function SettingsPage({
|
||||
);
|
||||
case "models":
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
<div className="settings-stack">
|
||||
<ModelsSettings
|
||||
token={token}
|
||||
form={form}
|
||||
@@ -305,32 +393,37 @@ export function SettingsPage({
|
||||
onCreateCustomProvider={createCustomProvider}
|
||||
onProviderOAuthLogin={(provider) => runProviderOAuth(provider, "login")}
|
||||
onProviderOAuthLogout={(provider) => runProviderOAuth(provider, "logout")}
|
||||
imageProviderRestartPending={pendingRestartSections.image || pendingRestartSections.runtime}
|
||||
onRestart={restartViaSettingsSurface}
|
||||
isRestarting={isRestarting || hostEngineApplying}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
case "image":
|
||||
return (
|
||||
<ImageGenerationSettings
|
||||
token={token}
|
||||
settings={settings}
|
||||
form={imageGenerationForm}
|
||||
dirty={imageGenerationDirty}
|
||||
saving={imageGenerationSaving}
|
||||
onChangeForm={setImageGenerationForm}
|
||||
onSave={saveImageGenerationSettings}
|
||||
onOpenProviders={() => selectSection("models")}
|
||||
showBrandLogos={localPrefs.brandLogos}
|
||||
onRestart={restartViaSettingsSurface}
|
||||
isRestarting={isRestarting || hostEngineApplying}
|
||||
requiresRestartPending={pendingRestartSections.image}
|
||||
/>
|
||||
<div className="settings-stack">
|
||||
<ImageGenerationSettings
|
||||
error={controller.capabilityErrors.image}
|
||||
embedded={embedded}
|
||||
token={token}
|
||||
settings={settings}
|
||||
form={imageGenerationForm}
|
||||
dirty={imageGenerationDirty}
|
||||
saving={imageGenerationSaving}
|
||||
onChangeForm={setImageGenerationForm}
|
||||
onSave={saveImageGenerationSettings}
|
||||
onOpenProviders={() => selectSection("models")}
|
||||
showBrandLogos={localPrefs.brandLogos}
|
||||
onRestart={restartViaSettingsSurface}
|
||||
isRestarting={restartInProgress}
|
||||
requiresRestartPending={pendingRestartSections.image}
|
||||
>
|
||||
{imageGenerationForm.enabled ? runtimeConfiguration("image") : null}
|
||||
</ImageGenerationSettings>
|
||||
</div>
|
||||
);
|
||||
case "voice":
|
||||
return (
|
||||
<TranscriptionSettings
|
||||
error={controller.capabilityErrors.voice}
|
||||
embedded={embedded}
|
||||
settings={settings}
|
||||
form={transcriptionForm}
|
||||
dirty={transcriptionDirty}
|
||||
@@ -340,36 +433,44 @@ export function SettingsPage({
|
||||
onOpenProviders={() => selectSection("models")}
|
||||
showBrandLogos={localPrefs.brandLogos}
|
||||
onRestart={restartViaSettingsSurface}
|
||||
isRestarting={isRestarting || hostEngineApplying}
|
||||
isRestarting={restartInProgress}
|
||||
requiresRestartPending={pendingRestartSections.browser}
|
||||
/>
|
||||
);
|
||||
case "browser":
|
||||
return (
|
||||
<WebSettings
|
||||
settings={settings}
|
||||
form={webSearchForm}
|
||||
keyVisible={webSearchKeyVisible}
|
||||
keyEditing={webSearchKeyEditing}
|
||||
saving={webSearchSaving}
|
||||
onChangeForm={setWebSearchForm}
|
||||
onChangeProvider={handleWebSearchProviderChange}
|
||||
onToggleKey={() => setWebSearchKeyVisible((visible) => !visible)}
|
||||
onToggleKeyEditing={() => {
|
||||
setWebSearchKeyEditing((editing) => !editing);
|
||||
setWebSearchKeyVisible(false);
|
||||
setWebSearchForm((prev) => ({ ...prev, apiKey: "" }));
|
||||
}}
|
||||
onReset={resetWebSearchDraft}
|
||||
onSave={saveWebSearch}
|
||||
showBrandLogos={localPrefs.brandLogos}
|
||||
onRestart={restartViaSettingsSurface}
|
||||
isRestarting={isRestarting || hostEngineApplying}
|
||||
requiresRestartPending={pendingRestartSections.browser}
|
||||
olostepFeature={featureCatalog.find((feature) => feature.name === "olostep")}
|
||||
olostepInstalling={nanobotFeatureAction === "enable:olostep"}
|
||||
capabilityError={nanobotFeaturesError}
|
||||
/>
|
||||
<div className="settings-stack">
|
||||
{!embedded ? runtimeConfiguration("browser") : null}
|
||||
<WebSettings
|
||||
error={controller.capabilityErrors.web || controller.runtimeConfigState.errors.web}
|
||||
embedded={embedded}
|
||||
enabled={settings.runtime_config
|
||||
? controller.runtimeConfigState.value("tools.web.enable") !== false
|
||||
: settings.web.enable}
|
||||
settings={settings}
|
||||
form={webSearchForm}
|
||||
keyVisible={webSearchKeyVisible}
|
||||
keyEditing={webSearchKeyEditing}
|
||||
saving={webSearchSaving}
|
||||
onChangeForm={setWebSearchForm}
|
||||
onChangeProvider={handleWebSearchProviderChange}
|
||||
onToggleKey={() => setWebSearchKeyVisible((visible) => !visible)}
|
||||
onToggleKeyEditing={() => {
|
||||
setWebSearchKeyEditing((editing) => !editing);
|
||||
setWebSearchKeyVisible(false);
|
||||
setWebSearchForm((prev) => ({ ...prev, apiKey: "" }));
|
||||
}}
|
||||
onReset={resetWebSearchDraft}
|
||||
onSave={saveWebSearch}
|
||||
showBrandLogos={localPrefs.brandLogos}
|
||||
onRestart={restartViaSettingsSurface}
|
||||
isRestarting={restartInProgress}
|
||||
requiresRestartPending={pendingRestartSections.browser}
|
||||
olostepFeature={featureCatalog.find((feature) => feature.name === "olostep")}
|
||||
olostepInstalling={nanobotFeatureAction === "enable:olostep"}
|
||||
capabilityError={nanobotFeaturesError}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
case "channels":
|
||||
return (
|
||||
@@ -377,154 +478,166 @@ export function SettingsPage({
|
||||
token={token}
|
||||
nanobotFeatures={nanobotFeatures}
|
||||
loading={nanobotFeaturesLoading}
|
||||
query={channelsQuery}
|
||||
actionKey={nanobotFeatureAction}
|
||||
chatAppsDocsUrl={settings.docs?.chat_apps_url}
|
||||
showBrandLogos={localPrefs.brandLogos}
|
||||
error={nanobotFeaturesError}
|
||||
requiresRestartPending={pendingRestartSections.runtime}
|
||||
onQueryChange={setChannelsQuery}
|
||||
onAction={handleNanobotFeatureAction}
|
||||
onFeaturesUpdate={setNanobotFeatures}
|
||||
onDismissStatus={() => {
|
||||
setNanobotFeaturesError(null);
|
||||
}}
|
||||
onRestart={restartViaSettingsSurface}
|
||||
isRestarting={isRestarting || hostEngineApplying}
|
||||
isRestarting={restartInProgress}
|
||||
/>
|
||||
);
|
||||
case "apps":
|
||||
return (
|
||||
<AppsCatalogSettings
|
||||
cliApps={cliApps}
|
||||
mcpPresets={mcpPresets}
|
||||
cliAppsLoading={cliAppsLoading}
|
||||
mcpPresetsLoading={mcpPresetsLoading}
|
||||
query={appsQuery}
|
||||
filter={appsKindFilter}
|
||||
cliActionKey={cliAppsAction}
|
||||
mcpActionKey={mcpPresetAction}
|
||||
mcpOAuthFlow={mcpOAuthFlow}
|
||||
mcpOAuthPopupBlocked={mcpOAuthPopupBlocked}
|
||||
mcpOAuthCallbackUrl={mcpOAuthCallbackUrl}
|
||||
mcpOAuthCompleting={mcpOAuthCompleting}
|
||||
mcpOAuthCallbackError={mcpOAuthCallbackError}
|
||||
cliMessage={cliAppsMessage}
|
||||
cliError={cliAppsError}
|
||||
cliFocusName={cliAppsFocusName}
|
||||
mcpMessage={mcpMessage}
|
||||
mcpError={mcpError}
|
||||
mcpFieldValues={mcpFieldValues}
|
||||
customMcpForm={customMcpForm}
|
||||
mcpConfigImport={mcpConfigImport}
|
||||
showBrandLogos={localPrefs.brandLogos}
|
||||
requiresRestartPending={pendingRestartSections.runtime}
|
||||
onQueryChange={setAppsQuery}
|
||||
onFilterChange={setAppsKindFilter}
|
||||
onCliAction={handleCliAppAction}
|
||||
onMcpAction={handleMcpPresetAction}
|
||||
onMcpOAuthConnect={handleMcpOAuthConnect}
|
||||
onMcpOAuthCancel={() => void handleMcpOAuthCancel()}
|
||||
onMcpOAuthOpen={handleMcpOAuthOpen}
|
||||
onMcpOAuthCallbackUrlChange={(value) => {
|
||||
setMcpOAuthCallbackUrl(value);
|
||||
setMcpOAuthCallbackError(null);
|
||||
}}
|
||||
onMcpOAuthComplete={() => void handleMcpOAuthComplete()}
|
||||
onDismissStatus={() => {
|
||||
setCliAppsMessage(null);
|
||||
setCliAppsError(null);
|
||||
setMcpMessage(null);
|
||||
setMcpError(null);
|
||||
}}
|
||||
onBackToChat={onBackToChat}
|
||||
onMcpFieldChange={(presetName, fieldName, value) => {
|
||||
setMcpFieldValues((prev) => ({
|
||||
...prev,
|
||||
[presetName]: {
|
||||
...(prev[presetName] ?? {}),
|
||||
[fieldName]: value,
|
||||
},
|
||||
}));
|
||||
}}
|
||||
onCustomMcpFormChange={setCustomMcpForm}
|
||||
onMcpConfigImportChange={setMcpConfigImport}
|
||||
onSaveCustomMcp={handleSaveCustomMcp}
|
||||
onImportMcpConfig={handleImportMcpConfig}
|
||||
onMcpToolsChange={handleMcpToolsChange}
|
||||
onRestart={restartViaSettingsSurface}
|
||||
isRestarting={isRestarting || hostEngineApplying}
|
||||
/>
|
||||
<div className="settings-stack">
|
||||
<AppsCatalogSettings
|
||||
cliApps={cliApps}
|
||||
mcpPresets={mcpPresets}
|
||||
cliAppsLoading={cliAppsLoading}
|
||||
mcpPresetsLoading={mcpPresetsLoading}
|
||||
query={appsQuery}
|
||||
filter={appsKindFilter}
|
||||
cliActionKey={cliAppsAction}
|
||||
mcpActionKey={mcpPresetAction}
|
||||
mcpOAuthFlow={mcpOAuthFlow}
|
||||
mcpOAuthPopupBlocked={mcpOAuthPopupBlocked}
|
||||
mcpOAuthCallbackUrl={mcpOAuthCallbackUrl}
|
||||
mcpOAuthCompleting={mcpOAuthCompleting}
|
||||
mcpOAuthCallbackError={mcpOAuthCallbackError}
|
||||
cliMessage={cliAppsMessage}
|
||||
cliError={cliAppsError}
|
||||
cliFocusName={cliAppsFocusName}
|
||||
mcpMessage={mcpMessage}
|
||||
mcpError={mcpError}
|
||||
mcpFieldValues={mcpFieldValues}
|
||||
customMcpForm={customMcpForm}
|
||||
mcpConfigImport={mcpConfigImport}
|
||||
showBrandLogos={localPrefs.brandLogos}
|
||||
requiresRestartPending={pendingRestartSections.runtime}
|
||||
onQueryChange={setAppsQuery}
|
||||
onFilterChange={setAppsKindFilter}
|
||||
onCliAction={handleCliAppAction}
|
||||
onMcpAction={handleMcpPresetAction}
|
||||
onMcpOAuthConnect={handleMcpOAuthConnect}
|
||||
onMcpOAuthCancel={() => void handleMcpOAuthCancel()}
|
||||
onMcpOAuthOpen={handleMcpOAuthOpen}
|
||||
onMcpOAuthCallbackUrlChange={(value) => {
|
||||
setMcpOAuthCallbackUrl(value);
|
||||
setMcpOAuthCallbackError(null);
|
||||
}}
|
||||
onMcpOAuthComplete={() => void handleMcpOAuthComplete()}
|
||||
onDismissStatus={() => {
|
||||
setCliAppsMessage(null);
|
||||
setCliAppsError(null);
|
||||
setMcpMessage(null);
|
||||
setMcpError(null);
|
||||
}}
|
||||
onBackToChat={onBackToChat}
|
||||
onMcpFieldChange={(presetName, fieldName, value) => {
|
||||
setMcpFieldValues((prev) => ({
|
||||
...prev,
|
||||
[presetName]: {
|
||||
...(prev[presetName] ?? {}),
|
||||
[fieldName]: value,
|
||||
},
|
||||
}));
|
||||
}}
|
||||
onCustomMcpFormChange={setCustomMcpForm}
|
||||
onMcpConfigImportChange={setMcpConfigImport}
|
||||
onSaveCustomMcp={handleSaveCustomMcp}
|
||||
onImportMcpConfig={handleImportMcpConfig}
|
||||
onMcpToolsChange={handleMcpToolsChange}
|
||||
onRestart={restartViaSettingsSurface}
|
||||
isRestarting={restartInProgress}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
case "automations":
|
||||
return (
|
||||
<AutomationsSettings
|
||||
payload={automations}
|
||||
loading={automationsLoading}
|
||||
query={automationsQuery}
|
||||
filter={automationsFilter}
|
||||
sort={automationsSort}
|
||||
actionKey={automationAction}
|
||||
error={automationsError}
|
||||
onQueryChange={setAutomationsQuery}
|
||||
onFilterChange={setAutomationsFilter}
|
||||
onSortChange={setAutomationsSort}
|
||||
onAction={handleAutomationAction}
|
||||
onRequestEdit={setAutomationPendingEdit}
|
||||
onRequestDelete={setAutomationPendingDelete}
|
||||
onBackToChat={onBackToChat}
|
||||
/>
|
||||
<div className="settings-stack">
|
||||
<AutomationsSettings
|
||||
payload={automations}
|
||||
loading={automationsLoading}
|
||||
query={automationsQuery}
|
||||
filter={automationsFilter}
|
||||
sort={automationsSort}
|
||||
actionKey={automationAction}
|
||||
error={automationsError}
|
||||
onQueryChange={setAutomationsQuery}
|
||||
onFilterChange={setAutomationsFilter}
|
||||
onSortChange={setAutomationsSort}
|
||||
onAction={handleAutomationAction}
|
||||
onRequestEdit={setAutomationPendingEdit}
|
||||
onRequestDelete={setAutomationPendingDelete}
|
||||
onBackToChat={onBackToChat}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
case "skills":
|
||||
return <SkillsCatalogSettings skills={skills} />;
|
||||
case "runtime":
|
||||
return (
|
||||
<RuntimeSettings
|
||||
form={form}
|
||||
settings={settings}
|
||||
onRestart={restartViaSettingsSurface}
|
||||
isRestarting={isRestarting || hostEngineApplying}
|
||||
requiresRestartPending={pendingRestartSections.runtime}
|
||||
apiService={apiService}
|
||||
apiServiceLoading={apiServiceLoading}
|
||||
apiServiceAction={apiServiceAction}
|
||||
apiServiceError={apiServiceError}
|
||||
langfuseFeature={featureCatalog.find((feature) => feature.name === "langfuse")}
|
||||
capabilitiesLoading={nanobotFeaturesLoading}
|
||||
capabilityAction={nanobotFeatureAction}
|
||||
capabilityError={nanobotFeaturesError}
|
||||
onApiServiceAction={handleApiServiceAction}
|
||||
onInstallCapability={(name) => void installCapabilities([name])}
|
||||
/>
|
||||
<div className="settings-stack">
|
||||
{runtimeConfiguration("runtime")}
|
||||
<RuntimeSettings
|
||||
form={form}
|
||||
settings={settings}
|
||||
onRestart={showSidebar ? undefined : restartViaSettingsSurface}
|
||||
isRestarting={restartInProgress}
|
||||
requiresRestartPending={pendingRestartSections.runtime}
|
||||
apiService={apiService}
|
||||
apiServiceLoading={apiServiceLoading}
|
||||
apiServiceAction={apiServiceAction}
|
||||
apiServiceError={apiServiceError}
|
||||
langfuseFeature={featureCatalog.find((feature) => feature.name === "langfuse")}
|
||||
capabilitiesLoading={nanobotFeaturesLoading}
|
||||
capabilityAction={nanobotFeatureAction}
|
||||
capabilityError={nanobotFeaturesError}
|
||||
onApiServiceAction={handleApiServiceAction}
|
||||
onInstallCapability={(name) => void installCapabilities([name])}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
case "memory":
|
||||
return runtimeConfiguration("memory");
|
||||
case "advanced":
|
||||
return (
|
||||
<AdvancedSettings
|
||||
form={networkSafetyForm}
|
||||
dirty={networkSafetyDirty}
|
||||
saving={networkSafetySaving}
|
||||
isNativeHostSurface={(settings.surface ?? settings.runtime_surface) === "native"}
|
||||
onChangeForm={setNetworkSafetyForm}
|
||||
onSave={saveNetworkSafetySettings}
|
||||
onRestart={restartViaSettingsSurface}
|
||||
isRestarting={isRestarting || hostEngineApplying}
|
||||
requiresRestartPending={pendingRestartSections.runtime}
|
||||
/>
|
||||
);
|
||||
return runtimeConfiguration("advanced");
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<DialogLayoutContext.Provider value={dialogLayoutAnchor}>
|
||||
<div className="flex min-h-0 flex-1 flex-col overflow-hidden bg-settings-canvas lg:flex-row">
|
||||
<Dialog open={pendingExit !== null} onOpenChange={(open) => { if (!open) setPendingExit(null); }}>
|
||||
<DialogContent showCloseButton={false}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>{t("settings.exit.title")}</DialogTitle>
|
||||
<DialogDescription>{t("settings.exit.description")}</DialogDescription>
|
||||
</DialogHeader>
|
||||
<DialogFooter>
|
||||
<Button variant="outline" onClick={() => { const leave = pendingExit; setPendingExit(null); leave?.(); }}>{t("settings.exit.later")}</Button>
|
||||
<Button onClick={() => { setPendingExit(null); void restartViaSettingsSurface(); }}>{t("app.system.restartAction")}</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
{showSidebar ? (
|
||||
<SettingsSidebar
|
||||
activeSection={activeSection}
|
||||
onSelectSection={selectSection}
|
||||
onBackToChat={onBackToChat}
|
||||
onLogout={onLogout}
|
||||
onBackToChat={backToChat}
|
||||
onLogout={onLogout ? () => requestExit(onLogout) : undefined}
|
||||
hostChromeInset={hostChromeInset}
|
||||
onRestart={settings ? restartViaSettingsSurface : undefined}
|
||||
isRestarting={restartInProgress}
|
||||
restartPending={settings?.requires_restart}
|
||||
isNativeHost={(settings?.surface ?? settings?.runtime_surface) === "native"}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
@@ -596,18 +709,18 @@ export function SettingsPage({
|
||||
<div
|
||||
className={cn(
|
||||
"min-w-0 flex-1 bg-settings-canvas [scrollbar-gutter:stable]",
|
||||
activeSection === "channels" ? "overflow-y-auto xl:overflow-hidden" : "overflow-y-auto",
|
||||
"overflow-y-auto",
|
||||
)}
|
||||
>
|
||||
<div
|
||||
key={activeSection}
|
||||
data-testid="settings-section-transition"
|
||||
ref={setDialogLayoutAnchor}
|
||||
data-settings-section={activeSection}
|
||||
className={cn(
|
||||
"mx-auto w-full animate-in fade-in-0 slide-in-from-bottom-1 px-4 py-6 duration-200 ease-out",
|
||||
"motion-reduce:animate-none sm:px-8 sm:py-8 lg:py-12",
|
||||
activeSection === "channels" ? "max-w-[1240px] xl:px-10" : "max-w-[920px]",
|
||||
activeSection === "channels" && "flex min-h-full flex-col xl:h-full xl:min-h-0",
|
||||
"mx-auto w-full animate-in fade-in-0 slide-in-from-bottom-1 py-6 duration-200 ease-out",
|
||||
"motion-reduce:animate-none sm:py-8 lg:py-12",
|
||||
"settings-grid",
|
||||
hostChromeInset && "pt-[4.25rem] sm:pt-[4.25rem] lg:pt-[4.75rem]",
|
||||
)}
|
||||
>
|
||||
@@ -615,8 +728,8 @@ export function SettingsPage({
|
||||
<div className="mb-7">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onBackToChat}
|
||||
className="touch-target mb-4 inline-flex items-center gap-1.5 rounded-full px-2.5 py-1.5 text-[12px] font-medium text-muted-foreground transition-colors hover:bg-muted/70 hover:text-foreground lg:hidden"
|
||||
onClick={backToChat}
|
||||
className="touch-target mb-4 inline-flex items-center gap-1.5 rounded-full px-2.5 py-1.5 text-[12px] font-medium text-muted-foreground transition-colors settings-hover hover:text-foreground lg:hidden"
|
||||
>
|
||||
<ChevronLeft className="h-3.5 w-3.5" aria-hidden />
|
||||
{t("settings.backToChat")}
|
||||
@@ -643,7 +756,7 @@ export function SettingsPage({
|
||||
) : settings ? (
|
||||
<div
|
||||
className={cn(
|
||||
"space-y-5",
|
||||
"settings-stack",
|
||||
activeSection === "channels" &&
|
||||
"flex min-h-0 flex-1 flex-col xl:overflow-hidden",
|
||||
)}
|
||||
@@ -653,11 +766,12 @@ export function SettingsPage({
|
||||
{error}
|
||||
</div>
|
||||
) : null}
|
||||
{renderSection()}
|
||||
{renderSection(isCapabilitySection(activeSection) ? "capabilities" : activeSection)}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</DialogLayoutContext.Provider>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user