From a26551343cd59f7f00497b3945f3c731e828c7ac Mon Sep 17 00:00:00 2001
From: ZhenYi <434836402@qq.com>
Date: Sun, 26 Apr 2026 23:59:07 +0800
Subject: [PATCH] fix(frontend): refresh WS token after connection failures and
handle AI/repo events
Clear wsToken on auth-related close codes (3000-4999), connection
timeout, and after 3 consecutive reconnect failures so the next connect
attempt fetches a fresh token. Add onRoomAiUpdated and onRepoChanged
callbacks that re-fetch AI configs and repo list when pushed via WS.
Fix AI member list to never display raw UUID.
---
src/components/room/DiscordMemberList.tsx | 2 +-
src/contexts/room-context.tsx | 13 ++++++++++++
src/lib/room-ws-client.ts | 24 ++++++++++++++++++++++-
3 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/src/components/room/DiscordMemberList.tsx b/src/components/room/DiscordMemberList.tsx
index e4b98fb..ef983c2 100644
--- a/src/components/room/DiscordMemberList.tsx
+++ b/src/components/room/DiscordMemberList.tsx
@@ -171,7 +171,7 @@ export const DiscordMemberList = memo(function DiscordMemberList({
icon={}
>
{aiConfigs.map((ai) => {
- const label = ai.modelName ?? ai.model;
+ const label = ai.modelName || 'Unknown AI';
return (