Commit 45311bfa authored by Anuraag Jain's avatar Anuraag Jain
Browse files

Merge branch 'main' into feat/cancel-model-download

# Conflicts:
#	src/lib/components/chat/Settings/Models.svelte
parents ae97a963 2fa94956
<script>
import toast from 'svelte-french-toast';
import { toast } from 'svelte-sonner';
import { goto } from '$app/navigation';
import { prompts } from '$lib/stores';
import { onMount, tick } from 'svelte';
import { onMount, tick, getContext } from 'svelte';
import { createNewPrompt, getPrompts } from '$lib/apis/prompts';
const i18n = getContext('i18n');
let loading = false;
// ///////////
......@@ -36,7 +38,9 @@
await goto('/prompts');
}
} else {
toast.error('Only alphanumeric characters and hyphens are allowed in the command string.');
toast.error(
$i18n.t('Only alphanumeric characters and hyphens are allowed in the command string.')
);
}
loading = false;
......@@ -50,7 +54,7 @@
return regex.test(inputString);
};
onMount(() => {
onMount(async () => {
window.addEventListener('message', async (event) => {
if (
![
......@@ -74,13 +78,25 @@
if (window.opener ?? false) {
window.opener.postMessage('loaded', '*');
}
if (sessionStorage.prompt) {
const prompt = JSON.parse(sessionStorage.prompt);
console.log(prompt);
title = prompt.title;
await tick();
content = prompt.content;
command = prompt.command.at(0) === '/' ? prompt.command.slice(1) : prompt.command;
sessionStorage.removeItem('prompt');
}
});
</script>
<div class="min-h-screen max-h-[100dvh] w-full flex justify-center dark:text-white">
<div class=" py-2.5 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=" text-2xl font-semibold mb-6">My Prompts</div>
<div class=" text-2xl font-semibold mb-6">{$i18n.t('My Prompts')}</div>
<button
class="flex space-x-1"
......@@ -102,7 +118,7 @@
/>
</svg>
</div>
<div class=" self-center font-medium text-sm">Back</div>
<div class=" self-center font-medium text-sm">{$i18n.t('Back')}</div>
</button>
<hr class="my-3 dark:border-gray-700" />
......@@ -113,12 +129,12 @@
}}
>
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Title*</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Title')}*</div>
<div>
<input
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
placeholder="Add a short title for this prompt"
placeholder={$i18n.t('Add a short title for this prompt')}
bind:value={title}
required
/>
......@@ -126,7 +142,7 @@
</div>
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Command*</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Command')}*</div>
<div class="flex items-center mb-1">
<div
......@@ -136,34 +152,38 @@
</div>
<input
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-r-lg"
placeholder="short-summary"
placeholder={$i18n.t('short-summary')}
bind:value={command}
required
/>
</div>
<div class="text-xs text-gray-400 dark:text-gray-500">
Only <span class=" text-gray-600 dark:text-gray-300 font-medium"
>alphanumeric characters and hyphens</span
{$i18n.t('Only')}
<span class=" text-gray-600 dark:text-gray-300 font-medium"
>{$i18n.t('alphanumeric characters and hyphens')}</span
>
are allowed; Activate this command by typing "<span
{$i18n.t('are allowed - Activate this command by typing')}&nbsp;"<span
class=" text-gray-600 dark:text-gray-300 font-medium"
>
/{command}
</span>" to chat input.
</span>" &nbsp;
{$i18n.t('to chat input.')}
</div>
</div>
<div class="my-2">
<div class="flex w-full justify-between">
<div class=" self-center text-sm font-semibold">Prompt Content*</div>
<div class=" self-center text-sm font-semibold">{$i18n.t('Prompt Content')}*</div>
</div>
<div class="mt-2">
<div>
<textarea
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
placeholder={`Write a summary in 50 words that summarizes [topic or keyword].`}
placeholder={$i18n.t(
'Write a summary in 50 words that summarizes [topic or keyword].'
)}
rows="6"
bind:value={content}
required
......@@ -171,12 +191,20 @@
</div>
<div class="text-xs text-gray-400 dark:text-gray-500">
Format your variables using square brackets like this: <span
class=" text-gray-600 dark:text-gray-300 font-medium">[variable]</span
>
. Make sure to enclose them with
ⓘ {$i18n.t('Format your variables using square brackets like this:')}&nbsp;<span
class=" text-gray-600 dark:text-gray-300 font-medium">[{$i18n.t('variable')}]</span
>.
{$i18n.t('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> .
{$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.')}
</div>
</div>
</div>
......@@ -189,7 +217,7 @@
type="submit"
disabled={loading}
>
<div class=" self-center font-medium">Save & Create</div>
<div class=" self-center font-medium">{$i18n.t('Save & Create')}</div>
{#if loading}
<div class="ml-1.5 self-center">
......
<script>
import toast from 'svelte-french-toast';
import { toast } from 'svelte-sonner';
import { goto } from '$app/navigation';
import { prompts } from '$lib/stores';
import { onMount, tick } from 'svelte';
import { onMount, tick, getContext } from 'svelte';
const i18n = getContext('i18n');
import { getPrompts, updatePromptByCommand } from '$lib/apis/prompts';
import { page } from '$app/stores';
......@@ -34,7 +36,9 @@
await goto('/prompts');
}
} else {
toast.error('Only alphanumeric characters and hyphens are allowed in the command string.');
toast.error(
$i18n.t('Only alphanumeric characters and hyphens are allowed in the command string.')
);
}
loading = false;
......@@ -72,9 +76,9 @@
</script>
<div class="min-h-screen max-h-[100dvh] w-full flex justify-center dark:text-white">
<div class=" py-2.5 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=" text-2xl font-semibold mb-6">My Prompts</div>
<div class=" text-2xl font-semibold mb-6">{$i18n.t('My Prompts')}</div>
<button
class="flex space-x-1"
......@@ -96,7 +100,7 @@
/>
</svg>
</div>
<div class=" self-center font-medium text-sm">Back</div>
<div class=" self-center font-medium text-sm">{$i18n.t('Back')}</div>
</button>
<hr class="my-3 dark:border-gray-700" />
......@@ -107,12 +111,12 @@
}}
>
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Title*</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Title')}*</div>
<div>
<input
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
placeholder="Add a short title for this prompt"
placeholder={$i18n.t('Add a short title for this prompt')}
bind:value={title}
required
/>
......@@ -120,7 +124,7 @@
</div>
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Command*</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Command')}*</div>
<div class="flex items-center mb-1">
<div
......@@ -138,27 +142,31 @@
</div>
<div class="text-xs text-gray-400 dark:text-gray-500">
Only <span class=" text-gray-600 dark:text-gray-300 font-medium"
>alphanumeric characters and hyphens</span
{$i18n.t('Only')}
<span class=" text-gray-600 dark:text-gray-300 font-medium"
>{$i18n.t('alphanumeric characters and hyphens')}</span
>
are allowed; Activate this command by typing "<span
{$i18n.t('are allowed - Activate this command by typing')}&nbsp;"<span
class=" text-gray-600 dark:text-gray-300 font-medium"
>
/{command}
</span>" to chat input.
</span>" &nbsp;
{$i18n.t('to chat input.')}
</div>
</div>
<div class="my-2">
<div class="flex w-full justify-between">
<div class=" self-center text-sm font-semibold">Prompt Content*</div>
<div class=" self-center text-sm font-semibold">{$i18n.t('Prompt Content')}*</div>
</div>
<div class="mt-2">
<div>
<textarea
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
placeholder={`Write a summary in 50 words that summarizes [topic or keyword].`}
placeholder={$i18n.t(
`Write a summary in 50 words that summarizes [topic or keyword].`
)}
rows="6"
bind:value={content}
required
......@@ -166,12 +174,20 @@
</div>
<div class="text-xs text-gray-400 dark:text-gray-500">
Format your variables using square brackets like this: <span
class=" text-gray-600 dark:text-gray-300 font-medium">[variable]</span
>
. Make sure to enclose them with
ⓘ {$i18n.t('Format your variables using square brackets like this:')}&nbsp;<span
class=" text-gray-600 dark:text-gray-300 font-medium">[{$i18n.t('variable')}]</span
>.
{$i18n.t('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> .
{$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.')}
</div>
</div>
</div>
......@@ -184,7 +200,7 @@
type="submit"
disabled={loading}
>
<div class=" self-center font-medium">Save & Update</div>
<div class=" self-center font-medium">{$i18n.t('Save & Update')}</div>
{#if loading}
<div class="ml-1.5 self-center">
......
<script>
import { onMount, tick } from 'svelte';
import { config, user, theme } from '$lib/stores';
import { onMount, tick, setContext } from 'svelte';
import { config, user, theme, WEBUI_NAME } from '$lib/stores';
import { goto } from '$app/navigation';
import toast, { Toaster } from 'svelte-french-toast';
import { Toaster, toast } from 'svelte-sonner';
import { getBackendConfig } from '$lib/apis';
import { getSessionUser } from '$lib/apis/auths';
......@@ -10,7 +10,10 @@
import '../app.css';
import '../tailwind.css';
import 'tippy.js/dist/tippy.css';
import { WEBUI_NAME } from '$lib/constants';
import { WEBUI_BASE_URL } from '$lib/constants';
import i18n from '$lib/i18n';
setContext('i18n', i18n);
let loaded = false;
......@@ -22,6 +25,8 @@
if (backendConfig) {
// Save Backend Status to Store
await config.set(backendConfig);
await WEBUI_NAME.set(backendConfig.name);
console.log(backendConfig);
if ($config) {
......@@ -55,7 +60,8 @@
</script>
<svelte:head>
<title>{WEBUI_NAME}</title>
<title>{$WEBUI_NAME}</title>
<link rel="icon" href="{WEBUI_BASE_URL}/static/favicon.png" />
<link rel="stylesheet" type="text/css" href="/themes/rosepine.css" />
<link rel="stylesheet" type="text/css" href="/themes/rosepine-dawn.css" />
......@@ -65,4 +71,4 @@
<slot />
{/if}
<Toaster />
<Toaster richColors position="top-center" />
<script>
import { goto } from '$app/navigation';
import { userSignIn, userSignUp } from '$lib/apis/auths';
import { WEBUI_API_BASE_URL, WEBUI_NAME } from '$lib/constants';
import { config, user } from '$lib/stores';
import { onMount } from 'svelte';
import toast from 'svelte-french-toast';
import { WEBUI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants';
import { WEBUI_NAME, config, user } from '$lib/stores';
import { onMount, getContext } from 'svelte';
import { toast } from 'svelte-sonner';
const i18n = getContext('i18n');
let loaded = false;
let mode = 'signin';
......@@ -16,7 +18,7 @@
const setSessionUser = async (sessionUser) => {
if (sessionUser) {
console.log(sessionUser);
toast.success(`You're now logged in.`);
toast.success($i18n.t(`You're now logged in.`));
localStorage.token = sessionUser.token;
await user.set(sessionUser);
goto('/');
......@@ -57,16 +59,22 @@
});
</script>
<svelte:head>
<title>
{`${$WEBUI_NAME}`}
</title>
</svelte:head>
{#if loaded}
<div class="fixed m-10 z-50">
<div class="flex space-x-2">
<div class=" self-center">
<img src="/favicon.png" class=" w-8 rounded-full" alt="logo" />
<img src="{WEBUI_BASE_URL}/static/favicon.png" class=" w-8 rounded-full" alt="logo" />
</div>
</div>
</div>
<div class=" bg-white min-h-screen w-full flex justify-center font-mona">
<div class=" bg-white dark:bg-gray-900 min-h-screen w-full flex justify-center font-mona">
<!-- <div class="hidden lg:flex lg:flex-1 px-10 md:px-16 w-full bg-yellow-50 justify-center">
<div class=" my-auto pb-16 text-left">
<div>
......@@ -81,35 +89,39 @@
</div>
</div> -->
<div class="w-full max-w-lg px-10 md:px-16 bg-white min-h-screen flex flex-col">
<div class="w-full sm:max-w-lg px-4 min-h-screen flex flex-col">
<div class=" my-auto pb-10 w-full">
<form
class=" flex flex-col justify-center"
class=" flex flex-col justify-center bg-white py-6 sm:py-16 px-6 sm:px-16 rounded-2xl"
on:submit|preventDefault={() => {
submitHandler();
}}
>
<div class=" text-xl md:text-2xl font-bold">
{mode === 'signin' ? 'Sign in' : 'Sign up'} to {WEBUI_NAME}
<div class=" text-xl sm:text-2xl font-bold">
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Sign up')}
{$i18n.t('to')}
{$WEBUI_NAME}
</div>
{#if mode === 'signup'}
<div class=" mt-1 text-xs font-medium text-gray-500">
ⓘ {WEBUI_NAME} does not make any external connections, and your data stays securely on
your locally hosted server.
ⓘ {$WEBUI_NAME}
{$i18n.t(
'does not make any external connections, and your data stays securely on your locally hosted server.'
)}
</div>
{/if}
<div class="flex flex-col mt-4">
{#if mode === 'signup'}
<div>
<div class=" text-sm font-semibold text-left mb-1">Name</div>
<div class=" text-sm font-semibold text-left mb-1">{$i18n.t('Name')}</div>
<input
bind:value={name}
type="text"
class=" border px-4 py-2.5 rounded-2xl w-full text-sm"
autocomplete="name"
placeholder="Enter Your Full Name"
placeholder={$i18n.t('Enter Your Full Name')}
required
/>
</div>
......@@ -118,24 +130,24 @@
{/if}
<div class="mb-2">
<div class=" text-sm font-semibold text-left mb-1">Email</div>
<div class=" text-sm font-semibold text-left mb-1">{$i18n.t('Email')}</div>
<input
bind:value={email}
type="email"
class=" border px-4 py-2.5 rounded-2xl w-full text-sm"
autocomplete="email"
placeholder="Enter Your Email"
placeholder={$i18n.t('Enter Your Email')}
required
/>
</div>
<div>
<div class=" text-sm font-semibold text-left mb-1">Password</div>
<div class=" text-sm font-semibold text-left mb-1">{$i18n.t('Password')}</div>
<input
bind:value={password}
type="password"
class=" border px-4 py-2.5 rounded-2xl w-full text-sm"
placeholder="Enter Your Password"
placeholder={$i18n.t('Enter Your Password')}
autocomplete="current-password"
required
/>
......@@ -147,11 +159,13 @@
class=" bg-gray-900 hover:bg-gray-800 w-full rounded-full text-white font-semibold text-sm py-3 transition"
type="submit"
>
{mode === 'signin' ? 'Sign In' : 'Create Account'}
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Create Account')}
</button>
<div class=" mt-4 text-sm text-center">
{mode === 'signin' ? `Don't have an account?` : `Already have an account?`}
{mode === 'signin'
? $i18n.t("Don't have an account?")
: $i18n.t('Already have an account?')}
<button
class=" font-medium underline"
......@@ -164,7 +178,7 @@
}
}}
>
{mode === 'signin' ? `Sign up` : `Sign In`}
{mode === 'signin' ? $i18n.t('Sign up') : $i18n.t('Sign in')}
</button>
</div>
</div>
......
<script>
import { goto } from '$app/navigation';
import { WEBUI_NAME } from '$lib/constants';
import { config } from '$lib/stores';
import { onMount } from 'svelte';
import { WEBUI_NAME, config } from '$lib/stores';
import { onMount, getContext } from 'svelte';
const i18n = getContext('i18n');
let loaded = false;
......@@ -20,22 +21,25 @@
<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="max-w-md">
<div class="text-center text-2xl font-medium z-50">{WEBUI_NAME} Backend Required</div>
<div class="text-center text-2xl font-medium z-50">
{$i18n.t('{{webUIName}} Backend Required', { webUIName: $WEBUI_NAME })}
</div>
<div class=" mt-4 text-center text-sm w-full">
Oops! You're using an unsupported method (frontend only). Please serve the WebUI from
the backend.
{$i18n.t(
"Oops! You're using an unsupported method (frontend only). Please serve the WebUI from the backend."
)}
<br class=" " />
<br class=" " />
<a
class=" font-semibold underline"
href="https://github.com/ollama-webui/ollama-webui#how-to-install-"
target="_blank">See readme.md for instructions</a
href="https://github.com/open-webui/open-webui#how-to-install-"
target="_blank">{$i18n.t('See readme.md for instructions')}</a
>
or
{$i18n.t('or')}
<a class=" font-semibold underline" href="https://discord.gg/5rJgQTnV4s" target="_blank"
>join our Discord for help.</a
>{$i18n.t('join our Discord for help.')}</a
>
</div>
......@@ -46,7 +50,7 @@
location.href = '/';
}}
>
Check Again
{$i18n.t('Check Again')}
</button>
</div>
</div>
......
......@@ -3,16 +3,13 @@
@tailwind utilities;
@layer base {
html {
html, 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';
}
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;
}
pre {
white-space: pre-wrap;
}
}
{
"model_name": "string",
"litellm_params": {
"model": "ollama/mistral"
}
}
\ No newline at end of file
#!/bin/bash
# update_llm.sh
# Retrieves the list of LLMs installed in the Docker container
llm_list=$(docker exec ollama ollama list | tail -n +2 | awk '{print $1}')
# Loop over each LLM to update it
for llm in $llm_list; do
docker exec ollama ollama pull $llm
done
......@@ -2,5 +2,8 @@ import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit()]
plugins: [sveltekit()],
define: {
APP_VERSION: JSON.stringify(process.env.npm_package_version)
}
});
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