diff --git a/.env b/.env index 0432d02162c..adc607bc23e 100644 --- a/.env +++ b/.env @@ -132,6 +132,7 @@ PARQUET_EXPORT_SECRET=#DEPRECATED, use ADMIN_API_SECRET instead RATE_LIMIT= # /!\ Legacy definition of messages per minute. Use USAGE_LIMITS.messagesPerMinute instead 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_GUEST_MESSAGE=# a message to the guest user. If not set, a default message will be used APP_BASE="" # base path of the app, e.g. /chat, left blank as default PUBLIC_APP_NAME=ChatUI # name used as title throughout the app diff --git a/chart/env/prod.yaml b/chart/env/prod.yaml index 4a126ab795e..a463e1f5944 100644 --- a/chart/env/prod.yaml +++ b/chart/env/prod.yaml @@ -285,6 +285,7 @@ envVars: PUBLIC_APP_COLOR: "yellow" PUBLIC_APP_DESCRIPTION: "Making the community's best AI chat models available to everyone." PUBLIC_APP_DISCLAIMER_MESSAGE: "Disclaimer: 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." + PUBLIC_APP_GUEST_MESSAGE: "You have reached the guest message limit, Sign In with a free Hugging Face account to continue using HuggingChat." PUBLIC_APP_DATA_SHARING: 0 PUBLIC_APP_DISCLAIMER: 1 PUBLIC_PLAUSIBLE_SCRIPT_URL: "/js/script.js" diff --git a/docs/source/configuration/models/providers/google.md b/docs/source/configuration/models/providers/google.md index f43c6335cd6..1d8dcd33f3b 100644 --- a/docs/source/configuration/models/providers/google.md +++ b/docs/source/configuration/models/providers/google.md @@ -33,8 +33,9 @@ MODELS=`[ "type": "vertex", "project": "abc-xyz", "location": "europe-west3", - "model": "gemini-1.5-pro-preview-0409", // model-name - + "extraBody": { + "model_version": "gemini-1.5-pro-002", + }, // Optional "safetyThreshold": "BLOCK_MEDIUM_AND_ABOVE", "apiEndpoint": "", // alternative api endpoint url, diff --git a/src/lib/components/LoginModal.svelte b/src/lib/components/LoginModal.svelte index 02afdf75ac2..a163cfbfa56 100644 --- a/src/lib/components/LoginModal.svelte +++ b/src/lib/components/LoginModal.svelte @@ -23,9 +23,7 @@ {envPublic.PUBLIC_APP_DESCRIPTION}

- You have reached the guest message limit, Sign In with a free Hugging Face account to continue using HuggingChat. + {envPublic.PUBLIC_APP_GUEST_MESSAGE}

; + export let model: Pick< + Model, + "name" | "datasetName" | "websiteUrl" | "modelUrl" | "datasetUrl" | "hasInferenceAPI" + >; export let variant: "light" | "dark" = "light"; @@ -35,6 +39,16 @@
 page
{/if} + {#if model.hasInferenceAPI} + + API + + {/if} {#if model.websiteUrl} + import { fade } from "svelte/transition"; + import { onDestroy } from "svelte"; + import IconChevron from "./icons/IconChevron.svelte"; + + export let scrollNode: HTMLElement; + export { className as class }; + + let visible = false; + let className = ""; + let observer: ResizeObserver | null = null; + + $: if (scrollNode) { + destroy(); + + if (window.ResizeObserver) { + observer = new ResizeObserver(() => { + updateVisibility(); + }); + observer.observe(scrollNode); + } + scrollNode.addEventListener("scroll", updateVisibility); + } + + function updateVisibility() { + if (!scrollNode) return; + visible = + Math.ceil(scrollNode.scrollTop) + 200 < scrollNode.scrollHeight - scrollNode.clientHeight && + scrollNode.scrollTop > 200; + } + + function scrollToPrevious() { + if (!scrollNode) return; + const messages = scrollNode.querySelectorAll('[id^="message-"]'); + const scrollTop = scrollNode.scrollTop; + let previousMessage: Element | null = null; + + for (let i = messages.length - 1; i >= 0; i--) { + const messageTop = + messages[i].getBoundingClientRect().top + + scrollTop - + scrollNode.getBoundingClientRect().top; + if (messageTop < scrollTop - 1) { + previousMessage = messages[i]; + break; + } + } + + if (previousMessage) { + previousMessage.scrollIntoView({ behavior: "smooth", block: "start" }); + } + } + + function destroy() { + observer?.disconnect(); + scrollNode?.removeEventListener("scroll", updateVisibility); + } + + onDestroy(destroy); + + +{#if visible} + +{/if} diff --git a/src/lib/components/chat/ChatInput.svelte b/src/lib/components/chat/ChatInput.svelte index 0751e2c0bdb..080b02a8e31 100644 --- a/src/lib/components/chat/ChatInput.svelte +++ b/src/lib/components/chat/ChatInput.svelte @@ -1,5 +1,5 @@ @@ -61,6 +61,14 @@ {/if} + {#if model.multimodal} +
+ +
+ {/if} {#if index === 0}
{/if} + + {#if model.hasInferenceAPI} + + + API Playground + + {/if} +