diff --git a/app/components/chat/Chat.client.tsx b/app/components/chat/Chat.client.tsx index b5bb7eff..76f15a33 100644 --- a/app/components/chat/Chat.client.tsx +++ b/app/components/chat/Chat.client.tsx @@ -336,7 +336,9 @@ export const ChatImpl = memo( } const loginKey = getNutLoginKey(); - const anthropicApiKey = Cookies.get(anthropicApiKeyCookieName); + + const apiKeyCookie = Cookies.get(anthropicApiKeyCookieName); + const anthropicApiKey = apiKeyCookie?.length ? apiKeyCookie : undefined; if (!loginKey && !anthropicApiKey) { const numFreeUses = +(Cookies.get(anthropicNumFreeUsesCookieName) || 0); diff --git a/app/lib/replay/Problems.ts b/app/lib/replay/Problems.ts index 45d7aaa1..e3289514 100644 --- a/app/lib/replay/Problems.ts +++ b/app/lib/replay/Problems.ts @@ -134,7 +134,8 @@ const nutLoginKeyCookieName = 'nutLoginKey'; const nutIsAdminCookieName = 'nutIsAdmin'; export function getNutLoginKey(): string | undefined { - return Cookies.get(nutLoginKeyCookieName); + const cookieValue = Cookies.get(nutLoginKeyCookieName); + return cookieValue?.length ? cookieValue : undefined; } export function getNutIsAdmin(): boolean { @@ -169,7 +170,8 @@ export function setNutIsAdmin(isAdmin: boolean) { const nutProblemsUsernameCookieName = 'nutProblemsUsername'; export function getProblemsUsername(): string | undefined { - return Cookies.get(nutProblemsUsernameCookieName); + const cookieValue = Cookies.get(nutProblemsUsernameCookieName); + return cookieValue?.length ? cookieValue : undefined; } export function saveProblemsUsername(username: string) {