Unverified Commit 099b1d06 authored by Jannik S's avatar Jannik S Committed by GitHub
Browse files

Revert "Merge Updates & Dockerfile improvements" (#3)

This reverts commit 9763d885.
parent 9763d885
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import fileSaver from 'file-saver'; import fileSaver from 'file-saver';
const { saveAs } = fileSaver; const { saveAs } = fileSaver;
import { onMount, getContext } from 'svelte'; import { onMount } from 'svelte';
import { WEBUI_NAME, modelfiles, settings, user } from '$lib/stores'; import { WEBUI_NAME, modelfiles, settings, user } from '$lib/stores';
import { createModel, deleteModel } from '$lib/apis/ollama'; import { createModel, deleteModel } from '$lib/apis/ollama';
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
} from '$lib/apis/modelfiles'; } from '$lib/apis/modelfiles';
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
const i18n = getContext('i18n');
let localModelfiles = []; let localModelfiles = [];
let importFiles; let importFiles;
let modelfilesImportInputElement: HTMLInputElement; let modelfilesImportInputElement: HTMLInputElement;
...@@ -28,7 +26,7 @@ ...@@ -28,7 +26,7 @@
}); });
if (success) { if (success) {
toast.success($i18n.t(`Deleted {tagName}`, { tagName })); toast.success(`Deleted ${tagName}`);
} }
return success; return success;
...@@ -41,7 +39,7 @@ ...@@ -41,7 +39,7 @@
}; };
const shareModelfile = async (modelfile) => { const shareModelfile = async (modelfile) => {
toast.success($i18n.t('Redirecting you to OpenWebUI Community')); toast.success('Redirecting you to OpenWebUI Community');
const url = 'https://openwebui.com'; const url = 'https://openwebui.com';
...@@ -76,14 +74,14 @@ ...@@ -76,14 +74,14 @@
<svelte:head> <svelte:head>
<title> <title>
{$i18n.t('Modelfiles')} | {$WEBUI_NAME} {`Modelfiles | ${$WEBUI_NAME}`}
</title> </title>
</svelte:head> </svelte:head>
<div class="min-h-screen max-h-[100dvh] w-full flex justify-center dark:text-white"> <div class="min-h-screen max-h-[100dvh] w-full flex justify-center dark:text-white">
<div class="flex flex-col justify-between w-full overflow-y-auto"> <div class="flex flex-col justify-between w-full overflow-y-auto">
<div class="max-w-2xl mx-auto w-full px-3 md:px-0 my-10"> <div class="max-w-2xl mx-auto w-full px-3 md:px-0 my-10">
<div class=" text-2xl font-semibold mb-3">{$i18n.t('My Modelfiles')}</div> <div class=" text-2xl font-semibold mb-3">My Modelfiles</div>
<a class=" flex space-x-4 cursor-pointer w-full mb-2 px-3 py-2" href="/modelfiles/create"> <a class=" flex space-x-4 cursor-pointer w-full mb-2 px-3 py-2" href="/modelfiles/create">
<div class=" self-center w-10"> <div class=" self-center w-10">
...@@ -106,8 +104,8 @@ ...@@ -106,8 +104,8 @@
</div> </div>
<div class=" self-center"> <div class=" self-center">
<div class=" font-bold">{$i18n.t('Create a modelfile')}</div> <div class=" font-bold">Create a modelfile</div>
<div class=" text-sm">{$i18n.t('Customize Ollama models for a specific purpose')}</div> <div class=" text-sm">Customize Ollama models for a specific purpose</div>
</div> </div>
</a> </a>
...@@ -272,7 +270,7 @@ ...@@ -272,7 +270,7 @@
modelfilesImportInputElement.click(); modelfilesImportInputElement.click();
}} }}
> >
<div class=" self-center mr-2 font-medium">{$i18n.t('Import Modelfiles')}</div> <div class=" self-center mr-2 font-medium">Import Modelfiles</div>
<div class=" self-center"> <div class=" self-center">
<svg <svg
...@@ -296,7 +294,7 @@ ...@@ -296,7 +294,7 @@
saveModelfiles($modelfiles); saveModelfiles($modelfiles);
}} }}
> >
<div class=" self-center mr-2 font-medium">{$i18n.t('Export Modelfiles')}</div> <div class=" self-center mr-2 font-medium">Export Modelfiles</div>
<div class=" self-center"> <div class=" self-center">
<svg <svg
...@@ -337,7 +335,7 @@ ...@@ -337,7 +335,7 @@
await modelfiles.set(await getModelfiles(localStorage.token)); await modelfiles.set(await getModelfiles(localStorage.token));
}} }}
> >
<div class=" self-center mr-2 font-medium">{$i18n.t('Sync All')}</div> <div class=" self-center mr-2 font-medium">Sync All</div>
<div class=" self-center"> <div class=" self-center">
<svg <svg
...@@ -388,7 +386,7 @@ ...@@ -388,7 +386,7 @@
</div> </div>
<div class=" my-16"> <div class=" my-16">
<div class=" text-2xl font-semibold mb-3">{$i18n.t('Made by OpenWebUI Community')}</div> <div class=" text-2xl font-semibold mb-3">Made by OpenWebUI Community</div>
<a <a
class=" flex space-x-4 cursor-pointer w-full mb-2 px-3 py-2" class=" flex space-x-4 cursor-pointer w-full mb-2 px-3 py-2"
...@@ -415,8 +413,8 @@ ...@@ -415,8 +413,8 @@
</div> </div>
<div class=" self-center"> <div class=" self-center">
<div class=" font-bold">{$i18n.t('Discover a modelfile')}</div> <div class=" font-bold">Discover a modelfile</div>
<div class=" text-sm">{$i18n.t('Discover, download, and explore model presets')}</div> <div class=" text-sm">Discover, download, and explore model presets</div>
</div> </div>
</a> </a>
</div> </div>
......
...@@ -6,12 +6,10 @@ ...@@ -6,12 +6,10 @@
import AdvancedParams from '$lib/components/chat/Settings/Advanced/AdvancedParams.svelte'; import AdvancedParams from '$lib/components/chat/Settings/Advanced/AdvancedParams.svelte';
import { splitStream } from '$lib/utils'; import { splitStream } from '$lib/utils';
import { onMount, tick, getContext } from 'svelte'; import { onMount, tick } from 'svelte';
import { createModel } from '$lib/apis/ollama'; import { createModel } from '$lib/apis/ollama';
import { createNewModelfile, getModelfileByTagName, getModelfiles } from '$lib/apis/modelfiles'; import { createNewModelfile, getModelfileByTagName, getModelfiles } from '$lib/apis/modelfiles';
const i18n = getContext('i18n');
let loading = false; let loading = false;
let filesInputElement; let filesInputElement;
...@@ -351,7 +349,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -351,7 +349,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
}} }}
/> />
<div class=" text-2xl font-semibold mb-6">{$i18n.t('My Modelfiles')}</div> <div class=" text-2xl font-semibold mb-6">My Modelfiles</div>
<button <button
class="flex space-x-1" class="flex space-x-1"
...@@ -373,7 +371,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -373,7 +371,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
/> />
</svg> </svg>
</div> </div>
<div class=" self-center font-medium text-sm">{$i18n.t('Back')}</div> <div class=" self-center font-medium text-sm">Back</div>
</button> </button>
<hr class="my-3 dark:border-gray-700" /> <hr class="my-3 dark:border-gray-700" />
...@@ -420,12 +418,12 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -420,12 +418,12 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
<div class="my-2 flex space-x-2"> <div class="my-2 flex space-x-2">
<div class="flex-1"> <div class="flex-1">
<div class=" text-sm font-semibold mb-2">{$i18n.t('Name')}*</div> <div class=" text-sm font-semibold mb-2">Name*</div>
<div> <div>
<input <input
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg" class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
placeholder={$i18n.t('Name your modelfile')} placeholder="Name your modelfile"
bind:value={title} bind:value={title}
required required
/> />
...@@ -433,12 +431,12 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -433,12 +431,12 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div> </div>
<div class="flex-1"> <div class="flex-1">
<div class=" text-sm font-semibold mb-2">{$i18n.t('Model Tag Name')}*</div> <div class=" text-sm font-semibold mb-2">Model Tag Name*</div>
<div> <div>
<input <input
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg" class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
placeholder={$i18n.t('Add a model tag name')} placeholder="Add a model tag name"
bind:value={tagName} bind:value={tagName}
required required
/> />
...@@ -447,12 +445,12 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -447,12 +445,12 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div> </div>
<div class="my-2"> <div class="my-2">
<div class=" text-sm font-semibold mb-2">{$i18n.t('Description')}*</div> <div class=" text-sm font-semibold mb-2">Description*</div>
<div> <div>
<input <input
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg" class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
placeholder={$i18n.t('Add a short description about what this modelfile does')} placeholder="Add a short description about what this modelfile does"
bind:value={desc} bind:value={desc}
required required
/> />
...@@ -461,7 +459,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -461,7 +459,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
<div class="my-2"> <div class="my-2">
<div class="flex w-full justify-between"> <div class="flex w-full justify-between">
<div class=" self-center text-sm font-semibold">{$i18n.t('Modelfile')}</div> <div class=" self-center text-sm font-semibold">Modelfile</div>
<button <button
class="p-1 px-3 text-xs flex rounded transition" class="p-1 px-3 text-xs flex rounded transition"
...@@ -471,9 +469,9 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -471,9 +469,9 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
}} }}
> >
{#if raw} {#if raw}
<span class="ml-2 self-center"> {$i18n.t('Raw Format')} </span> <span class="ml-2 self-center"> Raw Format </span>
{:else} {:else}
<span class="ml-2 self-center"> {$i18n.t('Builder Mode')} </span> <span class="ml-2 self-center"> Builder Mode </span>
{/if} {/if}
</button> </button>
</div> </div>
...@@ -482,7 +480,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -482,7 +480,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
{#if raw} {#if raw}
<div class="mt-2"> <div class="mt-2">
<div class=" text-xs font-semibold mb-2">{$i18n.t('Content')}*</div> <div class=" text-xs font-semibold mb-2">Content*</div>
<div> <div>
<textarea <textarea
...@@ -495,13 +493,12 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -495,13 +493,12 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div> </div>
<div class="text-xs text-gray-400 dark:text-gray-500"> <div class="text-xs text-gray-400 dark:text-gray-500">
{$i18n.t('Not sure what to write? Switch to')} Not sure what to write? Switch to <button
<button
class="text-gray-500 dark:text-gray-300 font-medium cursor-pointer" class="text-gray-500 dark:text-gray-300 font-medium cursor-pointer"
type="button" type="button"
on:click={() => { on:click={() => {
raw = !raw; raw = !raw;
}}>{$i18n.t('Builder Mode')}</button }}>Builder Mode</button
> >
or or
<a <a
...@@ -509,13 +506,13 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -509,13 +506,13 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
href="https://openwebui.com" href="https://openwebui.com"
target="_blank" target="_blank"
> >
{$i18n.t('Click here to check other modelfiles.')} Click here to check other modelfiles.
</a> </a>
</div> </div>
</div> </div>
{:else} {:else}
<div class="my-2"> <div class="my-2">
<div class=" text-xs font-semibold mb-2">{$i18n.t('From (Base Model)')}*</div> <div class=" text-xs font-semibold mb-2">From (Base Model)*</div>
<div> <div>
<input <input
...@@ -527,17 +524,16 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -527,17 +524,16 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div> </div>
<div class="mt-1 text-xs text-gray-400 dark:text-gray-500"> <div class="mt-1 text-xs text-gray-400 dark:text-gray-500">
{$i18n.t('To access the available model names for downloading,')} To access the available model names for downloading, <a
<a
class=" text-gray-500 dark:text-gray-300 font-medium" class=" text-gray-500 dark:text-gray-300 font-medium"
href="https://ollama.com/library" href="https://ollama.com/library"
target="_blank">{$i18n.t('click here.')}</a target="_blank">click here.</a
> >
</div> </div>
</div> </div>
<div class="my-1"> <div class="my-1">
<div class=" text-xs font-semibold mb-2">{$i18n.t('System Prompt')}</div> <div class=" text-xs font-semibold mb-2">System Prompt</div>
<div> <div>
<textarea <textarea
...@@ -550,9 +546,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -550,9 +546,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div> </div>
<div class="flex w-full justify-between"> <div class="flex w-full justify-between">
<div class=" self-center text-sm font-semibold"> <div class=" self-center text-sm font-semibold">Modelfile Advanced Settings</div>
{$i18n.t('Modelfile Advanced Settings')}
</div>
<button <button
class="p-1 px-3 text-xs flex rounded transition" class="p-1 px-3 text-xs flex rounded transition"
...@@ -562,16 +556,16 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -562,16 +556,16 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
}} }}
> >
{#if advanced} {#if advanced}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span> <span class="ml-2 self-center"> Custom </span>
{:else} {:else}
<span class="ml-2 self-center">{$i18n.t('Default')}</span> <span class="ml-2 self-center"> Default </span>
{/if} {/if}
</button> </button>
</div> </div>
{#if advanced} {#if advanced}
<div class="my-2"> <div class="my-2">
<div class=" text-xs font-semibold mb-2">{$i18n.t('Template')}</div> <div class=" text-xs font-semibold mb-2">Template</div>
<div> <div>
<textarea <textarea
...@@ -584,7 +578,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -584,7 +578,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div> </div>
<div class="my-2"> <div class="my-2">
<div class=" text-xs font-semibold mb-2">{$i18n.t('Parameters')}</div> <div class=" text-xs font-semibold mb-2">Parameters</div>
<div> <div>
<AdvancedParams bind:options /> <AdvancedParams bind:options />
...@@ -596,7 +590,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -596,7 +590,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
<div class="my-2"> <div class="my-2">
<div class="flex w-full justify-between mb-2"> <div class="flex w-full justify-between mb-2">
<div class=" self-center text-sm font-semibold">{$i18n.t('Prompt suggestions')}</div> <div class=" self-center text-sm font-semibold">Prompt suggestions</div>
<button <button
class="p-1 px-3 text-xs flex rounded transition" class="p-1 px-3 text-xs flex rounded transition"
...@@ -624,7 +618,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -624,7 +618,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
<div class=" flex border dark:border-gray-600 rounded-lg"> <div class=" flex border dark:border-gray-600 rounded-lg">
<input <input
class="px-3 py-1.5 text-sm w-full bg-transparent outline-none border-r dark:border-gray-600" class="px-3 py-1.5 text-sm w-full bg-transparent outline-none border-r dark:border-gray-600"
placeholder={$i18n.t('Write a prompt suggestion (e.g. Who are you?)')} placeholder="Write a prompt suggestion (e.g. Who are you?)"
bind:value={prompt.content} bind:value={prompt.content}
/> />
...@@ -653,7 +647,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -653,7 +647,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div> </div>
<div class="my-2"> <div class="my-2">
<div class=" text-sm font-semibold mb-2">{$i18n.t('Categories')}</div> <div class=" text-sm font-semibold mb-2">Categories</div>
<div class="grid grid-cols-4"> <div class="grid grid-cols-4">
{#each Object.keys(categories) as category} {#each Object.keys(categories) as category}
...@@ -667,7 +661,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -667,7 +661,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
{#if pullProgress !== null} {#if pullProgress !== null}
<div class="my-2"> <div class="my-2">
<div class=" text-sm font-semibold mb-2">{$i18n.t('Pull Progress')}</div> <div class=" text-sm font-semibold mb-2">Pull Progress</div>
<div class="w-full rounded-full dark:bg-gray-800"> <div class="w-full rounded-full dark:bg-gray-800">
<div <div
class="dark:bg-gray-600 bg-gray-500 text-xs font-medium text-gray-100 text-center p-0.5 leading-none rounded-full" class="dark:bg-gray-600 bg-gray-500 text-xs font-medium text-gray-100 text-center p-0.5 leading-none rounded-full"
...@@ -690,7 +684,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); ...@@ -690,7 +684,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
type="submit" type="submit"
disabled={loading} disabled={loading}
> >
<div class=" self-center font-medium">{$i18n.t('Save & Create')}</div> <div class=" self-center font-medium">Save & Create</div>
{#if loading} {#if loading}
<div class="ml-1.5 self-center"> <div class="ml-1.5 self-center">
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import { toast } from 'svelte-sonner'; import { toast } from 'svelte-sonner';
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { onMount, getContext } from 'svelte'; import { onMount } from 'svelte';
import { page } from '$app/stores'; import { page } from '$app/stores';
import { settings, user, config, modelfiles } from '$lib/stores'; import { settings, user, config, modelfiles } from '$lib/stores';
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
import AdvancedParams from '$lib/components/chat/Settings/Advanced/AdvancedParams.svelte'; import AdvancedParams from '$lib/components/chat/Settings/Advanced/AdvancedParams.svelte';
const i18n = getContext('i18n');
let loading = false; let loading = false;
let filesInputElement; let filesInputElement;
...@@ -250,7 +248,7 @@ ...@@ -250,7 +248,7 @@
}} }}
/> />
<div class=" text-2xl font-semibold mb-6">{$i18n.t('My Modelfiles')}</div> <div class=" text-2xl font-semibold mb-6">My Modelfiles</div>
<button <button
class="flex space-x-1" class="flex space-x-1"
...@@ -272,7 +270,7 @@ ...@@ -272,7 +270,7 @@
/> />
</svg> </svg>
</div> </div>
<div class=" self-center font-medium text-sm">{$i18n.t('Back')}</div> <div class=" self-center font-medium text-sm">Back</div>
</button> </button>
<hr class="my-3 dark:border-gray-700" /> <hr class="my-3 dark:border-gray-700" />
...@@ -319,12 +317,12 @@ ...@@ -319,12 +317,12 @@
<div class="my-2 flex space-x-2"> <div class="my-2 flex space-x-2">
<div class="flex-1"> <div class="flex-1">
<div class=" text-sm font-semibold mb-2">{$i18n.t('Name')}*</div> <div class=" text-sm font-semibold mb-2">Name*</div>
<div> <div>
<input <input
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg" class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
placeholder={$i18n.t('Name your modelfile')} placeholder="Name your modelfile"
bind:value={title} bind:value={title}
required required
/> />
...@@ -332,12 +330,12 @@ ...@@ -332,12 +330,12 @@
</div> </div>
<div class="flex-1"> <div class="flex-1">
<div class=" text-sm font-semibold mb-2">{$i18n.t('Model Tag Name')}*</div> <div class=" text-sm font-semibold mb-2">Model Tag Name*</div>
<div> <div>
<input <input
class="px-3 py-1.5 text-sm w-full bg-transparent disabled:text-gray-500 border dark:border-gray-600 outline-none rounded-lg" class="px-3 py-1.5 text-sm w-full bg-transparent disabled:text-gray-500 border dark:border-gray-600 outline-none rounded-lg"
placeholder={$i18n.t('Add a model tag name')} placeholder="Add a model tag name"
value={tagName} value={tagName}
disabled disabled
required required
...@@ -347,12 +345,12 @@ ...@@ -347,12 +345,12 @@
</div> </div>
<div class="my-2"> <div class="my-2">
<div class=" text-sm font-semibold mb-2">{$i18n.t('Description')}*</div> <div class=" text-sm font-semibold mb-2">Description*</div>
<div> <div>
<input <input
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg" class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
placeholder={$i18n.t('Add a short description about what this modelfile does')} placeholder="Add a short description about what this modelfile does"
bind:value={desc} bind:value={desc}
required required
/> />
...@@ -361,13 +359,13 @@ ...@@ -361,13 +359,13 @@
<div class="my-2"> <div class="my-2">
<div class="flex w-full justify-between"> <div class="flex w-full justify-between">
<div class=" self-center text-sm font-semibold">{$i18n.t('Modelfile')}</div> <div class=" self-center text-sm font-semibold">Modelfile</div>
</div> </div>
<!-- <div class=" text-sm font-semibold mb-2"></div> --> <!-- <div class=" text-sm font-semibold mb-2"></div> -->
<div class="mt-2"> <div class="mt-2">
<div class=" text-xs font-semibold mb-2">{$i18n.t('Content')}*</div> <div class=" text-xs font-semibold mb-2">Content*</div>
<div> <div>
<textarea <textarea
...@@ -383,7 +381,7 @@ ...@@ -383,7 +381,7 @@
<div class="my-2"> <div class="my-2">
<div class="flex w-full justify-between mb-2"> <div class="flex w-full justify-between mb-2">
<div class=" self-center text-sm font-semibold">{$i18n.t('Prompt suggestions')}</div> <div class=" self-center text-sm font-semibold">Prompt suggestions</div>
<button <button
class="p-1 px-3 text-xs flex rounded transition" class="p-1 px-3 text-xs flex rounded transition"
...@@ -411,7 +409,7 @@ ...@@ -411,7 +409,7 @@
<div class=" flex border dark:border-gray-600 rounded-lg"> <div class=" flex border dark:border-gray-600 rounded-lg">
<input <input
class="px-3 py-1.5 text-sm w-full bg-transparent outline-none border-r dark:border-gray-600" class="px-3 py-1.5 text-sm w-full bg-transparent outline-none border-r dark:border-gray-600"
placeholder={$i18n.t('Write a prompt suggestion (e.g. Who are you?)')} placeholder="Write a prompt suggestion (e.g. Who are you?)"
bind:value={prompt.content} bind:value={prompt.content}
/> />
...@@ -440,7 +438,7 @@ ...@@ -440,7 +438,7 @@
</div> </div>
<div class="my-2"> <div class="my-2">
<div class=" text-sm font-semibold mb-2">{$i18n.t('Categories')}</div> <div class=" text-sm font-semibold mb-2">Categories</div>
<div class="grid grid-cols-4"> <div class="grid grid-cols-4">
{#each Object.keys(categories) as category} {#each Object.keys(categories) as category}
...@@ -455,7 +453,7 @@ ...@@ -455,7 +453,7 @@
{#if pullProgress !== null} {#if pullProgress !== null}
<div class="my-2"> <div class="my-2">
<div class=" text-sm font-semibold mb-2">{$i18n.t('Pull Progress')}</div> <div class=" text-sm font-semibold mb-2">Pull Progress</div>
<div class="w-full rounded-full dark:bg-gray-800"> <div class="w-full rounded-full dark:bg-gray-800">
<div <div
class="dark:bg-gray-600 text-xs font-medium text-blue-100 text-center p-0.5 leading-none rounded-full" class="dark:bg-gray-600 text-xs font-medium text-blue-100 text-center p-0.5 leading-none rounded-full"
...@@ -478,7 +476,7 @@ ...@@ -478,7 +476,7 @@
type="submit" type="submit"
disabled={loading} disabled={loading}
> >
<div class=" self-center font-medium">{$i18n.t('Save & Update')}</div> <div class=" self-center font-medium">Save & Update</div>
{#if loading} {#if loading}
<div class="ml-1.5 self-center"> <div class="ml-1.5 self-center">
......
<script lang="ts"> <script lang="ts">
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { onMount, tick, getContext } from 'svelte'; import { onMount, tick } from 'svelte';
import { toast } from 'svelte-sonner'; import { toast } from 'svelte-sonner';
...@@ -13,14 +13,11 @@ ...@@ -13,14 +13,11 @@
} from '$lib/constants'; } from '$lib/constants';
import { WEBUI_NAME, config, user, models, settings } from '$lib/stores'; import { WEBUI_NAME, config, user, models, settings } from '$lib/stores';
import { cancelOllamaRequest, generateChatCompletion } from '$lib/apis/ollama'; import { cancelChatCompletion, generateChatCompletion } from '$lib/apis/ollama';
import { generateOpenAIChatCompletion } from '$lib/apis/openai'; import { generateOpenAIChatCompletion } from '$lib/apis/openai';
import { splitStream } from '$lib/utils'; import { splitStream } from '$lib/utils';
import ChatCompletion from '$lib/components/playground/ChatCompletion.svelte'; import ChatCompletion from '$lib/components/playground/ChatCompletion.svelte';
import Selector from '$lib/components/chat/ModelSelector/Selector.svelte';
const i18n = getContext('i18n');
let mode = 'chat'; let mode = 'chat';
let loaded = false; let loaded = false;
...@@ -53,7 +50,7 @@ ...@@ -53,7 +50,7 @@
// const cancelHandler = async () => { // const cancelHandler = async () => {
// if (currentRequestId) { // if (currentRequestId) {
// const res = await cancelOllamaRequest(localStorage.token, currentRequestId); // const res = await cancelChatCompletion(localStorage.token, currentRequestId);
// currentRequestId = null; // currentRequestId = null;
// loading = false; // loading = false;
// } // }
...@@ -96,7 +93,7 @@ ...@@ -96,7 +93,7 @@
const { value, done } = await reader.read(); const { value, done } = await reader.read();
if (done || stopResponseFlag) { if (done || stopResponseFlag) {
if (stopResponseFlag) { if (stopResponseFlag) {
await cancelOllamaRequest(localStorage.token, currentRequestId); await cancelChatCompletion(localStorage.token, currentRequestId);
} }
currentRequestId = null; currentRequestId = null;
...@@ -182,7 +179,7 @@ ...@@ -182,7 +179,7 @@
const { value, done } = await reader.read(); const { value, done } = await reader.read();
if (done || stopResponseFlag) { if (done || stopResponseFlag) {
if (stopResponseFlag) { if (stopResponseFlag) {
await cancelOllamaRequest(localStorage.token, currentRequestId); await cancelChatCompletion(localStorage.token, currentRequestId);
} }
currentRequestId = null; currentRequestId = null;
...@@ -264,7 +261,7 @@ ...@@ -264,7 +261,7 @@
<svelte:head> <svelte:head>
<title> <title>
{$i18n.t('Playground')} | {$WEBUI_NAME} {`Playground | ${$WEBUI_NAME}`}
</title> </title>
</svelte:head> </svelte:head>
...@@ -275,8 +272,7 @@ ...@@ -275,8 +272,7 @@
<div class="flex flex-col justify-between mb-2.5 gap-1"> <div class="flex flex-col justify-between mb-2.5 gap-1">
<div class="flex justify-between items-center gap-2"> <div class="flex justify-between items-center gap-2">
<div class=" text-2xl font-semibold self-center flex"> <div class=" text-2xl font-semibold self-center flex">
{$i18n.t('Playground')} Playground <span class=" text-xs text-gray-500 self-center ml-1">(Beta)</span>
<span class=" text-xs text-gray-500 self-center ml-1">{$i18n.t('(Beta)')}</span>
</div> </div>
<div> <div>
...@@ -293,9 +289,9 @@ ...@@ -293,9 +289,9 @@
}} }}
> >
{#if mode === 'complete'} {#if mode === 'complete'}
{$i18n.t('Text Completion')} Text Completion
{:else if mode === 'chat'} {:else if mode === 'chat'}
{$i18n.t('Chat')} Chat
{/if} {/if}
<div> <div>
...@@ -316,24 +312,25 @@ ...@@ -316,24 +312,25 @@
</div> </div>
</div> </div>
<div class="flex flex-col gap-1 px-1 w-full"> <div class=" flex gap-1 px-1">
<div class="flex w-full"> <select
<div class="overflow-hidden w-full"> id="models"
<div class="max-w-full"> class="outline-none bg-transparent text-sm font-medium rounded-lg w-full placeholder-gray-400"
<Selector bind:value={selectedModelId}
placeholder={$i18n.t('Select a model')} >
items={$models <option class=" text-gray-800" value="" selected disabled>Select a model</option>
.filter((model) => model.name !== 'hr')
.map((model) => ({ {#each $models as model}
value: model.id, {#if model.name === 'hr'}
label: model.name, <hr />
info: model {:else}
}))} <option value={model.id} class="text-gray-800 text-lg"
bind:value={selectedModelId} >{model.name +
/> `${model.size ? ` (${(model.size / 1024 ** 3).toFixed(1)}GB)` : ''}`}</option
</div> >
</div> {/if}
</div> {/each}
</select>
<!-- <button <!-- <button
class=" self-center dark:hover:text-gray-300" class=" self-center dark:hover:text-gray-300"
...@@ -366,12 +363,12 @@ ...@@ -366,12 +363,12 @@
{#if mode === 'chat'} {#if mode === 'chat'}
<div class="p-1"> <div class="p-1">
<div class="p-3 outline outline-1 outline-gray-200 dark:outline-gray-800 rounded-lg"> <div class="p-3 outline outline-1 outline-gray-200 dark:outline-gray-800 rounded-lg">
<div class=" text-sm font-medium">{$i18n.t('System')}</div> <div class=" text-sm font-medium">System</div>
<textarea <textarea
id="system-textarea" id="system-textarea"
class="w-full h-full bg-transparent resize-none outline-none text-sm" class="w-full h-full bg-transparent resize-none outline-none text-sm"
bind:value={system} bind:value={system}
placeholder={$i18n.t("You're a helpful assistant.")} placeholder="You're a helpful assistant."
rows="4" rows="4"
/> />
</div> </div>
...@@ -391,7 +388,7 @@ ...@@ -391,7 +388,7 @@
bind:this={textCompletionAreaElement} bind:this={textCompletionAreaElement}
class="w-full h-full p-3 bg-transparent outline outline-1 outline-gray-200 dark:outline-gray-800 resize-none rounded-lg text-sm" class="w-full h-full p-3 bg-transparent outline outline-1 outline-gray-200 dark:outline-gray-800 resize-none rounded-lg text-sm"
bind:value={text} bind:value={text}
placeholder={$i18n.t("You're a helpful assistant.")} placeholder="You're a helpful assistant."
/> />
{:else if mode === 'chat'} {:else if mode === 'chat'}
<ChatCompletion bind:messages /> <ChatCompletion bind:messages />
...@@ -408,7 +405,7 @@ ...@@ -408,7 +405,7 @@
submitHandler(); submitHandler();
}} }}
> >
{$i18n.t('Submit')} Submit
</button> </button>
{:else} {:else}
<button <button
...@@ -417,7 +414,7 @@ ...@@ -417,7 +414,7 @@
stopResponse(); stopResponse();
}} }}
> >
{$i18n.t('Cancel')} Cancel
</button> </button>
{/if} {/if}
</div> </div>
......
...@@ -3,19 +3,17 @@ ...@@ -3,19 +3,17 @@
import fileSaver from 'file-saver'; import fileSaver from 'file-saver';
const { saveAs } = fileSaver; const { saveAs } = fileSaver;
import { onMount, getContext } from 'svelte'; import { onMount } from 'svelte';
import { WEBUI_NAME, prompts } from '$lib/stores'; import { WEBUI_NAME, prompts } from '$lib/stores';
import { createNewPrompt, deletePromptByCommand, getPrompts } from '$lib/apis/prompts'; import { createNewPrompt, deletePromptByCommand, getPrompts } from '$lib/apis/prompts';
import { error } from '@sveltejs/kit'; import { error } from '@sveltejs/kit';
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
const i18n = getContext('i18n');
let importFiles = ''; let importFiles = '';
let query = ''; let query = '';
let promptsImportInputElement: HTMLInputElement; let promptsImportInputElement: HTMLInputElement;
const sharePrompt = async (prompt) => { const sharePrompt = async (prompt) => {
toast.success($i18n.t('Redirecting you to OpenWebUI Community')); toast.success('Redirecting you to OpenWebUI Community');
const url = 'https://openwebui.com'; const url = 'https://openwebui.com';
...@@ -40,7 +38,7 @@ ...@@ -40,7 +38,7 @@
<svelte:head> <svelte:head>
<title> <title>
{$i18n.t('Prompts')} | {$WEBUI_NAME} {`Prompts | ${$WEBUI_NAME}`}
</title> </title>
</svelte:head> </svelte:head>
...@@ -48,7 +46,7 @@ ...@@ -48,7 +46,7 @@
<div class="flex flex-col justify-between w-full overflow-y-auto"> <div class="flex flex-col justify-between w-full overflow-y-auto">
<div class="max-w-2xl mx-auto w-full px-3 md:px-0 my-10"> <div class="max-w-2xl mx-auto w-full px-3 md:px-0 my-10">
<div class="mb-6 flex justify-between items-center"> <div class="mb-6 flex justify-between items-center">
<div class=" text-2xl font-semibold self-center">{$i18n.t('My Prompts')}</div> <div class=" text-2xl font-semibold self-center">My Prompts</div>
</div> </div>
<div class=" flex w-full space-x-2"> <div class=" flex w-full space-x-2">
...@@ -70,7 +68,7 @@ ...@@ -70,7 +68,7 @@
<input <input
class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-none bg-transparent" class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-none bg-transparent"
bind:value={query} bind:value={query}
placeholder={$i18n.t('Search Prompts')} placeholder="Search Prompt"
/> />
</div> </div>
...@@ -248,7 +246,7 @@ ...@@ -248,7 +246,7 @@
promptsImportInputElement.click(); promptsImportInputElement.click();
}} }}
> >
<div class=" self-center mr-2 font-medium">{$i18n.t('Import Prompts')}</div> <div class=" self-center mr-2 font-medium">Import Prompts</div>
<div class=" self-center"> <div class=" self-center">
<svg <svg
...@@ -276,7 +274,7 @@ ...@@ -276,7 +274,7 @@
saveAs(blob, `prompts-export-${Date.now()}.json`); saveAs(blob, `prompts-export-${Date.now()}.json`);
}} }}
> >
<div class=" self-center mr-2 font-medium">{$i18n.t('Export Prompts')}</div> <div class=" self-center mr-2 font-medium">Export Prompts</div>
<div class=" self-center"> <div class=" self-center">
<svg <svg
...@@ -305,7 +303,7 @@ ...@@ -305,7 +303,7 @@
</div> </div>
<div class=" my-16"> <div class=" my-16">
<div class=" text-2xl font-semibold mb-3">{$i18n.t('Made by OpenWebUI Community')}</div> <div class=" text-2xl font-semibold mb-3">Made by OpenWebUI Community</div>
<a <a
class=" flex space-x-4 cursor-pointer w-full mb-3 px-3 py-2" class=" flex space-x-4 cursor-pointer w-full mb-3 px-3 py-2"
...@@ -332,8 +330,8 @@ ...@@ -332,8 +330,8 @@
</div> </div>
<div class=" self-center"> <div class=" self-center">
<div class=" font-bold">{$i18n.t('Discover a prompt')}</div> <div class=" font-bold">Discover a prompt</div>
<div class=" text-sm">{$i18n.t('Discover, download, and explore custom prompts')}</div> <div class=" text-sm">Discover, download, and explore custom prompts</div>
</div> </div>
</a> </a>
</div> </div>
......
...@@ -3,12 +3,10 @@ ...@@ -3,12 +3,10 @@
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { prompts } from '$lib/stores'; import { prompts } from '$lib/stores';
import { onMount, tick, getContext } from 'svelte'; import { onMount, tick } from 'svelte';
import { createNewPrompt, getPrompts } from '$lib/apis/prompts'; import { createNewPrompt, getPrompts } from '$lib/apis/prompts';
const i18n = getContext('i18n');
let loading = false; let loading = false;
// /////////// // ///////////
...@@ -38,9 +36,7 @@ ...@@ -38,9 +36,7 @@
await goto('/prompts'); await goto('/prompts');
} }
} else { } else {
toast.error( toast.error('Only alphanumeric characters and hyphens are allowed in the command string.');
$i18n.t('Only alphanumeric characters and hyphens are allowed in the command string.')
);
} }
loading = false; loading = false;
...@@ -96,7 +92,7 @@ ...@@ -96,7 +92,7 @@
<div class="min-h-screen max-h-[100dvh] w-full flex justify-center dark:text-white"> <div class="min-h-screen max-h-[100dvh] w-full flex justify-center dark:text-white">
<div class=" flex flex-col justify-between w-full overflow-y-auto"> <div class=" flex flex-col justify-between w-full overflow-y-auto">
<div class="max-w-2xl mx-auto w-full px-3 md:px-0 my-10"> <div class="max-w-2xl mx-auto w-full px-3 md:px-0 my-10">
<div class=" text-2xl font-semibold mb-6">{$i18n.t('My Prompts')}</div> <div class=" text-2xl font-semibold mb-6">My Prompts</div>
<button <button
class="flex space-x-1" class="flex space-x-1"
...@@ -118,7 +114,7 @@ ...@@ -118,7 +114,7 @@
/> />
</svg> </svg>
</div> </div>
<div class=" self-center font-medium text-sm">{$i18n.t('Back')}</div> <div class=" self-center font-medium text-sm">Back</div>
</button> </button>
<hr class="my-3 dark:border-gray-700" /> <hr class="my-3 dark:border-gray-700" />
...@@ -129,12 +125,12 @@ ...@@ -129,12 +125,12 @@
}} }}
> >
<div class="my-2"> <div class="my-2">
<div class=" text-sm font-semibold mb-2">{$i18n.t('Title')}*</div> <div class=" text-sm font-semibold mb-2">Title*</div>
<div> <div>
<input <input
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg" class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
placeholder={$i18n.t('Add a short title for this prompt')} placeholder="Add a short title for this prompt"
bind:value={title} bind:value={title}
required required
/> />
...@@ -142,7 +138,7 @@ ...@@ -142,7 +138,7 @@
</div> </div>
<div class="my-2"> <div class="my-2">
<div class=" text-sm font-semibold mb-2">{$i18n.t('Command')}*</div> <div class=" text-sm font-semibold mb-2">Command*</div>
<div class="flex items-center mb-1"> <div class="flex items-center mb-1">
<div <div
...@@ -152,38 +148,34 @@ ...@@ -152,38 +148,34 @@
</div> </div>
<input <input
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-r-lg" class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-r-lg"
placeholder={$i18n.t('short-summary')} placeholder="short-summary"
bind:value={command} bind:value={command}
required required
/> />
</div> </div>
<div class="text-xs text-gray-400 dark:text-gray-500"> <div class="text-xs text-gray-400 dark:text-gray-500">
{$i18n.t('Only')} Only <span class=" text-gray-600 dark:text-gray-300 font-medium"
<span class=" text-gray-600 dark:text-gray-300 font-medium" >alphanumeric characters and hyphens</span
>{$i18n.t('alphanumeric characters and hyphens')}</span
> >
{$i18n.t('are allowed - Activate this command by typing')}&nbsp;"<span are allowed; Activate this command by typing "<span
class=" text-gray-600 dark:text-gray-300 font-medium" class=" text-gray-600 dark:text-gray-300 font-medium"
> >
/{command} /{command}
</span>" &nbsp; </span>" to chat input.
{$i18n.t('to chat input.')}
</div> </div>
</div> </div>
<div class="my-2"> <div class="my-2">
<div class="flex w-full justify-between"> <div class="flex w-full justify-between">
<div class=" self-center text-sm font-semibold">{$i18n.t('Prompt Content')}*</div> <div class=" self-center text-sm font-semibold">Prompt Content*</div>
</div> </div>
<div class="mt-2"> <div class="mt-2">
<div> <div>
<textarea <textarea
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg" class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
placeholder={$i18n.t( placeholder={`Write a summary in 50 words that summarizes [topic or keyword].`}
'Write a summary in 50 words that summarizes [topic or keyword].'
)}
rows="6" rows="6"
bind:value={content} bind:value={content}
required required
...@@ -191,20 +183,18 @@ ...@@ -191,20 +183,18 @@
</div> </div>
<div class="text-xs text-gray-400 dark:text-gray-500"> <div class="text-xs text-gray-400 dark:text-gray-500">
{$i18n.t('Format your variables using square brackets like this:')}&nbsp;<span ⓘ Format your variables using square brackets like this: <span
class=" text-gray-600 dark:text-gray-300 font-medium">[{$i18n.t('variable')}]</span class=" text-gray-600 dark:text-gray-300 font-medium">[variable]</span
>. >
{$i18n.t('Make sure to enclose them with')} . Make sure to enclose them with
<span class=" text-gray-600 dark:text-gray-300 font-medium">'['</span> <span class=" text-gray-600 dark:text-gray-300 font-medium">'['</span>
{$i18n.t('and')} and <span class=" text-gray-600 dark:text-gray-300 font-medium">']'</span>.
<span class=" text-gray-600 dark:text-gray-300 font-medium">']'</span>.
</div> </div>
<div class="text-xs text-gray-400 dark:text-gray-500"> <div class="text-xs text-gray-400 dark:text-gray-500">
{$i18n.t('Utilize')}<span class=" text-gray-600 dark:text-gray-300 font-medium"> Utilize <span class=" text-gray-600 dark:text-gray-300 font-medium"
{` {{CLIPBOARD}}`}</span >{`{{CLIPBOARD}}`}</span
> > variable to have them replaced with clipboard content.
{$i18n.t('variable to have them replaced with clipboard content.')}
</div> </div>
</div> </div>
</div> </div>
...@@ -217,7 +207,7 @@ ...@@ -217,7 +207,7 @@
type="submit" type="submit"
disabled={loading} disabled={loading}
> >
<div class=" self-center font-medium">{$i18n.t('Save & Create')}</div> <div class=" self-center font-medium">Save & Create</div>
{#if loading} {#if loading}
<div class="ml-1.5 self-center"> <div class="ml-1.5 self-center">
......
...@@ -3,9 +3,7 @@ ...@@ -3,9 +3,7 @@
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { prompts } from '$lib/stores'; import { prompts } from '$lib/stores';
import { onMount, tick, getContext } from 'svelte'; import { onMount, tick } from 'svelte';
const i18n = getContext('i18n');
import { getPrompts, updatePromptByCommand } from '$lib/apis/prompts'; import { getPrompts, updatePromptByCommand } from '$lib/apis/prompts';
import { page } from '$app/stores'; import { page } from '$app/stores';
...@@ -36,9 +34,7 @@ ...@@ -36,9 +34,7 @@
await goto('/prompts'); await goto('/prompts');
} }
} else { } else {
toast.error( toast.error('Only alphanumeric characters and hyphens are allowed in the command string.');
$i18n.t('Only alphanumeric characters and hyphens are allowed in the command string.')
);
} }
loading = false; loading = false;
...@@ -78,7 +74,7 @@ ...@@ -78,7 +74,7 @@
<div class="min-h-screen max-h-[100dvh] w-full flex justify-center dark:text-white"> <div class="min-h-screen max-h-[100dvh] w-full flex justify-center dark:text-white">
<div class="flex flex-col justify-between w-full overflow-y-auto"> <div class="flex flex-col justify-between w-full overflow-y-auto">
<div class="max-w-2xl mx-auto w-full px-3 md:px-0 my-10"> <div class="max-w-2xl mx-auto w-full px-3 md:px-0 my-10">
<div class=" text-2xl font-semibold mb-6">{$i18n.t('My Prompts')}</div> <div class=" text-2xl font-semibold mb-6">My Prompts</div>
<button <button
class="flex space-x-1" class="flex space-x-1"
...@@ -100,7 +96,7 @@ ...@@ -100,7 +96,7 @@
/> />
</svg> </svg>
</div> </div>
<div class=" self-center font-medium text-sm">{$i18n.t('Back')}</div> <div class=" self-center font-medium text-sm">Back</div>
</button> </button>
<hr class="my-3 dark:border-gray-700" /> <hr class="my-3 dark:border-gray-700" />
...@@ -111,12 +107,12 @@ ...@@ -111,12 +107,12 @@
}} }}
> >
<div class="my-2"> <div class="my-2">
<div class=" text-sm font-semibold mb-2">{$i18n.t('Title')}*</div> <div class=" text-sm font-semibold mb-2">Title*</div>
<div> <div>
<input <input
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg" class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
placeholder={$i18n.t('Add a short title for this prompt')} placeholder="Add a short title for this prompt"
bind:value={title} bind:value={title}
required required
/> />
...@@ -124,7 +120,7 @@ ...@@ -124,7 +120,7 @@
</div> </div>
<div class="my-2"> <div class="my-2">
<div class=" text-sm font-semibold mb-2">{$i18n.t('Command')}*</div> <div class=" text-sm font-semibold mb-2">Command*</div>
<div class="flex items-center mb-1"> <div class="flex items-center mb-1">
<div <div
...@@ -142,31 +138,27 @@ ...@@ -142,31 +138,27 @@
</div> </div>
<div class="text-xs text-gray-400 dark:text-gray-500"> <div class="text-xs text-gray-400 dark:text-gray-500">
{$i18n.t('Only')} Only <span class=" text-gray-600 dark:text-gray-300 font-medium"
<span class=" text-gray-600 dark:text-gray-300 font-medium" >alphanumeric characters and hyphens</span
>{$i18n.t('alphanumeric characters and hyphens')}</span
> >
{$i18n.t('are allowed - Activate this command by typing')}&nbsp;"<span are allowed; Activate this command by typing "<span
class=" text-gray-600 dark:text-gray-300 font-medium" class=" text-gray-600 dark:text-gray-300 font-medium"
> >
/{command} /{command}
</span>" &nbsp; </span>" to chat input.
{$i18n.t('to chat input.')}
</div> </div>
</div> </div>
<div class="my-2"> <div class="my-2">
<div class="flex w-full justify-between"> <div class="flex w-full justify-between">
<div class=" self-center text-sm font-semibold">{$i18n.t('Prompt Content')}*</div> <div class=" self-center text-sm font-semibold">Prompt Content*</div>
</div> </div>
<div class="mt-2"> <div class="mt-2">
<div> <div>
<textarea <textarea
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg" class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
placeholder={$i18n.t( placeholder={`Write a summary in 50 words that summarizes [topic or keyword].`}
`Write a summary in 50 words that summarizes [topic or keyword].`
)}
rows="6" rows="6"
bind:value={content} bind:value={content}
required required
...@@ -174,20 +166,12 @@ ...@@ -174,20 +166,12 @@
</div> </div>
<div class="text-xs text-gray-400 dark:text-gray-500"> <div class="text-xs text-gray-400 dark:text-gray-500">
ⓘ {$i18n.t('Format your variables using square brackets like this:')}&nbsp;<span Format your variables using square brackets like this: <span
class=" text-gray-600 dark:text-gray-300 font-medium">[{$i18n.t('variable')}]</span class=" text-gray-600 dark:text-gray-300 font-medium">[variable]</span
>.
{$i18n.t('Make sure to enclose them with')}
<span class=" text-gray-600 dark:text-gray-300 font-medium">'['</span>
{$i18n.t('and')}
<span class=" text-gray-600 dark:text-gray-300 font-medium">']'</span>.
</div>
<div class="text-xs text-gray-400 dark:text-gray-500">
{$i18n.t('Utilize')}<span class=" text-gray-600 dark:text-gray-300 font-medium">
{` {{CLIPBOARD}}`}</span
> >
{$i18n.t('variable to have them replaced with clipboard content.')} . Make sure to enclose them with
<span class=" text-gray-600 dark:text-gray-300 font-medium">'['</span>
and <span class=" text-gray-600 dark:text-gray-300 font-medium">']'</span> .
</div> </div>
</div> </div>
</div> </div>
...@@ -200,7 +184,7 @@ ...@@ -200,7 +184,7 @@
type="submit" type="submit"
disabled={loading} disabled={loading}
> >
<div class=" self-center font-medium">{$i18n.t('Save & Update')}</div> <div class=" self-center font-medium">Save & Update</div>
{#if loading} {#if loading}
<div class="ml-1.5 self-center"> <div class="ml-1.5 self-center">
......
<script> <script>
import { onMount, tick, setContext } from 'svelte'; import { onMount, tick } from 'svelte';
import { config, user, theme, WEBUI_NAME } from '$lib/stores'; import { config, user, theme, WEBUI_NAME } from '$lib/stores';
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { Toaster, toast } from 'svelte-sonner'; import { Toaster, toast } from 'svelte-sonner';
...@@ -11,9 +11,6 @@ ...@@ -11,9 +11,6 @@
import '../tailwind.css'; import '../tailwind.css';
import 'tippy.js/dist/tippy.css'; import 'tippy.js/dist/tippy.css';
import { WEBUI_BASE_URL } from '$lib/constants'; import { WEBUI_BASE_URL } from '$lib/constants';
import i18n, { initI18n } from '$lib/i18n';
setContext('i18n', i18n);
let loaded = false; let loaded = false;
...@@ -25,11 +22,6 @@ ...@@ -25,11 +22,6 @@
if (backendConfig) { if (backendConfig) {
// Save Backend Status to Store // Save Backend Status to Store
await config.set(backendConfig); await config.set(backendConfig);
if ($config.default_locale) {
initI18n($config.default_locale);
} else {
initI18n();
}
await WEBUI_NAME.set(backendConfig.name); await WEBUI_NAME.set(backendConfig.name);
console.log(backendConfig); console.log(backendConfig);
......
...@@ -3,11 +3,9 @@ ...@@ -3,11 +3,9 @@
import { userSignIn, userSignUp } from '$lib/apis/auths'; import { userSignIn, userSignUp } from '$lib/apis/auths';
import { WEBUI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants'; import { WEBUI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants';
import { WEBUI_NAME, config, user } from '$lib/stores'; import { WEBUI_NAME, config, user } from '$lib/stores';
import { onMount, getContext } from 'svelte'; import { onMount } from 'svelte';
import { toast } from 'svelte-sonner'; import { toast } from 'svelte-sonner';
const i18n = getContext('i18n');
let loaded = false; let loaded = false;
let mode = 'signin'; let mode = 'signin';
...@@ -18,7 +16,7 @@ ...@@ -18,7 +16,7 @@
const setSessionUser = async (sessionUser) => { const setSessionUser = async (sessionUser) => {
if (sessionUser) { if (sessionUser) {
console.log(sessionUser); console.log(sessionUser);
toast.success($i18n.t(`You're now logged in.`)); toast.success(`You're now logged in.`);
localStorage.token = sessionUser.token; localStorage.token = sessionUser.token;
await user.set(sessionUser); await user.set(sessionUser);
goto('/'); goto('/');
...@@ -98,30 +96,26 @@ ...@@ -98,30 +96,26 @@
}} }}
> >
<div class=" text-xl sm:text-2xl font-bold"> <div class=" text-xl sm:text-2xl font-bold">
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Sign up')} {mode === 'signin' ? 'Sign in' : 'Sign up'} to {$WEBUI_NAME}
{$i18n.t('to')}
{$WEBUI_NAME}
</div> </div>
{#if mode === 'signup'} {#if mode === 'signup'}
<div class=" mt-1 text-xs font-medium text-gray-500"> <div class=" mt-1 text-xs font-medium text-gray-500">
ⓘ {$WEBUI_NAME} ⓘ {$WEBUI_NAME} does not make any external connections, and your data stays securely on
{$i18n.t( your locally hosted server.
'does not make any external connections, and your data stays securely on your locally hosted server.'
)}
</div> </div>
{/if} {/if}
<div class="flex flex-col mt-4"> <div class="flex flex-col mt-4">
{#if mode === 'signup'} {#if mode === 'signup'}
<div> <div>
<div class=" text-sm font-semibold text-left mb-1">{$i18n.t('Name')}</div> <div class=" text-sm font-semibold text-left mb-1">Name</div>
<input <input
bind:value={name} bind:value={name}
type="text" type="text"
class=" border px-4 py-2.5 rounded-2xl w-full text-sm" class=" border px-4 py-2.5 rounded-2xl w-full text-sm"
autocomplete="name" autocomplete="name"
placeholder={$i18n.t('Enter Your Full Name')} placeholder="Enter Your Full Name"
required required
/> />
</div> </div>
...@@ -130,24 +124,24 @@ ...@@ -130,24 +124,24 @@
{/if} {/if}
<div class="mb-2"> <div class="mb-2">
<div class=" text-sm font-semibold text-left mb-1">{$i18n.t('Email')}</div> <div class=" text-sm font-semibold text-left mb-1">Email</div>
<input <input
bind:value={email} bind:value={email}
type="email" type="email"
class=" border px-4 py-2.5 rounded-2xl w-full text-sm" class=" border px-4 py-2.5 rounded-2xl w-full text-sm"
autocomplete="email" autocomplete="email"
placeholder={$i18n.t('Enter Your Email')} placeholder="Enter Your Email"
required required
/> />
</div> </div>
<div> <div>
<div class=" text-sm font-semibold text-left mb-1">{$i18n.t('Password')}</div> <div class=" text-sm font-semibold text-left mb-1">Password</div>
<input <input
bind:value={password} bind:value={password}
type="password" type="password"
class=" border px-4 py-2.5 rounded-2xl w-full text-sm" class=" border px-4 py-2.5 rounded-2xl w-full text-sm"
placeholder={$i18n.t('Enter Your Password')} placeholder="Enter Your Password"
autocomplete="current-password" autocomplete="current-password"
required required
/> />
...@@ -159,13 +153,11 @@ ...@@ -159,13 +153,11 @@
class=" bg-gray-900 hover:bg-gray-800 w-full rounded-full text-white font-semibold text-sm py-3 transition" class=" bg-gray-900 hover:bg-gray-800 w-full rounded-full text-white font-semibold text-sm py-3 transition"
type="submit" type="submit"
> >
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Create Account')} {mode === 'signin' ? 'Sign In' : 'Create Account'}
</button> </button>
<div class=" mt-4 text-sm text-center"> <div class=" mt-4 text-sm text-center">
{mode === 'signin' {mode === 'signin' ? `Don't have an account?` : `Already have an account?`}
? $i18n.t("Don't have an account?")
: $i18n.t('Already have an account?')}
<button <button
class=" font-medium underline" class=" font-medium underline"
...@@ -178,7 +170,7 @@ ...@@ -178,7 +170,7 @@
} }
}} }}
> >
{mode === 'signin' ? $i18n.t('Sign up') : $i18n.t('Sign in')} {mode === 'signin' ? `Sign up` : `Sign In`}
</button> </button>
</div> </div>
</div> </div>
......
<script> <script>
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { WEBUI_NAME, config } from '$lib/stores'; import { WEBUI_NAME, config } from '$lib/stores';
import { onMount, getContext } from 'svelte'; import { onMount } from 'svelte';
const i18n = getContext('i18n');
let loaded = false; let loaded = false;
...@@ -21,25 +19,22 @@ ...@@ -21,25 +19,22 @@
<div class="absolute rounded-xl w-full h-full backdrop-blur flex justify-center"> <div class="absolute rounded-xl w-full h-full backdrop-blur flex justify-center">
<div class="m-auto pb-44 flex flex-col justify-center"> <div class="m-auto pb-44 flex flex-col justify-center">
<div class="max-w-md"> <div class="max-w-md">
<div class="text-center text-2xl font-medium z-50"> <div class="text-center text-2xl font-medium z-50">{$WEBUI_NAME} Backend Required</div>
{$i18n.t('{{webUIName}} Backend Required', { webUIName: $WEBUI_NAME })}
</div>
<div class=" mt-4 text-center text-sm w-full"> <div class=" mt-4 text-center text-sm w-full">
{$i18n.t( Oops! You're using an unsupported method (frontend only). Please serve the WebUI from
"Oops! You're using an unsupported method (frontend only). Please serve the WebUI from the backend." the backend.
)}
<br class=" " /> <br class=" " />
<br class=" " /> <br class=" " />
<a <a
class=" font-semibold underline" class=" font-semibold underline"
href="https://github.com/open-webui/open-webui#how-to-install-" href="https://github.com/open-webui/open-webui#how-to-install-"
target="_blank">{$i18n.t('See readme.md for instructions')}</a target="_blank">See readme.md for instructions</a
> >
{$i18n.t('or')} or
<a class=" font-semibold underline" href="https://discord.gg/5rJgQTnV4s" target="_blank" <a class=" font-semibold underline" href="https://discord.gg/5rJgQTnV4s" target="_blank"
>{$i18n.t('join our Discord for help.')}</a >join our Discord for help.</a
> >
</div> </div>
...@@ -50,7 +45,7 @@ ...@@ -50,7 +45,7 @@
location.href = '/'; location.href = '/';
}} }}
> >
{$i18n.t('Check Again')} Check Again
</button> </button>
</div> </div>
</div> </div>
......
...@@ -3,14 +3,16 @@ ...@@ -3,14 +3,16 @@
@tailwind utilities; @tailwind utilities;
@layer base { @layer base {
html, html {
pre {
font-family: -apple-system, 'Arimo', ui-sans-serif, system-ui, 'Segoe UI', Roboto, Ubuntu, font-family: -apple-system, 'Arimo', ui-sans-serif, system-ui, 'Segoe UI', Roboto, Ubuntu,
Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji', Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji',
'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
} }
pre { pre {
font-family: -apple-system, 'Arimo', ui-sans-serif, system-ui, 'Segoe UI', Roboto, Ubuntu,
Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji',
'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
white-space: pre-wrap; white-space: pre-wrap;
} }
} }
...@@ -13,4 +13,4 @@ ...@@ -13,4 +13,4 @@
"sizes": "844x884" "sizes": "844x884"
} }
] ]
} }
\ No newline at end of file
...@@ -16,12 +16,6 @@ const config = { ...@@ -16,12 +16,6 @@ const config = {
assets: 'build', assets: 'build',
fallback: 'index.html' fallback: 'index.html'
}) })
},
onwarn: (warning, handler) => {
const { code, _ } = warning;
if (code === 'css-unused-selector') return;
handler(warning);
} }
}; };
......
...@@ -16,8 +16,9 @@ export default { ...@@ -16,8 +16,9 @@ export default {
700: '#4e4e4e', 700: '#4e4e4e',
800: '#333', 800: '#333',
850: '#262626', 850: '#262626',
900: 'var(--color-gray-900, #171717)',
950: 'var(--color-gray-950, #0d0d0d)' 900: '#171717',
950: '#0d0d0d'
} }
}, },
typography: { typography: {
......
{
"model_name": "string",
"litellm_params": {
"model": "ollama/mistral"
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment