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:
parent
e89e87d2b2
commit
8bfe97e92e
1 changed files with 12 additions and 2 deletions
|
|
@ -1100,8 +1100,18 @@
|
||||||
})
|
})
|
||||||
.catch(function (e) {
|
.catch(function (e) {
|
||||||
console.error("Auth failed:", e);
|
console.error("Auth failed:", e);
|
||||||
notify("Failed to connect to chat server", "error");
|
// Proceed with anonymous connection - WebSocket handler supports it
|
||||||
setTimeout(proceedWithChatInit, 3000);
|
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();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue