Skip to content

Commit cad2485

Browse files
committed
fix: default desktop chat transport to websocket
1 parent 98c570f commit cad2485

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src-tauri/src/bridge_bootstrap.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@
148148

149149
const TOKEN_STORAGE_KEY = 'token';
150150
const SHELL_LOCALE_STORAGE_KEY = 'astrbot-locale';
151+
const CHAT_TRANSPORT_MODE_STORAGE_KEY = 'chat.transportMode';
152+
const CHAT_TRANSPORT_MODE_WEBSOCKET = 'websocket';
151153
const STORAGE_SYNC_PATCHED_FLAG = '__astrbotDesktopStorageSyncPatched';
152154
const LEGACY_TOKEN_SYNC_PATCHED_FLAG = '__astrbotDesktopTokenSyncPatched';
153155

@@ -697,6 +699,18 @@
697699
} catch {}
698700
};
699701

702+
const ensureDefaultChatTransportMode = () => {
703+
try {
704+
const storage = window.localStorage;
705+
if (!storage) return;
706+
if (storage.getItem(CHAT_TRANSPORT_MODE_STORAGE_KEY)) return;
707+
storage.setItem(
708+
CHAT_TRANSPORT_MODE_STORAGE_KEY,
709+
CHAT_TRANSPORT_MODE_WEBSOCKET,
710+
);
711+
} catch {}
712+
};
713+
700714
window.astrbotDesktop = {
701715
__tauriBridge: true,
702716
isDesktop: true,
@@ -740,6 +754,7 @@
740754
installNavigationBridges();
741755
void listenToTrayRestartBackendEvent();
742756
patchLocalStorageBridgeSync();
757+
ensureDefaultChatTransportMode();
743758
void syncAuthToken();
744759
void syncShellLocale();
745760
})();

0 commit comments

Comments
 (0)