Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
db0712ae
Unverified
Commit
db0712ae
authored
Mar 16, 2024
by
Danny Liu
Committed by
GitHub
Mar 16, 2024
Browse files
Merge branch 'dev' into feat/system-wide-theme
parents
f1716f45
e414b9ea
Changes
90
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
193 additions
and
139 deletions
+193
-139
src/routes/(app)/modelfiles/create/+page.svelte
src/routes/(app)/modelfiles/create/+page.svelte
+36
-30
src/routes/(app)/modelfiles/edit/+page.svelte
src/routes/(app)/modelfiles/edit/+page.svelte
+18
-16
src/routes/(app)/playground/+page.svelte
src/routes/(app)/playground/+page.svelte
+17
-12
src/routes/(app)/prompts/+page.svelte
src/routes/(app)/prompts/+page.svelte
+12
-10
src/routes/(app)/prompts/create/+page.svelte
src/routes/(app)/prompts/create/+page.svelte
+33
-23
src/routes/(app)/prompts/edit/+page.svelte
src/routes/(app)/prompts/edit/+page.svelte
+35
-19
src/routes/+layout.svelte
src/routes/+layout.svelte
+3
-0
src/routes/auth/+page.svelte
src/routes/auth/+page.svelte
+22
-14
src/routes/error/+page.svelte
src/routes/error/+page.svelte
+13
-8
src/tailwind.css
src/tailwind.css
+4
-7
No files found.
src/routes/(app)/modelfiles/create/+page.svelte
View file @
db0712ae
...
...
@@ -6,10 +6,12 @@
import AdvancedParams from '$lib/components/chat/Settings/Advanced/AdvancedParams.svelte';
import { splitStream } from '$lib/utils';
import { onMount, tick } from 'svelte';
import { onMount, tick
, getContext
} from 'svelte';
import { createModel } from '$lib/apis/ollama';
import { createNewModelfile, getModelfileByTagName, getModelfiles } from '$lib/apis/modelfiles';
const i18n = getContext('i18n');
let loading = false;
let filesInputElement;
...
...
@@ -349,7 +351,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
}}
/>
<div class=" text-2xl font-semibold mb-6">My Modelfiles</div>
<div class=" text-2xl font-semibold mb-6">
{$i18n.t('
My Modelfiles
')}
</div>
<button
class="flex space-x-1"
...
...
@@ -371,7 +373,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
/>
</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" />
...
...
@@ -418,12 +420,12 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
<div class="my-2 flex space-x-2">
<div class="flex-1">
<div class=" text-sm font-semibold mb-2">Name*</div>
<div class=" text-sm font-semibold mb-2">
{$i18n.t('
Name
')}
*</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=
"
Name your modelfile
"
placeholder=
{$i18n.t('
Name your modelfile
')}
bind:value={title}
required
/>
...
...
@@ -431,12 +433,12 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div>
<div class="flex-1">
<div class=" text-sm font-semibold mb-2">Model Tag Name*</div>
<div class=" text-sm font-semibold mb-2">
{$i18n.t('
Model Tag Name
')}
*</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 model tag name
"
placeholder=
{$i18n.t('
Add a model tag name
')}
bind:value={tagName}
required
/>
...
...
@@ -445,12 +447,12 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div>
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Description*</div>
<div class=" text-sm font-semibold mb-2">
{$i18n.t('
Description
')}
*</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 description about what this modelfile does
"
placeholder=
{$i18n.t('
Add a short description about what this modelfile does
')}
bind:value={desc}
required
/>
...
...
@@ -459,7 +461,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
<div class="my-2">
<div class="flex w-full justify-between">
<div class=" self-center text-sm font-semibold">Modelfile</div>
<div class=" self-center text-sm font-semibold">
{$i18n.t('
Modelfile
')}
</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
...
...
@@ -469,9 +471,9 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
}}
>
{#if raw}
<span class="ml-2 self-center"> Raw Format </span>
<span class="ml-2 self-center">
{$i18n.t('
Raw Format
')}
</span>
{:else}
<span class="ml-2 self-center"> Builder Mode </span>
<span class="ml-2 self-center">
{$i18n.t('
Builder Mode
')}
</span>
{/if}
</button>
</div>
...
...
@@ -480,7 +482,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
{#if raw}
<div class="mt-2">
<div class=" text-xs font-semibold mb-2">Content*</div>
<div class=" text-xs font-semibold mb-2">
{$i18n.t('
Content
')}
*</div>
<div>
<textarea
...
...
@@ -493,12 +495,13 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div>
<div class="text-xs text-gray-400 dark:text-gray-500">
Not sure what to write? Switch to <button
{$i18n.t('Not sure what to write? Switch to')}
<button
class="text-gray-500 dark:text-gray-300 font-medium cursor-pointer"
type="button"
on:click={() => {
raw = !raw;
}}>Builder Mode</button
}}>
{$i18n.t('
Builder Mode
')}
</button
>
or
<a
...
...
@@ -506,13 +509,13 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
href="https://openwebui.com"
target="_blank"
>
Click here to check other modelfiles.
{$i18n.t('
Click here to check other modelfiles.
')}
</a>
</div>
</div>
{:else}
<div class="my-2">
<div class=" text-xs font-semibold mb-2">From (Base Model)*</div>
<div class=" text-xs font-semibold mb-2">
{$i18n.t('
From (Base Model)
')}
*</div>
<div>
<input
...
...
@@ -524,16 +527,17 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div>
<div class="mt-1 text-xs text-gray-400 dark:text-gray-500">
To access the available model names for downloading, <a
{$i18n.t('To access the available model names for downloading,')}
<a
class=" text-gray-500 dark:text-gray-300 font-medium"
href="https://ollama.com/library"
target="_blank">click here.</a
target="_blank">
{$i18n.t('
click here.
')}
</a
>
</div>
</div>
<div class="my-1">
<div class=" text-xs font-semibold mb-2">System Prompt</div>
<div class=" text-xs font-semibold mb-2">
{$i18n.t('
System Prompt
')}
</div>
<div>
<textarea
...
...
@@ -546,7 +550,9 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div>
<div class="flex w-full justify-between">
<div class=" self-center text-sm font-semibold">Modelfile Advanced Settings</div>
<div class=" self-center text-sm font-semibold">
{$i18n.t('Modelfile Advanced Settings')}
</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
...
...
@@ -556,16 +562,16 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
}}
>
{#if advanced}
<span class="ml-2 self-center">
Custom
</span>
<span class="ml-2 self-center">
{$i18n.t('
Custom
')}
</span>
{:else}
<span class="ml-2 self-center">
Default
</span>
<span class="ml-2 self-center">
{$i18n.t('
Default
')}
</span>
{/if}
</button>
</div>
{#if advanced}
<div class="my-2">
<div class=" text-xs font-semibold mb-2">Template</div>
<div class=" text-xs font-semibold mb-2">
{$i18n.t('
Template
')}
</div>
<div>
<textarea
...
...
@@ -578,7 +584,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div>
<div class="my-2">
<div class=" text-xs font-semibold mb-2">Parameters</div>
<div class=" text-xs font-semibold mb-2">
{$i18n.t('
Parameters
')}
</div>
<div>
<AdvancedParams bind:options />
...
...
@@ -590,7 +596,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
<div class="my-2">
<div class="flex w-full justify-between mb-2">
<div class=" self-center text-sm font-semibold">Prompt suggestions</div>
<div class=" self-center text-sm font-semibold">
{$i18n.t('
Prompt suggestions
')}
</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
...
...
@@ -618,7 +624,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
<div class=" flex border dark:border-gray-600 rounded-lg">
<input
class="px-3 py-1.5 text-sm w-full bg-transparent outline-none border-r dark:border-gray-600"
placeholder=
"
Write a prompt suggestion (e.g. Who are you?)
"
placeholder=
{$i18n.t('
Write a prompt suggestion (e.g. Who are you?)
')}
bind:value={prompt.content}
/>
...
...
@@ -647,7 +653,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div>
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Categories</div>
<div class=" text-sm font-semibold mb-2">
{$i18n.t('
Categories
')}
</div>
<div class="grid grid-cols-4">
{#each Object.keys(categories) as category}
...
...
@@ -661,7 +667,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
{#if pullProgress !== null}
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Pull Progress</div>
<div class=" text-sm font-semibold mb-2">
{$i18n.t('
Pull Progress
')}
</div>
<div class="w-full rounded-full dark:bg-gray-800">
<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"
...
...
@@ -684,7 +690,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
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">
...
...
src/routes/(app)/modelfiles/edit/+page.svelte
View file @
db0712ae
...
...
@@ -3,7 +3,7 @@
import { toast } from 'svelte-sonner';
import { goto } from '$app/navigation';
import { onMount } from 'svelte';
import { onMount
, getContext
} from 'svelte';
import { page } from '$app/stores';
import { settings, user, config, modelfiles } from '$lib/stores';
...
...
@@ -14,6 +14,8 @@
import AdvancedParams from '$lib/components/chat/Settings/Advanced/AdvancedParams.svelte';
const i18n = getContext('i18n');
let loading = false;
let filesInputElement;
...
...
@@ -248,7 +250,7 @@
}}
/>
<div class=" text-2xl font-semibold mb-6">My Modelfiles</div>
<div class=" text-2xl font-semibold mb-6">
{$i18n.t('
My Modelfiles
')}
</div>
<button
class="flex space-x-1"
...
...
@@ -270,7 +272,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" />
...
...
@@ -317,12 +319,12 @@
<div class="my-2 flex space-x-2">
<div class="flex-1">
<div class=" text-sm font-semibold mb-2">Name*</div>
<div class=" text-sm font-semibold mb-2">
{$i18n.t('
Name
')}
*</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=
"
Name your modelfile
"
placeholder=
{$i18n.t('
Name your modelfile
')}
bind:value={title}
required
/>
...
...
@@ -330,12 +332,12 @@
</div>
<div class="flex-1">
<div class=" text-sm font-semibold mb-2">Model Tag Name*</div>
<div class=" text-sm font-semibold mb-2">
{$i18n.t('
Model Tag Name
')}
*</div>
<div>
<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"
placeholder=
"
Add a model tag name
"
placeholder=
{$i18n.t('
Add a model tag name
')}
value={tagName}
disabled
required
...
...
@@ -345,12 +347,12 @@
</div>
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Description*</div>
<div class=" text-sm font-semibold mb-2">
{$i18n.t('
Description
')}
*</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 description about what this modelfile does
"
placeholder=
{$i18n.t('
Add a short description about what this modelfile does
')}
bind:value={desc}
required
/>
...
...
@@ -359,13 +361,13 @@
<div class="my-2">
<div class="flex w-full justify-between">
<div class=" self-center text-sm font-semibold">Modelfile</div>
<div class=" self-center text-sm font-semibold">
{$i18n.t('
Modelfile
')}
</div>
</div>
<!-- <div class=" text-sm font-semibold mb-2"></div> -->
<div class="mt-2">
<div class=" text-xs font-semibold mb-2">Content*</div>
<div class=" text-xs font-semibold mb-2">
{$i18n.t('
Content
')}
*</div>
<div>
<textarea
...
...
@@ -381,7 +383,7 @@
<div class="my-2">
<div class="flex w-full justify-between mb-2">
<div class=" self-center text-sm font-semibold">Prompt suggestions</div>
<div class=" self-center text-sm font-semibold">
{$i18n.t('
Prompt suggestions
')}
</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
...
...
@@ -409,7 +411,7 @@
<div class=" flex border dark:border-gray-600 rounded-lg">
<input
class="px-3 py-1.5 text-sm w-full bg-transparent outline-none border-r dark:border-gray-600"
placeholder=
"
Write a prompt suggestion (e.g. Who are you?)
"
placeholder=
{$i18n.t('
Write a prompt suggestion (e.g. Who are you?)
')}
bind:value={prompt.content}
/>
...
...
@@ -438,7 +440,7 @@
</div>
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Categories</div>
<div class=" text-sm font-semibold mb-2">
{$i18n.t('
Categories
')}
</div>
<div class="grid grid-cols-4">
{#each Object.keys(categories) as category}
...
...
@@ -453,7 +455,7 @@
{#if pullProgress !== null}
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Pull Progress</div>
<div class=" text-sm font-semibold mb-2">
{$i18n.t('
Pull Progress
')}
</div>
<div class="w-full rounded-full dark:bg-gray-800">
<div
class="dark:bg-gray-600 text-xs font-medium text-blue-100 text-center p-0.5 leading-none rounded-full"
...
...
@@ -476,7 +478,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">
...
...
src/routes/(app)/playground/+page.svelte
View file @
db0712ae
<script lang="ts">
import { goto } from '$app/navigation';
import { onMount, tick } from 'svelte';
import { onMount, tick
, getContext
} from 'svelte';
import { toast } from 'svelte-sonner';
...
...
@@ -19,6 +19,8 @@
import { splitStream } from '$lib/utils';
import ChatCompletion from '$lib/components/playground/ChatCompletion.svelte';
const i18n = getContext('i18n');
let mode = 'chat';
let loaded = false;
let text = '';
...
...
@@ -261,18 +263,19 @@
<svelte:head>
<title>
{
`
Playground |
$
{$WEBUI_NAME}
`}
{
$i18n.t('
Playground
')}
| {$WEBUI_NAME}
</title>
</svelte:head>
<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 h-[100dvh]">
<div class="max-w-2xl mx-auto w-full px-3
p-3
md:px-0 h-full">
<div class="max-w-2xl mx-auto w-full px-3 md:px-0
my-10
h-full">
<div class=" flex flex-col h-full">
<div class="flex flex-col justify-between mb-2.5 gap-1">
<div class="flex justify-between items-center gap-2">
<div class=" text-2xl font-semibold self-center flex">
Playground <span class=" text-xs text-gray-500 self-center ml-1">(Beta)</span>
{$i18n.t('Playground')}
<span class=" text-xs text-gray-500 self-center ml-1">{$i18n.t('(Beta)')}</span>
</div>
<div>
...
...
@@ -289,9 +292,9 @@
}}
>
{#if mode === 'complete'}
Text Completion
{$i18n.t('
Text Completion
')}
{:else if mode === 'chat'}
Chat
{$i18n.t('
Chat
')}
{/if}
<div>
...
...
@@ -318,7 +321,9 @@
class="outline-none bg-transparent text-sm font-medium rounded-lg w-full placeholder-gray-400"
bind:value={selectedModelId}
>
<option class=" text-gray-800" value="" selected disabled>Select a model</option>
<option class=" text-gray-800" value="" selected disabled
>{$i18n.t('Select a model')}</option
>
{#each $models as model}
{#if model.name === 'hr'}
...
...
@@ -363,12 +368,12 @@
{#if mode === 'chat'}
<div class="p-1">
<div class="p-3 outline outline-1 outline-gray-200 dark:outline-gray-800 rounded-lg">
<div class=" text-sm font-medium">System</div>
<div class=" text-sm font-medium">
{$i18n.t('
System
')}
</div>
<textarea
id="system-textarea"
class="w-full h-full bg-transparent resize-none outline-none text-sm"
bind:value={system}
placeholder="You're a helpful assistant."
placeholder=
{$i18n.t(
"You're a helpful assistant."
)}
rows="4"
/>
</div>
...
...
@@ -388,7 +393,7 @@
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"
bind:value={text}
placeholder="You're a helpful assistant."
placeholder=
{$i18n.t(
"You're a helpful assistant."
)}
/>
{:else if mode === 'chat'}
<ChatCompletion bind:messages />
...
...
@@ -405,7 +410,7 @@
submitHandler();
}}
>
Submit
{$i18n.t('
Submit
')}
</button>
{:else}
<button
...
...
@@ -414,7 +419,7 @@
stopResponse();
}}
>
Cancel
{$i18n.t('
Cancel
')}
</button>
{/if}
</div>
...
...
src/routes/(app)/prompts/+page.svelte
View file @
db0712ae
...
...
@@ -3,17 +3,19 @@
import fileSaver from 'file-saver';
const { saveAs } = fileSaver;
import { onMount } from 'svelte';
import { onMount
, getContext
} from 'svelte';
import { WEBUI_NAME, prompts } from '$lib/stores';
import { createNewPrompt, deletePromptByCommand, getPrompts } from '$lib/apis/prompts';
import { error } from '@sveltejs/kit';
import { goto } from '$app/navigation';
const i18n = getContext('i18n');
let importFiles = '';
let query = '';
let promptsImportInputElement: HTMLInputElement;
const sharePrompt = async (prompt) => {
toast.success('Redirecting you to OpenWebUI Community');
toast.success(
$i18n.t(
'Redirecting you to OpenWebUI Community')
)
;
const url = 'https://openwebui.com';
...
...
@@ -38,7 +40,7 @@
<svelte:head>
<title>
{
`
Prompts |
$
{$WEBUI_NAME}
`}
{
$i18n.t('
Prompts
')}
| {$WEBUI_NAME}
</title>
</svelte:head>
...
...
@@ -46,7 +48,7 @@
<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="mb-6 flex justify-between items-center">
<div class=" text-2xl font-semibold self-center">My Prompts</div>
<div class=" text-2xl font-semibold self-center">
{$i18n.t('
My Prompts
')}
</div>
</div>
<div class=" flex w-full space-x-2">
...
...
@@ -68,7 +70,7 @@
<input
class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-none bg-transparent"
bind:value={query}
placeholder=
"
Search Prompt
"
placeholder=
{$i18n.t('
Search Prompt
s')}
/>
</div>
...
...
@@ -246,7 +248,7 @@
promptsImportInputElement.click();
}}
>
<div class=" self-center mr-2 font-medium">Import Prompts</div>
<div class=" self-center mr-2 font-medium">
{$i18n.t('
Import Prompts
')}
</div>
<div class=" self-center">
<svg
...
...
@@ -274,7 +276,7 @@
saveAs(blob, `prompts-export-${Date.now()}.json`);
}}
>
<div class=" self-center mr-2 font-medium">Export Prompts</div>
<div class=" self-center mr-2 font-medium">
{$i18n.t('
Export Prompts
')}
</div>
<div class=" self-center">
<svg
...
...
@@ -303,7 +305,7 @@
</div>
<div class=" my-16">
<div class=" text-2xl font-semibold mb-3">Made by OpenWebUI Community</div>
<div class=" text-2xl font-semibold mb-3">
{$i18n.t('
Made by OpenWebUI Community
')}
</div>
<a
class=" flex space-x-4 cursor-pointer w-full mb-3 px-3 py-2"
...
...
@@ -330,8 +332,8 @@
</div>
<div class=" self-center">
<div class=" font-bold">Discover a prompt</div>
<div class=" text-sm">Discover, download, and explore custom prompts</div>
<div class=" font-bold">
{$i18n.t('
Discover a prompt
')}
</div>
<div class=" text-sm">
{$i18n.t('
Discover, download, and explore custom prompts
')}
</div>
</div>
</a>
</div>
...
...
src/routes/(app)/prompts/create/+page.svelte
View file @
db0712ae
...
...
@@ -3,10 +3,12 @@
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;
...
...
@@ -92,7 +96,7 @@
<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="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"
...
...
@@ -114,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" />
...
...
@@ -125,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
/>
...
...
@@ -138,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
...
...
@@ -148,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
')}
"<span
class=" text-gray-600 dark:text-gray-300 font-medium"
>
/{command}
</span>" to chat input.
</span>"
{$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
...
...
@@ -183,18 +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:
')}
<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">
Utilize <span class=" text-gray-600 dark:text-gray-300 font-medium"
>{`{{CLIPBOARD}}`}</span
> variable to have them replaced with clipboard content.
{$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>
...
...
@@ -207,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">
...
...
src/routes/(app)/prompts/edit/+page.svelte
View file @
db0712ae
...
...
@@ -3,7 +3,9 @@
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;
...
...
@@ -74,7 +78,7 @@
<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="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
')}
"<span
class=" text-gray-600 dark:text-gray-300 font-medium"
>
/{command}
</span>" to chat input.
</span>"
{$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:
')}
<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">
...
...
src/routes/+layout.svelte
View file @
db0712ae
...
...
@@ -11,6 +11,9 @@
import '../tailwind.css';
import 'tippy.js/dist/tippy.css';
import { WEBUI_BASE_URL } from '$lib/constants';
import i18n from '$lib/i18n';
setContext('i18n', i18n);
let loaded = false;
...
...
src/routes/auth/+page.svelte
View file @
db0712ae
...
...
@@ -3,9 +3,11 @@
import { userSignIn, userSignUp } from '$lib/apis/auths';
import { WEBUI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants';
import { WEBUI_NAME, config, user } from '$lib/stores';
import { onMount } from 'svelte';
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('/');
...
...
@@ -96,26 +98,30 @@
}}
>
<div class=" text-xl sm:text-2xl font-bold">
{mode === 'signin' ? 'Sign in' : 'Sign up'} to {$WEBUI_NAME}
{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>
...
...
@@ -124,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
/>
...
...
@@ -153,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
I
n' : 'Create Account'}
{mode === 'signin' ?
$i18n.t(
'Sign
i
n'
)
:
$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"
...
...
@@ -170,7 +178,7 @@
}
}}
>
{mode === 'signin' ?
`
Sign up
`
:
`
Sign
In`
}
{mode === 'signin' ?
$i18n.t('
Sign up
')
:
$i18n.t('
Sign
in')
}
</button>
</div>
</div>
...
...
src/routes/error/+page.svelte
View file @
db0712ae
<script>
import { goto } from '$app/navigation';
import { WEBUI_NAME, config } from '$lib/stores';
import { onMount } from 'svelte';
import { onMount, getContext } from 'svelte';
const i18n = getContext('i18n');
let loaded = false;
...
...
@@ -19,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/open-webui/open-webui#how-to-install-"
target="_blank">See readme.md for instructions</a
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>
...
...
@@ -45,7 +50,7 @@
location.href = '/';
}}
>
Check Again
{$i18n.t('
Check Again
')}
</button>
</div>
</div>
...
...
src/tailwind.css
View file @
db0712ae
...
...
@@ -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
;
}
}
Prev
1
2
3
4
5
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment