diff --git a/package-lock.json b/package-lock.json index f11493188..074ff21c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -69,6 +69,7 @@ "@sveltejs/adapter-static": "^3.0.2", "@sveltejs/kit": "^2.5.20", "@sveltejs/vite-plugin-svelte": "^3.1.1", + "@tailwindcss/container-queries": "^0.1.1", "@tailwindcss/typography": "^0.5.13", "@typescript-eslint/eslint-plugin": "^6.17.0", "@typescript-eslint/parser": "^6.17.0", @@ -2343,6 +2344,16 @@ "tslib": "^2.4.0" } }, + "node_modules/@tailwindcss/container-queries": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@tailwindcss/container-queries/-/container-queries-0.1.1.tgz", + "integrity": "sha512-p18dswChx6WnTSaJCSGx6lTmrGzNNvm2FtXmiO6AuA1V4U5REyoqwmT6kgAsIMdjo07QdAfYXHJ4hnMtfHzWgA==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "tailwindcss": ">=3.2.0" + } + }, "node_modules/@tailwindcss/typography": { "version": "0.5.13", "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.13.tgz", diff --git a/package.json b/package.json index 4f559d8a2..d2c4795c6 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "@sveltejs/adapter-static": "^3.0.2", "@sveltejs/kit": "^2.5.20", "@sveltejs/vite-plugin-svelte": "^3.1.1", + "@tailwindcss/container-queries": "^0.1.1", "@tailwindcss/typography": "^0.5.13", "@typescript-eslint/eslint-plugin": "^6.17.0", "@typescript-eslint/parser": "^6.17.0", diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index ebb6126d1..cc14f2c6f 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -1940,7 +1940,7 @@ </div> {/if} - <div class="flex flex-col flex-auto z-10 w-full"> + <div class="flex flex-col flex-auto z-10 w-full @container"> {#if $settings?.landingPageMode === 'chat' || createMessagesList(history, history.currentId).length > 0} <div class=" pb-2.5 flex flex-col justify-between w-full flex-auto overflow-auto h-0 max-w-full z-10 scrollbar-hidden" diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index 6f438a68e..dc2fe32e7 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -1075,8 +1075,8 @@ {/if} </div> - <div class=" flex justify-between mt-1.5 mb-2.5 mx-0.5"> - <div class="ml-1 self-end gap-0.5 flex items-center"> + <div class=" flex justify-between mt-1.5 mb-2.5 mx-0.5 max-w-full"> + <div class="ml-1 self-end gap-0.5 flex items-center flex-1 max-w-[80%]"> <InputMenu bind:selectedToolIds {screenCaptureHandler} @@ -1129,67 +1129,69 @@ </button> </InputMenu> - {#if $_user} - {#if $config?.features?.enable_web_search && ($_user.role === 'admin' || $_user?.permissions?.features?.web_search)} - <Tooltip content={$i18n.t('Search the internet')} placement="top"> - <button - on:click|preventDefault={() => (webSearchEnabled = !webSearchEnabled)} - type="button" - class="px-1.5 sm:px-2.5 py-1.5 flex gap-1.5 items-center text-sm rounded-full font-medium transition-colors duration-300 focus:outline-none max-w-full overflow-hidden {webSearchEnabled || - ($settings?.webSearch ?? false) === 'always' - ? 'bg-blue-100 dark:bg-blue-500/20 text-blue-500 dark:text-blue-400' - : 'bg-transparent text-gray-600 dark:text-gray-400 border-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800'}" - > - <GlobeAlt className="size-5" strokeWidth="1.75" /> - <span - class="hidden sm:block whitespace-nowrap overflow-hidden text-ellipsis translate-y-[0.5px] mr-0.5" - >{$i18n.t('Web Search')}</span + <div class="flex gap-0.5 items-center overflow-x-auto scrollbar-none flex-1"> + {#if $_user} + {#if $config?.features?.enable_web_search && ($_user.role === 'admin' || $_user?.permissions?.features?.web_search)} + <Tooltip content={$i18n.t('Search the internet')} placement="top"> + <button + on:click|preventDefault={() => (webSearchEnabled = !webSearchEnabled)} + type="button" + class="px-1.5 @sm:px-2.5 py-1.5 flex gap-1.5 items-center text-sm rounded-full font-medium transition-colors duration-300 focus:outline-none max-w-full overflow-hidden {webSearchEnabled || + ($settings?.webSearch ?? false) === 'always' + ? 'bg-blue-100 dark:bg-blue-500/20 text-blue-500 dark:text-blue-400' + : 'bg-transparent text-gray-600 dark:text-gray-400 border-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800'}" > - </button> - </Tooltip> - {/if} + <GlobeAlt className="size-5" strokeWidth="1.75" /> + <span + class="hidden @sm:block whitespace-nowrap overflow-hidden text-ellipsis translate-y-[0.5px] mr-0.5" + >{$i18n.t('Web Search')}</span + > + </button> + </Tooltip> + {/if} - {#if $config?.features?.enable_image_generation && ($_user.role === 'admin' || $_user?.permissions?.features?.image_generation)} - <Tooltip content={$i18n.t('Generate an image')} placement="top"> - <button - on:click|preventDefault={() => - (imageGenerationEnabled = !imageGenerationEnabled)} - type="button" - class="px-1.5 sm:px-2.5 py-1.5 flex gap-1.5 items-center text-sm rounded-full font-medium transition-colors duration-300 focus:outline-none max-w-full overflow-hidden {imageGenerationEnabled - ? 'bg-gray-100 dark:bg-gray-500/20 text-gray-600 dark:text-gray-400' - : 'bg-transparent text-gray-600 dark:text-gray-300 border-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 '}" - > - <Photo className="size-5" strokeWidth="1.75" /> - <span - class="hidden sm:block whitespace-nowrap overflow-hidden text-ellipsis translate-y-[0.5px] mr-0.5" - >{$i18n.t('Image')}</span + {#if $config?.features?.enable_image_generation && ($_user.role === 'admin' || $_user?.permissions?.features?.image_generation)} + <Tooltip content={$i18n.t('Generate an image')} placement="top"> + <button + on:click|preventDefault={() => + (imageGenerationEnabled = !imageGenerationEnabled)} + type="button" + class="px-1.5 @sm:px-2.5 py-1.5 flex gap-1.5 items-center text-sm rounded-full font-medium transition-colors duration-300 focus:outline-none max-w-full overflow-hidden {imageGenerationEnabled + ? 'bg-gray-100 dark:bg-gray-500/20 text-gray-600 dark:text-gray-400' + : 'bg-transparent text-gray-600 dark:text-gray-300 border-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 '}" > - </button> - </Tooltip> - {/if} + <Photo className="size-5" strokeWidth="1.75" /> + <span + class="hidden @sm:block whitespace-nowrap overflow-hidden text-ellipsis translate-y-[0.5px] mr-0.5" + >{$i18n.t('Image')}</span + > + </button> + </Tooltip> + {/if} - {#if $_user.role === 'admin' || $_user?.permissions?.features?.code_interpreter} - <Tooltip content={$i18n.t('Execute code for analysis')} placement="top"> - <button - on:click|preventDefault={() => - (codeInterpreterEnabled = !codeInterpreterEnabled)} - type="button" - class="px-1.5 sm:px-2.5 py-1.5 flex gap-1.5 items-center text-sm rounded-full font-medium transition-colors duration-300 focus:outline-none max-w-full overflow-hidden {codeInterpreterEnabled - ? 'bg-gray-100 dark:bg-gray-500/20 text-gray-600 dark:text-gray-400' - : 'bg-transparent text-gray-600 dark:text-gray-300 border-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 '}" - > - <CommandLine className="size-5" strokeWidth="1.75" /> - <span - class="hidden sm:block whitespace-nowrap overflow-hidden text-ellipsis translate-y-[0.5px] mr-0.5" - >{$i18n.t('Code Interpreter')}</span + {#if $_user.role === 'admin' || $_user?.permissions?.features?.code_interpreter} + <Tooltip content={$i18n.t('Execute code for analysis')} placement="top"> + <button + on:click|preventDefault={() => + (codeInterpreterEnabled = !codeInterpreterEnabled)} + type="button" + class="px-1.5 @sm:px-2.5 py-1.5 flex gap-1.5 items-center text-sm rounded-full font-medium transition-colors duration-300 focus:outline-none max-w-full overflow-hidden {codeInterpreterEnabled + ? 'bg-gray-100 dark:bg-gray-500/20 text-gray-600 dark:text-gray-400' + : 'bg-transparent text-gray-600 dark:text-gray-300 border-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 '}" > - </button> - </Tooltip> + <CommandLine className="size-5" strokeWidth="1.75" /> + <span + class="hidden @sm:block whitespace-nowrap overflow-hidden text-ellipsis translate-y-[0.5px] mr-0.5" + >{$i18n.t('Code Interpreter')}</span + > + </button> + </Tooltip> + {/if} {/if} - {/if} + </div> </div> - <div class="self-end flex space-x-1 mr-1"> + <div class="self-end flex space-x-1 mr-1 flex-shrink-0"> {#if !history?.currentId || history.messages[history.currentId]?.done == true} <Tooltip content={$i18n.t('Record voice')}> <button diff --git a/src/lib/components/chat/Placeholder.svelte b/src/lib/components/chat/Placeholder.svelte index 756f7099f..94a93b240 100644 --- a/src/lib/components/chat/Placeholder.svelte +++ b/src/lib/components/chat/Placeholder.svelte @@ -88,7 +88,7 @@ onMount(() => {}); </script> -<div class="m-auto w-full max-w-6xl px-2 xl:px-20 translate-y-6 py-24 text-center"> +<div class="m-auto w-full max-w-6xl px-2 @xl:px-20 translate-y-6 py-24 text-center"> {#if $temporaryChatEnabled} <Tooltip content="This chat won't appear in history and your messages will not be saved." @@ -105,7 +105,7 @@ class="w-full text-3xl text-gray-800 dark:text-gray-100 font-medium text-center flex items-center gap-4 font-primary" > <div class="w-full flex flex-col justify-center items-center"> - <div class="flex flex-row justify-center gap-3 sm:gap-3.5 w-fit px-5"> + <div class="flex flex-row justify-center gap-3 @sm:gap-3.5 w-fit px-5"> <div class="flex flex-shrink-0 justify-center"> <div class="flex -space-x-4 mb-0.5" in:fade={{ duration: 100 }}> {#each models as model, modelIdx} @@ -126,7 +126,7 @@ ($i18n.language === 'dg-DG' ? `/doge.png` : `${WEBUI_BASE_URL}/static/favicon.png`)} - class=" size-9 sm:size-10 rounded-full border-[1px] border-gray-200 dark:border-none" + class=" size-9 @sm:size-10 rounded-full border-[1px] border-gray-200 dark:border-none" alt="logo" draggable="false" /> @@ -136,7 +136,7 @@ </div> </div> - <div class=" text-3xl sm:text-4xl line-clamp-1" in:fade={{ duration: 100 }}> + <div class=" text-3xl @sm:text-4xl line-clamp-1" in:fade={{ duration: 100 }}> {#if models[selectedModelIdx]?.name} {models[selectedModelIdx]?.name} {:else} @@ -185,7 +185,7 @@ </div> <div - class="text-base font-normal xl:translate-x-6 md:max-w-3xl w-full py-3 {atSelectedModel + class="text-base font-normal @xl:translate-x-6 @md:max-w-3xl w-full py-3 {atSelectedModel ? 'mt-2' : ''}" > diff --git a/tailwind.config.js b/tailwind.config.js index 937c0ab56..60782b5a4 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,4 +1,5 @@ import typography from '@tailwindcss/typography'; +import containerQuries from '@tailwindcss/container-queries'; /** @type {import('tailwindcss').Config} */ export default { @@ -38,5 +39,5 @@ export default { } } }, - plugins: [typography] + plugins: [typography, containerQuries] };