forked from open-webui/open-webui
Tooltip info & warn. Detect file path during update. Add translation.
* Tooltips added to show full model name and warning regarding vector storage * Send toast error and return early if more than a single front slash is detected * Extend toast duration for model update action * Add i18n en_US translation * Remove commented code copied from existing function
This commit is contained in:
parent
9f82f5abba
commit
11741ea7f0
2 changed files with 83 additions and 56 deletions
|
@ -15,6 +15,8 @@
|
||||||
import { onMount, getContext } from 'svelte';
|
import { onMount, getContext } from 'svelte';
|
||||||
import { toast } from 'svelte-sonner';
|
import { toast } from 'svelte-sonner';
|
||||||
|
|
||||||
|
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||||
|
|
||||||
const i18n = getContext('i18n');
|
const i18n = getContext('i18n');
|
||||||
|
|
||||||
export let saveHandler: Function;
|
export let saveHandler: Function;
|
||||||
|
@ -49,16 +51,33 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const embeddingModelUpdateHandler = async () => {
|
const embeddingModelUpdateHandler = async () => {
|
||||||
|
if ((embeddingModel.embedding_model.split("/").length -1) > 1) {
|
||||||
|
toast.error($i18n.t('Model filesystem path detected. Model shortname is required for update, cannot continue.', ));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Update embedding model attempt:', embeddingModel.embedding_model);
|
||||||
|
|
||||||
loading1 = true;
|
loading1 = true;
|
||||||
const res = await updateEmbeddingModel(localStorage.token, embeddingModel);
|
const res = await updateEmbeddingModel(localStorage.token, embeddingModel);
|
||||||
loading1 = false;
|
loading1 = false;
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
console.log('embeddingModelUpdateHandler:', res);
|
console.log('embeddingModelUpdateHandler:', res);
|
||||||
if (res.status == true) {
|
if (res.status === true) {
|
||||||
toast.success($i18n.t('Model {{embedding_model}} update complete!', res));
|
toast.success(
|
||||||
|
$i18n.t('Model {{embedding_model}} update complete!', res),
|
||||||
|
{
|
||||||
|
duration: 1000 * 10,
|
||||||
|
}
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
toast.error($i18n.t('Model {{embedding_model}} update failed or not required!', res));
|
toast.error(
|
||||||
|
$i18n.t('Model {{embedding_model}} update failed or not required!', res),
|
||||||
|
{
|
||||||
|
duration: 1000 * 10,
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -162,37 +181,37 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class=" flex w-full justify-between">
|
|
||||||
<div class=" self-center text-xs font-medium">
|
|
||||||
{$i18n.t('Update embedding model {{embedding_model}}', embeddingModel)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr class=" dark:border-gray-700" />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div class=" flex w-full justify-between">
|
||||||
|
<Tooltip content={
|
||||||
|
$i18n.t('Embedding model: {{embedding_model}}', embeddingModel)
|
||||||
|
}>
|
||||||
|
|
||||||
|
<div class=" self-center text-xs font-medium">
|
||||||
|
{$i18n.t('Update embedding model {{embedding_model}}', { embedding_model: embeddingModel.embedding_model.slice(-40) })}
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
|
|
||||||
|
<Tooltip content={
|
||||||
|
$i18n.t('Understand that updating or changing your embedding model requires reset of the vector database and re-import of all documents. You have been warned!')
|
||||||
|
}>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
class=" self-center text-xs p-1 px-3 bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 rounded flex flex-row space-x-1 items-center {loading1
|
class=" self-center text-xs p-1 px-3 bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 rounded flex flex-row space-x-1 items-center {loading1
|
||||||
? ' cursor-not-allowed'
|
? ' cursor-not-allowed'
|
||||||
: ''}"
|
: ''}"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
embeddingModelUpdateHandler(embeddingModel);
|
embeddingModelUpdateHandler(embeddingModel);
|
||||||
console.log('Update embedding model:', embeddingModel.embedding_model);
|
|
||||||
}}
|
}}
|
||||||
type="button"
|
type="button"
|
||||||
disabled={loading1}
|
disabled={loading1}
|
||||||
>
|
>
|
||||||
<div class="self-center font-medium">{$i18n.t('Update')}</div>
|
<div class="self-center font-medium">{$i18n.t('Update')}</div>
|
||||||
|
|
||||||
<!-- <svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 16 16"
|
|
||||||
fill="currentColor"
|
|
||||||
class="w-3 h-3"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
fill-rule="evenodd"
|
|
||||||
d="M13.836 2.477a.75.75 0 0 1 .75.75v3.182a.75.75 0 0 1-.75.75h-3.182a.75.75 0 0 1 0-1.5h1.37l-.84-.841a4.5 4.5 0 0 0-7.08.932.75.75 0 0 1-1.3-.75 6 6 0 0 1 9.44-1.242l.842.84V3.227a.75.75 0 0 1 .75-.75Zm-.911 7.5A.75.75 0 0 1 13.199 11a6 6 0 0 1-9.44 1.241l-.84-.84v1.371a.75.75 0 0 1-1.5 0V9.591a.75.75 0 0 1 .75-.75H5.35a.75.75 0 0 1 0 1.5H3.98l.841.841a4.5 4.5 0 0 0 7.08-.932.75.75 0 0 1 1.025-.273Z"
|
|
||||||
clip-rule="evenodd"
|
|
||||||
/>
|
|
||||||
</svg> -->
|
|
||||||
|
|
||||||
{#if loading1}
|
{#if loading1}
|
||||||
<div class="ml-3 self-center">
|
<div class="ml-3 self-center">
|
||||||
<svg
|
<svg
|
||||||
|
@ -221,6 +240,7 @@
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,7 @@
|
||||||
"Edit Doc": "",
|
"Edit Doc": "",
|
||||||
"Edit User": "",
|
"Edit User": "",
|
||||||
"Email": "",
|
"Email": "",
|
||||||
|
"Embedding model: {{embedding_model}}": "",
|
||||||
"Enable Chat History": "",
|
"Enable Chat History": "",
|
||||||
"Enable New Sign Ups": "",
|
"Enable New Sign Ups": "",
|
||||||
"Enabled": "",
|
"Enabled": "",
|
||||||
|
@ -193,8 +194,11 @@
|
||||||
"MMMM DD, YYYY": "",
|
"MMMM DD, YYYY": "",
|
||||||
"Model '{{modelName}}' has been successfully downloaded.": "",
|
"Model '{{modelName}}' has been successfully downloaded.": "",
|
||||||
"Model '{{modelTag}}' is already in queue for downloading.": "",
|
"Model '{{modelTag}}' is already in queue for downloading.": "",
|
||||||
|
"Model {{embedding_model}} update complete!": "",
|
||||||
|
"Model {{embedding_model}} update failed or not required!": "",
|
||||||
"Model {{modelId}} not found": "",
|
"Model {{modelId}} not found": "",
|
||||||
"Model {{modelName}} already exists.": "",
|
"Model {{modelName}} already exists.": "",
|
||||||
|
"Model filesystem path detected. Model shortname is required for update, cannot continue.": "",
|
||||||
"Model Name": "",
|
"Model Name": "",
|
||||||
"Model not selected": "",
|
"Model not selected": "",
|
||||||
"Model Tag Name": "",
|
"Model Tag Name": "",
|
||||||
|
@ -332,7 +336,10 @@
|
||||||
"TTS Settings": "",
|
"TTS Settings": "",
|
||||||
"Type Hugging Face Resolve (Download) URL": "",
|
"Type Hugging Face Resolve (Download) URL": "",
|
||||||
"Uh-oh! There was an issue connecting to {{provider}}.": "",
|
"Uh-oh! There was an issue connecting to {{provider}}.": "",
|
||||||
|
"Understand that updating or changing your embedding model requires reset of the vector database and re-import of all documents. You have been warned!": "",
|
||||||
"Unknown File Type '{{file_type}}', but accepting and treating as plain text": "",
|
"Unknown File Type '{{file_type}}', but accepting and treating as plain text": "",
|
||||||
|
"Update": "",
|
||||||
|
"Update embedding model {{embedding_model}}": "",
|
||||||
"Update password": "",
|
"Update password": "",
|
||||||
"Upload a GGUF model": "",
|
"Upload a GGUF model": "",
|
||||||
"Upload files": "",
|
"Upload files": "",
|
||||||
|
|
Loading…
Reference in a new issue