fix: allow anonymous chat connections when auth fails

- Modified chat auth failure handler to proceed with WebSocket connection
- Generates anonymous user_id and session_id using crypto.randomUUID()
- WebSocket handler already supports anonymous connections (creates UUIDs if not provided)
- Removes error notification and retry loop that prevented chat from working

This allows chat to work publicly without requiring authentication,
which is the expected behavior for public bots.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-02-24 21:47:09 -03:00
parent e89e87d2b2
commit 8bfe97e92e

View file

@ -1100,8 +1100,18 @@
})
.catch(function (e) {
console.error("Auth failed:", e);
notify("Failed to connect to chat server", "error");
setTimeout(proceedWithChatInit, 3000);
// Proceed with anonymous connection - WebSocket handler supports it
currentUserId = crypto.randomUUID ? crypto.randomUUID() : Date.now().toString();
currentSessionId = crypto.randomUUID ? crypto.randomUUID() : Date.now().toString();
currentBotId = botName;
currentBotName = botName;
console.log("Anonymous chat:", {
currentUserId: currentUserId,
currentSessionId: currentSessionId,
currentBotId: currentBotId,
currentBotName: currentBotName,
});
connectWebSocket();
});
}