diff --git a/.env b/.env index 33f72ae6210..7bc706ad00c 100644 --- a/.env +++ b/.env @@ -60,10 +60,10 @@ PUBLIC_SHARE_PREFIX=#https://hf.co/chat PUBLIC_GOOGLE_ANALYTICS_ID=#G-XXXXXXXX / Leave empty to disable PUBLIC_DEPRECATED_GOOGLE_ANALYTICS_ID=#UA-XXXXXXXX-X / Leave empty to disable PUBLIC_ANNOUNCEMENT_BANNERS=`[ - { - "title": "Llama v2 is live on HuggingChat! 🦙", - "linkTitle": "Announcement", - "linkHref": "https://huggingface.co/blog/llama2" + { + "title": "Chat UI is now open sourced on GitHub", + "linkTitle": "GitHub repo", + "linkHref": "https://github.com/huggingface/chat-ui" } ]` @@ -72,7 +72,6 @@ PARQUET_EXPORT_HF_TOKEN= PARQUET_EXPORT_SECRET= RATE_LIMIT= # requests per minute -MESSAGES_BEFORE_LOGIN=# how many messages a user can send in a conversation before having to login. set to 0 to force login right away PUBLIC_APP_NAME=ChatUI # name used as title throughout the app PUBLIC_APP_ASSETS=chatui # used to find logos & favicons in static/$PUBLIC_APP_ASSETS diff --git a/src/hooks.server.ts b/src/hooks.server.ts index 03b9b016571..37822386660 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -1,4 +1,4 @@ -import { COOKIE_NAME, MESSAGES_BEFORE_LOGIN } from "$env/static/private"; +import { COOKIE_NAME } from "$env/static/private"; import type { Handle } from "@sveltejs/kit"; import { PUBLIC_GOOGLE_ANALYTICS_ID, @@ -64,7 +64,7 @@ export const handle: Handle = async ({ event, resolve }) => { !event.url.pathname.startsWith(`${base}/admin`) && !["GET", "OPTIONS", "HEAD"].includes(event.request.method) ) { - if (!user && requiresUser && !((parseInt(MESSAGES_BEFORE_LOGIN) || 0) > 0)) { + if (!user && requiresUser) { return errorResponse(401, ERROR_MESSAGES.authOnly); } diff --git a/src/lib/components/LoginModal.svelte b/src/lib/components/LoginModal.svelte index 7065940e8dd..79a6a30ab45 100644 --- a/src/lib/components/LoginModal.svelte +++ b/src/lib/components/LoginModal.svelte @@ -25,14 +25,11 @@ v{PUBLIC_VERSION} -

- Please Sign in with Hugging Face to continue +

+ This application is for demonstration purposes only.

- Disclaimer: AI is an area of active research with known problems such as biased generation and + AI is an area of active research with known problems such as biased generation and misinformation. Do not use this application for high-stakes decisions or advice.

{#if PUBLIC_APP_DATA_SHARING} @@ -57,6 +54,7 @@ with Hugging Face {/if} +

to start chatting right away

{:else} {#each Object.entries(settings) as [key, val]} diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts index 55f89eb2909..373136fe663 100644 --- a/src/routes/+layout.server.ts +++ b/src/routes/+layout.server.ts @@ -6,7 +6,7 @@ import { UrlDependency } from "$lib/types/UrlDependency"; import { defaultModel, models, oldModels, validateModel } from "$lib/server/models"; import { authCondition, requiresUser } from "$lib/server/auth"; import { DEFAULT_SETTINGS } from "$lib/types/Settings"; -import { SERPAPI_KEY, SERPER_API_KEY, MESSAGES_BEFORE_LOGIN } from "$env/static/private"; +import { SERPAPI_KEY, SERPER_API_KEY } from "$env/static/private"; export const load: LayoutServerLoad = async ({ locals, depends, url }) => { const { conversations } = collections; @@ -82,6 +82,5 @@ export const load: LayoutServerLoad = async ({ locals, depends, url }) => { email: locals.user.email, }, requiresLogin: requiresUser, - messagesBeforeLogin: parseInt(MESSAGES_BEFORE_LOGIN ?? 0), }; }; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 8e37e5515ae..aee567b08e2 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -178,7 +178,7 @@ {#if isSettingsOpen} (isSettingsOpen = false)} settings={data.settings} /> {/if} - {#if requiresLogin && data.messagesBeforeLogin === 0} + {#if requiresLogin} {/if} diff --git a/src/routes/conversation/[id]/+page.svelte b/src/routes/conversation/[id]/+page.svelte index 509d8b43b9f..9390f3a33e8 100644 --- a/src/routes/conversation/[id]/+page.svelte +++ b/src/routes/conversation/[id]/+page.svelte @@ -16,7 +16,6 @@ import type { WebSearchMessage } from "$lib/types/WebSearch"; import type { Message } from "$lib/types/Message"; import { browser } from "$app/environment"; - import { PUBLIC_APP_DISCLAIMER } from "$env/static/public"; export let data; @@ -280,8 +279,4 @@ models={data.models} currentModel={findCurrentModel([...data.models, ...data.oldModels], data.model)} settings={data.settings} - loginRequired={(data.requiresLogin - ? !data.user - : !data.settings.ethicsModalAcceptedAt && !!PUBLIC_APP_DISCLAIMER) && - data.messages.length > data.messagesBeforeLogin} />