feat(chat): add guest chat mode for unauthenticated users #667

Merged
jason.woltje merged 4 commits from feature/chat-guest-mode into main 2026-03-03 17:52:09 +00:00
Showing only changes of commit 1a6cf113c8 - Show all commits

View File

@@ -280,13 +280,16 @@ export function useChat(options: UseChatOptions = {}): UseChatReturn {
} }
// Streaming failed - check if auth error, try guest mode // Streaming failed - check if auth error, try guest mode
const isAuthError = err instanceof Error && const isAuthError =
(err.message.includes("403") || err.message.includes("401") || err instanceof Error &&
err.message.includes("auth") || err.message.includes("Forbidden")); (err.message.includes("403") ||
err.message.includes("401") ||
err.message.includes("auth") ||
err.message.includes("Forbidden"));
if (isAuthError) { if (isAuthError) {
console.warn("Auth failed, trying guest chat mode"); console.warn("Auth failed, trying guest chat mode");
// Try guest chat streaming // Try guest chat streaming
try { try {
await new Promise<void>((guestResolve, guestReject) => { await new Promise<void>((guestResolve, guestReject) => {