feat: backend selector setting
This commit is contained in:
@@ -474,8 +474,9 @@ async function initialize(): Promise<void> {
|
||||
});
|
||||
|
||||
// Start Gateway automatically (this seeds missing bootstrap files with full templates)
|
||||
const gatewayBackend = await getSetting('gatewayBackend');
|
||||
const gatewayAutoStart = await getSetting('gatewayAutoStart');
|
||||
if (!isE2EMode && gatewayAutoStart) {
|
||||
if (!isE2EMode && gatewayBackend === 'openclaw' && gatewayAutoStart) {
|
||||
try {
|
||||
await syncAllProviderAuthToRuntime();
|
||||
logger.debug('Auto-starting Gateway...');
|
||||
@@ -487,6 +488,8 @@ async function initialize(): Promise<void> {
|
||||
}
|
||||
} else if (isE2EMode) {
|
||||
logger.info('Gateway auto-start skipped in E2E mode');
|
||||
} else if (gatewayBackend !== 'openclaw') {
|
||||
logger.info(`Gateway auto-start skipped (backend=${gatewayBackend})`);
|
||||
} else {
|
||||
logger.info('Gateway auto-start disabled in settings');
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ export interface AppSettings {
|
||||
gatewayAutoStart: boolean;
|
||||
gatewayPort: number;
|
||||
gatewayToken: string;
|
||||
gatewayBackend: 'openclaw' | 'hermes';
|
||||
proxyEnabled: boolean;
|
||||
proxyServer: string;
|
||||
proxyHttpServer: string;
|
||||
@@ -86,6 +87,7 @@ function createDefaultSettings(): AppSettings {
|
||||
gatewayAutoStart: true,
|
||||
gatewayPort: 18789,
|
||||
gatewayToken: generateToken(),
|
||||
gatewayBackend: 'openclaw',
|
||||
proxyEnabled: false,
|
||||
proxyServer: '',
|
||||
proxyHttpServer: '',
|
||||
|
||||
@@ -18,6 +18,7 @@ import { Switch } from '@/components/ui/switch';
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Select } from '@/components/ui/select';
|
||||
import { toast } from 'sonner';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
import { useGatewayStore } from '@/stores/gateway';
|
||||
@@ -57,6 +58,8 @@ export function Settings() {
|
||||
setLaunchAtStartup,
|
||||
gatewayAutoStart,
|
||||
setGatewayAutoStart,
|
||||
gatewayBackend,
|
||||
setGatewayBackend,
|
||||
proxyEnabled,
|
||||
proxyServer,
|
||||
proxyHttpServer,
|
||||
@@ -627,6 +630,24 @@ export function Settings() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-3">
|
||||
<div>
|
||||
<Label className="text-[15px] font-medium text-foreground">Backend</Label>
|
||||
<p className="text-[13px] text-muted-foreground mt-1">
|
||||
OpenClaw is the built-in gateway. Hermes requires WSL2 on Windows.
|
||||
</p>
|
||||
</div>
|
||||
<div className="w-full sm:w-56">
|
||||
<Select
|
||||
value={gatewayBackend}
|
||||
onChange={(event) => setGatewayBackend(event.target.value as 'openclaw' | 'hermes')}
|
||||
>
|
||||
<option value="openclaw">OpenClaw</option>
|
||||
<option value="hermes">Hermes</option>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
|
||||
@@ -10,6 +10,7 @@ import { resolveSupportedLanguage } from '../../shared/language';
|
||||
|
||||
type Theme = 'light' | 'dark' | 'system';
|
||||
type UpdateChannel = 'stable' | 'beta' | 'dev';
|
||||
type GatewayBackend = 'openclaw' | 'hermes';
|
||||
|
||||
interface SettingsState {
|
||||
// General
|
||||
@@ -22,6 +23,7 @@ interface SettingsState {
|
||||
// Gateway
|
||||
gatewayAutoStart: boolean;
|
||||
gatewayPort: number;
|
||||
gatewayBackend: GatewayBackend;
|
||||
proxyEnabled: boolean;
|
||||
proxyServer: string;
|
||||
proxyHttpServer: string;
|
||||
@@ -50,6 +52,7 @@ interface SettingsState {
|
||||
setTelemetryEnabled: (value: boolean) => void;
|
||||
setGatewayAutoStart: (value: boolean) => void;
|
||||
setGatewayPort: (port: number) => void;
|
||||
setGatewayBackend: (value: GatewayBackend) => void;
|
||||
setProxyEnabled: (value: boolean) => void;
|
||||
setProxyServer: (value: string) => void;
|
||||
setProxyHttpServer: (value: string) => void;
|
||||
@@ -73,6 +76,7 @@ const defaultSettings = {
|
||||
telemetryEnabled: true,
|
||||
gatewayAutoStart: true,
|
||||
gatewayPort: 18789,
|
||||
gatewayBackend: 'openclaw' as GatewayBackend,
|
||||
proxyEnabled: false,
|
||||
proxyServer: '',
|
||||
proxyHttpServer: '',
|
||||
@@ -157,6 +161,13 @@ export const useSettingsStore = create<SettingsState>()(
|
||||
body: JSON.stringify({ value: gatewayPort }),
|
||||
}).catch(() => { });
|
||||
},
|
||||
setGatewayBackend: (gatewayBackend) => {
|
||||
set({ gatewayBackend });
|
||||
void hostApiFetch('/api/settings/gatewayBackend', {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ value: gatewayBackend }),
|
||||
}).catch(() => { });
|
||||
},
|
||||
setProxyEnabled: (proxyEnabled) => set({ proxyEnabled }),
|
||||
setProxyServer: (proxyServer) => set({ proxyServer }),
|
||||
setProxyHttpServer: (proxyHttpServer) => set({ proxyHttpServer }),
|
||||
|
||||
Reference in New Issue
Block a user