|
@@ -5,22 +5,17 @@
|
|
import {
|
|
import {
|
|
createModel,
|
|
createModel,
|
|
deleteModel,
|
|
deleteModel,
|
|
- downloadModel,
|
|
|
|
getOllamaUrls,
|
|
getOllamaUrls,
|
|
getOllamaVersion,
|
|
getOllamaVersion,
|
|
- pullModel,
|
|
|
|
- cancelOllamaRequest,
|
|
|
|
- uploadModel
|
|
|
|
|
|
+ pullModel
|
|
} from '$lib/apis/ollama';
|
|
} from '$lib/apis/ollama';
|
|
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, models, user } from '$lib/stores';
|
|
import { WEBUI_NAME, models, user } from '$lib/stores';
|
|
import { splitStream } from '$lib/utils';
|
|
import { splitStream } from '$lib/utils';
|
|
- import { onMount, getContext } from 'svelte';
|
|
|
|
|
|
+ import { onMount } from 'svelte';
|
|
import { addLiteLLMModel, deleteLiteLLMModel, getLiteLLMModelInfo } from '$lib/apis/litellm';
|
|
import { addLiteLLMModel, deleteLiteLLMModel, getLiteLLMModelInfo } from '$lib/apis/litellm';
|
|
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
|
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
|
|
|
|
|
- const i18n = getContext('i18n');
|
|
|
|
-
|
|
|
|
export let getModels: Function;
|
|
export let getModels: Function;
|
|
|
|
|
|
let showLiteLLM = false;
|
|
let showLiteLLM = false;
|
|
@@ -63,13 +58,11 @@
|
|
let pullProgress = null;
|
|
let pullProgress = null;
|
|
|
|
|
|
let modelUploadMode = 'file';
|
|
let modelUploadMode = 'file';
|
|
- let modelInputFile: File[] | null = null;
|
|
|
|
|
|
+ let modelInputFile = '';
|
|
let modelFileUrl = '';
|
|
let modelFileUrl = '';
|
|
let modelFileContent = `TEMPLATE """{{ .System }}\nUSER: {{ .Prompt }}\nASSISTANT: """\nPARAMETER num_ctx 4096\nPARAMETER stop "</s>"\nPARAMETER stop "USER:"\nPARAMETER stop "ASSISTANT:"`;
|
|
let modelFileContent = `TEMPLATE """{{ .System }}\nUSER: {{ .Prompt }}\nASSISTANT: """\nPARAMETER num_ctx 4096\nPARAMETER stop "</s>"\nPARAMETER stop "USER:"\nPARAMETER stop "ASSISTANT:"`;
|
|
let modelFileDigest = '';
|
|
let modelFileDigest = '';
|
|
-
|
|
|
|
let uploadProgress = null;
|
|
let uploadProgress = null;
|
|
- let uploadMessage = '';
|
|
|
|
|
|
|
|
let deleteModelTag = '';
|
|
let deleteModelTag = '';
|
|
|
|
|
|
@@ -141,17 +134,11 @@
|
|
const pullModelHandler = async () => {
|
|
const pullModelHandler = async () => {
|
|
const sanitizedModelTag = modelTag.trim();
|
|
const sanitizedModelTag = modelTag.trim();
|
|
if (modelDownloadStatus[sanitizedModelTag]) {
|
|
if (modelDownloadStatus[sanitizedModelTag]) {
|
|
- toast.error(
|
|
|
|
- $i18n.t(`Model '{{modelTag}}' is already in queue for downloading.`, {
|
|
|
|
- modelTag: sanitizedModelTag
|
|
|
|
- })
|
|
|
|
- );
|
|
|
|
|
|
+ toast.error(`Model '${sanitizedModelTag}' is already in queue for downloading.`);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (Object.keys(modelDownloadStatus).length === 3) {
|
|
if (Object.keys(modelDownloadStatus).length === 3) {
|
|
- toast.error(
|
|
|
|
- $i18n.t('Maximum of 3 models can be downloaded simultaneously. Please try again later.')
|
|
|
|
- );
|
|
|
|
|
|
+ toast.error('Maximum of 3 models can be downloaded simultaneously. Please try again later.');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -164,17 +151,15 @@
|
|
// Remove the downloaded model
|
|
// Remove the downloaded model
|
|
delete modelDownloadStatus[modelName];
|
|
delete modelDownloadStatus[modelName];
|
|
|
|
|
|
- modelDownloadStatus = { ...modelDownloadStatus };
|
|
|
|
|
|
+ console.log(data);
|
|
|
|
|
|
if (!data.success) {
|
|
if (!data.success) {
|
|
toast.error(data.error);
|
|
toast.error(data.error);
|
|
} else {
|
|
} else {
|
|
- toast.success(
|
|
|
|
- $i18n.t(`Model '{{modelName}}' has been successfully downloaded.`, { modelName })
|
|
|
|
- );
|
|
|
|
|
|
+ toast.success(`Model '${modelName}' has been successfully downloaded.`);
|
|
|
|
|
|
const notification = new Notification($WEBUI_NAME, {
|
|
const notification = new Notification($WEBUI_NAME, {
|
|
- body: $i18n.t(`Model '{{modelName}}' has been successfully downloaded.`, { modelName }),
|
|
|
|
|
|
+ body: `Model '${modelName}' has been successfully downloaded.`,
|
|
icon: `${WEBUI_BASE_URL}/static/favicon.png`
|
|
icon: `${WEBUI_BASE_URL}/static/favicon.png`
|
|
});
|
|
});
|
|
|
|
|
|
@@ -189,32 +174,35 @@
|
|
|
|
|
|
const uploadModelHandler = async () => {
|
|
const uploadModelHandler = async () => {
|
|
modelTransferring = true;
|
|
modelTransferring = true;
|
|
|
|
+ uploadProgress = 0;
|
|
|
|
|
|
let uploaded = false;
|
|
let uploaded = false;
|
|
let fileResponse = null;
|
|
let fileResponse = null;
|
|
let name = '';
|
|
let name = '';
|
|
|
|
|
|
if (modelUploadMode === 'file') {
|
|
if (modelUploadMode === 'file') {
|
|
- const file = modelInputFile ? modelInputFile[0] : null;
|
|
|
|
-
|
|
|
|
- if (file) {
|
|
|
|
- uploadMessage = 'Uploading...';
|
|
|
|
-
|
|
|
|
- fileResponse = await uploadModel(localStorage.token, file, selectedOllamaUrlIdx).catch(
|
|
|
|
- (error) => {
|
|
|
|
- toast.error(error);
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
|
|
+ const file = modelInputFile[0];
|
|
|
|
+ const formData = new FormData();
|
|
|
|
+ formData.append('file', file);
|
|
|
|
+
|
|
|
|
+ fileResponse = await fetch(`${WEBUI_API_BASE_URL}/utils/upload`, {
|
|
|
|
+ method: 'POST',
|
|
|
|
+ headers: {
|
|
|
|
+ ...($user && { Authorization: `Bearer ${localStorage.token}` })
|
|
|
|
+ },
|
|
|
|
+ body: formData
|
|
|
|
+ }).catch((error) => {
|
|
|
|
+ console.log(error);
|
|
|
|
+ return null;
|
|
|
|
+ });
|
|
} else {
|
|
} else {
|
|
- uploadProgress = 0;
|
|
|
|
- fileResponse = await downloadModel(
|
|
|
|
- localStorage.token,
|
|
|
|
- modelFileUrl,
|
|
|
|
- selectedOllamaUrlIdx
|
|
|
|
- ).catch((error) => {
|
|
|
|
- toast.error(error);
|
|
|
|
|
|
+ fileResponse = await fetch(`${WEBUI_API_BASE_URL}/utils/download?url=${modelFileUrl}`, {
|
|
|
|
+ method: 'GET',
|
|
|
|
+ headers: {
|
|
|
|
+ ...($user && { Authorization: `Bearer ${localStorage.token}` })
|
|
|
|
+ }
|
|
|
|
+ }).catch((error) => {
|
|
|
|
+ console.log(error);
|
|
return null;
|
|
return null;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -237,9 +225,6 @@
|
|
let data = JSON.parse(line.replace(/^data: /, ''));
|
|
let data = JSON.parse(line.replace(/^data: /, ''));
|
|
|
|
|
|
if (data.progress) {
|
|
if (data.progress) {
|
|
- if (uploadMessage) {
|
|
|
|
- uploadMessage = '';
|
|
|
|
- }
|
|
|
|
uploadProgress = data.progress;
|
|
uploadProgress = data.progress;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -258,9 +243,6 @@
|
|
console.log(error);
|
|
console.log(error);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- const error = await fileResponse?.json();
|
|
|
|
- toast.error(error?.detail ?? error);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if (uploaded) {
|
|
if (uploaded) {
|
|
@@ -326,11 +308,7 @@
|
|
}
|
|
}
|
|
|
|
|
|
modelFileUrl = '';
|
|
modelFileUrl = '';
|
|
-
|
|
|
|
- if (modelUploadInputElement) {
|
|
|
|
- modelUploadInputElement.value = '';
|
|
|
|
- }
|
|
|
|
- modelInputFile = null;
|
|
|
|
|
|
+ modelInputFile = '';
|
|
modelTransferring = false;
|
|
modelTransferring = false;
|
|
uploadProgress = null;
|
|
uploadProgress = null;
|
|
|
|
|
|
@@ -345,7 +323,7 @@
|
|
);
|
|
);
|
|
|
|
|
|
if (res) {
|
|
if (res) {
|
|
- toast.success($i18n.t(`Deleted {{deleteModelTag}}`, { deleteModelTag }));
|
|
|
|
|
|
+ toast.success(`Deleted ${deleteModelTag}`);
|
|
}
|
|
}
|
|
|
|
|
|
deleteModelTag = '';
|
|
deleteModelTag = '';
|
|
@@ -376,24 +354,12 @@
|
|
for (const line of lines) {
|
|
for (const line of lines) {
|
|
if (line !== '') {
|
|
if (line !== '') {
|
|
let data = JSON.parse(line);
|
|
let data = JSON.parse(line);
|
|
- console.log(data);
|
|
|
|
if (data.error) {
|
|
if (data.error) {
|
|
throw data.error;
|
|
throw data.error;
|
|
}
|
|
}
|
|
if (data.detail) {
|
|
if (data.detail) {
|
|
throw data.detail;
|
|
throw data.detail;
|
|
}
|
|
}
|
|
-
|
|
|
|
- if (data.id) {
|
|
|
|
- modelDownloadStatus[opts.modelName] = {
|
|
|
|
- ...modelDownloadStatus[opts.modelName],
|
|
|
|
- requestId: data.id,
|
|
|
|
- reader,
|
|
|
|
- done: false
|
|
|
|
- };
|
|
|
|
- console.log(data);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if (data.status) {
|
|
if (data.status) {
|
|
if (data.digest) {
|
|
if (data.digest) {
|
|
let downloadProgress = 0;
|
|
let downloadProgress = 0;
|
|
@@ -403,17 +369,11 @@
|
|
downloadProgress = 100;
|
|
downloadProgress = 100;
|
|
}
|
|
}
|
|
modelDownloadStatus[opts.modelName] = {
|
|
modelDownloadStatus[opts.modelName] = {
|
|
- ...modelDownloadStatus[opts.modelName],
|
|
|
|
pullProgress: downloadProgress,
|
|
pullProgress: downloadProgress,
|
|
digest: data.digest
|
|
digest: data.digest
|
|
};
|
|
};
|
|
} else {
|
|
} else {
|
|
toast.success(data.status);
|
|
toast.success(data.status);
|
|
-
|
|
|
|
- modelDownloadStatus[opts.modelName] = {
|
|
|
|
- ...modelDownloadStatus[opts.modelName],
|
|
|
|
- done: data.status === 'success'
|
|
|
|
- };
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -426,14 +386,7 @@
|
|
opts.callback({ success: false, error, modelName: opts.modelName });
|
|
opts.callback({ success: false, error, modelName: opts.modelName });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- console.log(modelDownloadStatus[opts.modelName]);
|
|
|
|
-
|
|
|
|
- if (modelDownloadStatus[opts.modelName].done) {
|
|
|
|
- opts.callback({ success: true, modelName: opts.modelName });
|
|
|
|
- } else {
|
|
|
|
- opts.callback({ success: false, error: 'Download canceled', modelName: opts.modelName });
|
|
|
|
- }
|
|
|
|
|
|
+ opts.callback({ success: true, modelName: opts.modelName });
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
@@ -457,7 +410,7 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- toast.error($i18n.t(`Model {{modelName}} already exists.`, { modelName: liteLLMModelName }));
|
|
|
|
|
|
+ toast.error(`Model ${liteLLMModelName} already exists.`);
|
|
}
|
|
}
|
|
|
|
|
|
liteLLMModelName = '';
|
|
liteLLMModelName = '';
|
|
@@ -503,25 +456,13 @@
|
|
ollamaVersion = await getOllamaVersion(localStorage.token).catch((error) => false);
|
|
ollamaVersion = await getOllamaVersion(localStorage.token).catch((error) => false);
|
|
liteLLMModelInfo = await getLiteLLMModelInfo(localStorage.token);
|
|
liteLLMModelInfo = await getLiteLLMModelInfo(localStorage.token);
|
|
});
|
|
});
|
|
-
|
|
|
|
- const cancelModelPullHandler = async (model: string) => {
|
|
|
|
- const { reader, requestId } = modelDownloadStatus[model];
|
|
|
|
- if (reader) {
|
|
|
|
- await reader.cancel();
|
|
|
|
-
|
|
|
|
- await cancelOllamaRequest(localStorage.token, requestId);
|
|
|
|
- delete modelDownloadStatus[model];
|
|
|
|
- await deleteModel(localStorage.token, model);
|
|
|
|
- toast.success(`${model} download has been canceled`);
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<div class="flex flex-col h-full justify-between text-sm">
|
|
<div class="flex flex-col h-full justify-between text-sm">
|
|
- <div class=" space-y-3 pr-1.5 overflow-y-scroll h-[24rem]">
|
|
|
|
|
|
+ <div class=" space-y-3 pr-1.5 overflow-y-scroll h-[23rem]">
|
|
{#if ollamaVersion}
|
|
{#if ollamaVersion}
|
|
<div class="space-y-2 pr-1.5">
|
|
<div class="space-y-2 pr-1.5">
|
|
- <div class="text-sm font-medium">{$i18n.t('Manage Ollama Models')}</div>
|
|
|
|
|
|
+ <div class="text-sm font-medium">Manage Ollama Models</div>
|
|
|
|
|
|
{#if OLLAMA_URLS.length > 0}
|
|
{#if OLLAMA_URLS.length > 0}
|
|
<div class="flex gap-2">
|
|
<div class="flex gap-2">
|
|
@@ -529,7 +470,7 @@
|
|
<select
|
|
<select
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
bind:value={selectedOllamaUrlIdx}
|
|
bind:value={selectedOllamaUrlIdx}
|
|
- placeholder={$i18n.t('Select an Ollama instance')}
|
|
|
|
|
|
+ placeholder="Select an Ollama instance"
|
|
>
|
|
>
|
|
{#each OLLAMA_URLS as url, idx}
|
|
{#each OLLAMA_URLS as url, idx}
|
|
<option value={idx} class="bg-gray-100 dark:bg-gray-700">{url}</option>
|
|
<option value={idx} class="bg-gray-100 dark:bg-gray-700">{url}</option>
|
|
@@ -572,14 +513,12 @@
|
|
|
|
|
|
<div class="space-y-2">
|
|
<div class="space-y-2">
|
|
<div>
|
|
<div>
|
|
- <div class=" mb-2 text-sm font-medium">{$i18n.t('Pull a model from Ollama.com')}</div>
|
|
|
|
|
|
+ <div class=" mb-2 text-sm font-medium">Pull a model from Ollama.com</div>
|
|
<div class="flex w-full">
|
|
<div class="flex w-full">
|
|
<div class="flex-1 mr-2">
|
|
<div class="flex-1 mr-2">
|
|
<input
|
|
<input
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
- placeholder={$i18n.t('Enter model tag (e.g. {{modelTag}})', {
|
|
|
|
- modelTag: 'mistral:7b'
|
|
|
|
- })}
|
|
|
|
|
|
+ placeholder="Enter model tag (e.g. mistral:7b)"
|
|
bind:value={modelTag}
|
|
bind:value={modelTag}
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
@@ -634,84 +573,47 @@
|
|
</button>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- <div class="mt-2 mb-1 text-xs text-gray-400 dark:text-gray-500">
|
|
|
|
- {$i18n.t('To access the available model names for downloading,')}
|
|
|
|
- <a
|
|
|
|
- class=" text-gray-500 dark:text-gray-300 font-medium underline"
|
|
|
|
- href="https://ollama.com/library"
|
|
|
|
- target="_blank">{$i18n.t('click here.')}</a
|
|
|
|
- >
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <div class="mt-2 mb-1 text-xs text-gray-400 dark:text-gray-500">
|
|
|
|
+ To access the available model names for downloading, <a
|
|
|
|
+ class=" text-gray-500 dark:text-gray-300 font-medium underline"
|
|
|
|
+ href="https://ollama.com/library"
|
|
|
|
+ target="_blank">click here.</a
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
{#if Object.keys(modelDownloadStatus).length > 0}
|
|
{#if Object.keys(modelDownloadStatus).length > 0}
|
|
{#each Object.keys(modelDownloadStatus) as model}
|
|
{#each Object.keys(modelDownloadStatus) as model}
|
|
- {#if 'pullProgress' in modelDownloadStatus[model]}
|
|
|
|
- <div class="flex flex-col">
|
|
|
|
- <div class="font-medium mb-1">{model}</div>
|
|
|
|
- <div class="">
|
|
|
|
- <div class="flex flex-row justify-between space-x-4 pr-2">
|
|
|
|
- <div class=" flex-1">
|
|
|
|
- <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"
|
|
|
|
- style="width: {Math.max(
|
|
|
|
- 15,
|
|
|
|
- modelDownloadStatus[model].pullProgress ?? 0
|
|
|
|
- )}%"
|
|
|
|
- >
|
|
|
|
- {modelDownloadStatus[model].pullProgress ?? 0}%
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
- <Tooltip content="Cancel">
|
|
|
|
- <button
|
|
|
|
- class="text-gray-800 dark:text-gray-100"
|
|
|
|
- on:click={() => {
|
|
|
|
- cancelModelPullHandler(model);
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- <svg
|
|
|
|
- class="w-4 h-4 text-gray-800 dark:text-white"
|
|
|
|
- aria-hidden="true"
|
|
|
|
- xmlns="http://www.w3.org/2000/svg"
|
|
|
|
- width="24"
|
|
|
|
- height="24"
|
|
|
|
- fill="currentColor"
|
|
|
|
- viewBox="0 0 24 24"
|
|
|
|
- >
|
|
|
|
- <path
|
|
|
|
- stroke="currentColor"
|
|
|
|
- stroke-linecap="round"
|
|
|
|
- stroke-linejoin="round"
|
|
|
|
- stroke-width="2"
|
|
|
|
- d="M6 18 17.94 6M18 18 6.06 6"
|
|
|
|
- />
|
|
|
|
- </svg>
|
|
|
|
- </button>
|
|
|
|
- </Tooltip>
|
|
|
|
- </div>
|
|
|
|
- {#if 'digest' in modelDownloadStatus[model]}
|
|
|
|
- <div class="mt-1 text-xs dark:text-gray-500" style="font-size: 0.5rem;">
|
|
|
|
- {modelDownloadStatus[model].digest}
|
|
|
|
- </div>
|
|
|
|
- {/if}
|
|
|
|
|
|
+ <div class="flex flex-col">
|
|
|
|
+ <div class="font-medium mb-1">{model}</div>
|
|
|
|
+ <div class="">
|
|
|
|
+ <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"
|
|
|
|
+ style="width: {Math.max(15, modelDownloadStatus[model].pullProgress ?? 0)}%"
|
|
|
|
+ >
|
|
|
|
+ {modelDownloadStatus[model].pullProgress ?? 0}%
|
|
|
|
+ </div>
|
|
|
|
+ <div class="mt-1 text-xs dark:text-gray-500" style="font-size: 0.5rem;">
|
|
|
|
+ {modelDownloadStatus[model].digest}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- {/if}
|
|
|
|
|
|
+ </div>
|
|
{/each}
|
|
{/each}
|
|
{/if}
|
|
{/if}
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div>
|
|
<div>
|
|
- <div class=" mb-2 text-sm font-medium">{$i18n.t('Delete a model')}</div>
|
|
|
|
|
|
+ <div class=" mb-2 text-sm font-medium">Delete a model</div>
|
|
<div class="flex w-full">
|
|
<div class="flex w-full">
|
|
<div class="flex-1 mr-2">
|
|
<div class="flex-1 mr-2">
|
|
<select
|
|
<select
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
bind:value={deleteModelTag}
|
|
bind:value={deleteModelTag}
|
|
- placeholder={$i18n.t('Select a model')}
|
|
|
|
|
|
+ placeholder="Select a model"
|
|
>
|
|
>
|
|
{#if !deleteModelTag}
|
|
{#if !deleteModelTag}
|
|
- <option value="" disabled selected>{$i18n.t('Select a model')}</option>
|
|
|
|
|
|
+ <option value="" disabled selected>Select a model</option>
|
|
{/if}
|
|
{/if}
|
|
{#each $models.filter((m) => m.size != null && (selectedOllamaUrlIdx === null ? true : (m?.urls ?? []).includes(selectedOllamaUrlIdx))) as model}
|
|
{#each $models.filter((m) => m.size != null && (selectedOllamaUrlIdx === null ? true : (m?.urls ?? []).includes(selectedOllamaUrlIdx))) as model}
|
|
<option value={model.name} class="bg-gray-100 dark:bg-gray-700"
|
|
<option value={model.name} class="bg-gray-100 dark:bg-gray-700"
|
|
@@ -744,13 +646,13 @@
|
|
|
|
|
|
<div class="pt-1">
|
|
<div class="pt-1">
|
|
<div class="flex justify-between items-center text-xs">
|
|
<div class="flex justify-between items-center text-xs">
|
|
- <div class=" text-sm font-medium">{$i18n.t('Experimental')}</div>
|
|
|
|
|
|
+ <div class=" text-sm font-medium">Experimental</div>
|
|
<button
|
|
<button
|
|
class=" text-xs font-medium text-gray-500"
|
|
class=" text-xs font-medium text-gray-500"
|
|
type="button"
|
|
type="button"
|
|
on:click={() => {
|
|
on:click={() => {
|
|
showExperimentalOllama = !showExperimentalOllama;
|
|
showExperimentalOllama = !showExperimentalOllama;
|
|
- }}>{showExperimentalOllama ? $i18n.t('Hide') : $i18n.t('Show')}</button
|
|
|
|
|
|
+ }}>{showExperimentalOllama ? 'Hide' : 'Show'}</button
|
|
>
|
|
>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -762,7 +664,7 @@
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
<div class=" mb-2 flex w-full justify-between">
|
|
<div class=" mb-2 flex w-full justify-between">
|
|
- <div class=" text-sm font-medium">{$i18n.t('Upload a GGUF model')}</div>
|
|
|
|
|
|
+ <div class=" text-sm font-medium">Upload a GGUF model</div>
|
|
|
|
|
|
<button
|
|
<button
|
|
class="p-1 px-3 text-xs flex rounded transition"
|
|
class="p-1 px-3 text-xs flex rounded transition"
|
|
@@ -776,9 +678,9 @@
|
|
type="button"
|
|
type="button"
|
|
>
|
|
>
|
|
{#if modelUploadMode === 'file'}
|
|
{#if modelUploadMode === 'file'}
|
|
- <span class="ml-2 self-center">{$i18n.t('File Mode')}</span>
|
|
|
|
|
|
+ <span class="ml-2 self-center">File Mode</span>
|
|
{:else}
|
|
{:else}
|
|
- <span class="ml-2 self-center">{$i18n.t('URL Mode')}</span>
|
|
|
|
|
|
+ <span class="ml-2 self-center">URL Mode</span>
|
|
{/if}
|
|
{/if}
|
|
</button>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
@@ -802,7 +704,7 @@
|
|
|
|
|
|
<button
|
|
<button
|
|
type="button"
|
|
type="button"
|
|
- class="w-full rounded-lg text-left py-2 px-4 bg-white dark:text-gray-300 dark:bg-gray-850"
|
|
|
|
|
|
+ class="w-full rounded-lg text-left py-2 px-4 dark:text-gray-300 dark:bg-gray-850"
|
|
on:click={() => {
|
|
on:click={() => {
|
|
modelUploadInputElement.click();
|
|
modelUploadInputElement.click();
|
|
}}
|
|
}}
|
|
@@ -810,21 +712,21 @@
|
|
{#if modelInputFile && modelInputFile.length > 0}
|
|
{#if modelInputFile && modelInputFile.length > 0}
|
|
{modelInputFile[0].name}
|
|
{modelInputFile[0].name}
|
|
{:else}
|
|
{:else}
|
|
- {$i18n.t('Click here to select')}
|
|
|
|
|
|
+ Click here to select
|
|
{/if}
|
|
{/if}
|
|
</button>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
{:else}
|
|
{:else}
|
|
<div class="flex-1 {modelFileUrl !== '' ? 'mr-2' : ''}">
|
|
<div class="flex-1 {modelFileUrl !== '' ? 'mr-2' : ''}">
|
|
<input
|
|
<input
|
|
- class="w-full rounded-lg text-left py-2 px-4 bg-white dark:text-gray-300 dark:bg-gray-850 outline-none {modelFileUrl !==
|
|
|
|
|
|
+ class="w-full rounded-lg text-left py-2 px-4 dark:text-gray-300 dark:bg-gray-850 outline-none {modelFileUrl !==
|
|
''
|
|
''
|
|
? 'mr-2'
|
|
? 'mr-2'
|
|
: ''}"
|
|
: ''}"
|
|
type="url"
|
|
type="url"
|
|
required
|
|
required
|
|
bind:value={modelFileUrl}
|
|
bind:value={modelFileUrl}
|
|
- placeholder={$i18n.t('Type Hugging Face Resolve (Download) URL')}
|
|
|
|
|
|
+ placeholder="Type Hugging Face Resolve (Download) URL"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
{/if}
|
|
{/if}
|
|
@@ -832,7 +734,7 @@
|
|
|
|
|
|
{#if (modelUploadMode === 'file' && modelInputFile && modelInputFile.length > 0) || (modelUploadMode === 'url' && modelFileUrl !== '')}
|
|
{#if (modelUploadMode === 'file' && modelInputFile && modelInputFile.length > 0) || (modelUploadMode === 'url' && modelFileUrl !== '')}
|
|
<button
|
|
<button
|
|
- class="px-2.5 bg-gray-100 hover:bg-gray-200 text-gray-800 dark:bg-gray-850 dark:hover:bg-gray-800 dark:text-gray-100 rounded-lg disabled:cursor-not-allowed transition"
|
|
|
|
|
|
+ class="px-3 text-gray-100 bg-emerald-600 hover:bg-emerald-700 disabled:bg-gray-700 disabled:cursor-not-allowed rounded transition"
|
|
type="submit"
|
|
type="submit"
|
|
disabled={modelTransferring}
|
|
disabled={modelTransferring}
|
|
>
|
|
>
|
|
@@ -884,43 +786,26 @@
|
|
{#if (modelUploadMode === 'file' && modelInputFile && modelInputFile.length > 0) || (modelUploadMode === 'url' && modelFileUrl !== '')}
|
|
{#if (modelUploadMode === 'file' && modelInputFile && modelInputFile.length > 0) || (modelUploadMode === 'url' && modelFileUrl !== '')}
|
|
<div>
|
|
<div>
|
|
<div>
|
|
<div>
|
|
- <div class=" my-2.5 text-sm font-medium">{$i18n.t('Modelfile Content')}</div>
|
|
|
|
|
|
+ <div class=" my-2.5 text-sm font-medium">Modelfile Content</div>
|
|
<textarea
|
|
<textarea
|
|
bind:value={modelFileContent}
|
|
bind:value={modelFileContent}
|
|
- class="w-full rounded-lg py-2 px-4 text-sm bg-gray-100 dark:text-gray-100 dark:bg-gray-850 outline-none resize-none"
|
|
|
|
|
|
+ class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none resize-none"
|
|
rows="6"
|
|
rows="6"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{/if}
|
|
{/if}
|
|
<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 GGUF models available for downloading,')}
|
|
|
|
- <a
|
|
|
|
|
|
+ To access the GGUF models available for downloading, <a
|
|
class=" text-gray-500 dark:text-gray-300 font-medium underline"
|
|
class=" text-gray-500 dark:text-gray-300 font-medium underline"
|
|
href="https://huggingface.co/models?search=gguf"
|
|
href="https://huggingface.co/models?search=gguf"
|
|
- target="_blank">{$i18n.t('click here.')}</a
|
|
|
|
|
|
+ target="_blank">click here.</a
|
|
>
|
|
>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- {#if uploadMessage}
|
|
|
|
- <div class="mt-2">
|
|
|
|
- <div class=" mb-2 text-xs">{$i18n.t('Upload 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"
|
|
|
|
- style="width: 100%"
|
|
|
|
- >
|
|
|
|
- {uploadMessage}
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- <div class="mt-1 text-xs dark:text-gray-500" style="font-size: 0.5rem;">
|
|
|
|
- {modelFileDigest}
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- {:else if uploadProgress !== null}
|
|
|
|
|
|
+ {#if uploadProgress !== null}
|
|
<div class="mt-2">
|
|
<div class="mt-2">
|
|
- <div class=" mb-2 text-xs">{$i18n.t('Upload Progress')}</div>
|
|
|
|
|
|
+ <div class=" mb-2 text-xs">Upload Progress</div>
|
|
|
|
|
|
<div class="w-full rounded-full dark:bg-gray-800">
|
|
<div class="w-full rounded-full dark:bg-gray-800">
|
|
<div
|
|
<div
|
|
@@ -947,13 +832,13 @@
|
|
<div>
|
|
<div>
|
|
<div class="mb-2">
|
|
<div class="mb-2">
|
|
<div class="flex justify-between items-center text-xs">
|
|
<div class="flex justify-between items-center text-xs">
|
|
- <div class=" text-sm font-medium">{$i18n.t('Manage LiteLLM Models')}</div>
|
|
|
|
|
|
+ <div class=" text-sm font-medium">Manage LiteLLM Models</div>
|
|
<button
|
|
<button
|
|
class=" text-xs font-medium text-gray-500"
|
|
class=" text-xs font-medium text-gray-500"
|
|
type="button"
|
|
type="button"
|
|
on:click={() => {
|
|
on:click={() => {
|
|
showLiteLLM = !showLiteLLM;
|
|
showLiteLLM = !showLiteLLM;
|
|
- }}>{showLiteLLM ? $i18n.t('Hide') : $i18n.t('Show')}</button
|
|
|
|
|
|
+ }}>{showLiteLLM ? 'Hide' : 'Show'}</button
|
|
>
|
|
>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -961,16 +846,14 @@
|
|
{#if showLiteLLM}
|
|
{#if showLiteLLM}
|
|
<div>
|
|
<div>
|
|
<div class="flex justify-between items-center text-xs">
|
|
<div class="flex justify-between items-center text-xs">
|
|
- <div class=" text-sm font-medium">{$i18n.t('Add a model')}</div>
|
|
|
|
|
|
+ <div class=" text-sm font-medium">Add a model</div>
|
|
<button
|
|
<button
|
|
class=" text-xs font-medium text-gray-500"
|
|
class=" text-xs font-medium text-gray-500"
|
|
type="button"
|
|
type="button"
|
|
on:click={() => {
|
|
on:click={() => {
|
|
showLiteLLMParams = !showLiteLLMParams;
|
|
showLiteLLMParams = !showLiteLLMParams;
|
|
}}
|
|
}}
|
|
- >{showLiteLLMParams
|
|
|
|
- ? $i18n.t('Hide Additional Params')
|
|
|
|
- : $i18n.t('Show Additional Params')}</button
|
|
|
|
|
|
+ >{showLiteLLMParams ? 'Hide Additional Params' : 'Show Additional Params'}</button
|
|
>
|
|
>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -980,7 +863,7 @@
|
|
<div class="flex-1 mr-2">
|
|
<div class="flex-1 mr-2">
|
|
<input
|
|
<input
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
- placeholder={$i18n.t('Enter LiteLLM Model (litellm_params.model)')}
|
|
|
|
|
|
+ placeholder="Enter LiteLLM Model (litellm_params.model)"
|
|
bind:value={liteLLMModel}
|
|
bind:value={liteLLMModel}
|
|
autocomplete="off"
|
|
autocomplete="off"
|
|
/>
|
|
/>
|
|
@@ -1007,7 +890,7 @@
|
|
|
|
|
|
{#if showLiteLLMParams}
|
|
{#if showLiteLLMParams}
|
|
<div>
|
|
<div>
|
|
- <div class=" mb-1.5 text-sm font-medium">{$i18n.t('Model Name')}</div>
|
|
|
|
|
|
+ <div class=" mb-1.5 text-sm font-medium">Model Name</div>
|
|
<div class="flex w-full">
|
|
<div class="flex w-full">
|
|
<div class="flex-1">
|
|
<div class="flex-1">
|
|
<input
|
|
<input
|
|
@@ -1021,14 +904,12 @@
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div>
|
|
<div>
|
|
- <div class=" mb-1.5 text-sm font-medium">{$i18n.t('API Base URL')}</div>
|
|
|
|
|
|
+ <div class=" mb-1.5 text-sm font-medium">API Base URL</div>
|
|
<div class="flex w-full">
|
|
<div class="flex w-full">
|
|
<div class="flex-1">
|
|
<div class="flex-1">
|
|
<input
|
|
<input
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
- placeholder={$i18n.t(
|
|
|
|
- 'Enter LiteLLM API Base URL (litellm_params.api_base)'
|
|
|
|
- )}
|
|
|
|
|
|
+ placeholder="Enter LiteLLM API Base URL (litellm_params.api_base)"
|
|
bind:value={liteLLMAPIBase}
|
|
bind:value={liteLLMAPIBase}
|
|
autocomplete="off"
|
|
autocomplete="off"
|
|
/>
|
|
/>
|
|
@@ -1037,12 +918,12 @@
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div>
|
|
<div>
|
|
- <div class=" mb-1.5 text-sm font-medium">{$i18n.t('API Key')}</div>
|
|
|
|
|
|
+ <div class=" mb-1.5 text-sm font-medium">API Key</div>
|
|
<div class="flex w-full">
|
|
<div class="flex w-full">
|
|
<div class="flex-1">
|
|
<div class="flex-1">
|
|
<input
|
|
<input
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
- placeholder={$i18n.t('Enter LiteLLM API Key (litellm_params.api_key)')}
|
|
|
|
|
|
+ placeholder="Enter LiteLLM API Key (litellm_params.api_key)"
|
|
bind:value={liteLLMAPIKey}
|
|
bind:value={liteLLMAPIKey}
|
|
autocomplete="off"
|
|
autocomplete="off"
|
|
/>
|
|
/>
|
|
@@ -1051,12 +932,12 @@
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div>
|
|
<div>
|
|
- <div class="mb-1.5 text-sm font-medium">{$i18n.t('API RPM')}</div>
|
|
|
|
|
|
+ <div class="mb-1.5 text-sm font-medium">API RPM</div>
|
|
<div class="flex w-full">
|
|
<div class="flex w-full">
|
|
<div class="flex-1">
|
|
<div class="flex-1">
|
|
<input
|
|
<input
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
- placeholder={$i18n.t('Enter LiteLLM API RPM (litellm_params.rpm)')}
|
|
|
|
|
|
+ placeholder="Enter LiteLLM API RPM (litellm_params.rpm)"
|
|
bind:value={liteLLMRPM}
|
|
bind:value={liteLLMRPM}
|
|
autocomplete="off"
|
|
autocomplete="off"
|
|
/>
|
|
/>
|
|
@@ -1065,12 +946,12 @@
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div>
|
|
<div>
|
|
- <div class="mb-1.5 text-sm font-medium">{$i18n.t('Max Tokens')}</div>
|
|
|
|
|
|
+ <div class="mb-1.5 text-sm font-medium">Max Tokens</div>
|
|
<div class="flex w-full">
|
|
<div class="flex w-full">
|
|
<div class="flex-1">
|
|
<div class="flex-1">
|
|
<input
|
|
<input
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
- placeholder={$i18n.t('Enter Max Tokens (litellm_params.max_tokens)')}
|
|
|
|
|
|
+ placeholder="Enter Max Tokens (litellm_params.max_tokens)"
|
|
bind:value={liteLLMMaxTokens}
|
|
bind:value={liteLLMMaxTokens}
|
|
type="number"
|
|
type="number"
|
|
min="1"
|
|
min="1"
|
|
@@ -1083,27 +964,27 @@
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="mb-2 text-xs text-gray-400 dark:text-gray-500">
|
|
<div class="mb-2 text-xs text-gray-400 dark:text-gray-500">
|
|
- {$i18n.t('Not sure what to add?')}
|
|
|
|
|
|
+ Not sure what to add?
|
|
<a
|
|
<a
|
|
class=" text-gray-300 font-medium underline"
|
|
class=" text-gray-300 font-medium underline"
|
|
href="https://litellm.vercel.app/docs/proxy/configs#quick-start"
|
|
href="https://litellm.vercel.app/docs/proxy/configs#quick-start"
|
|
target="_blank"
|
|
target="_blank"
|
|
>
|
|
>
|
|
- {$i18n.t('Click here for help.')}
|
|
|
|
|
|
+ Click here for help.
|
|
</a>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div>
|
|
<div>
|
|
- <div class=" mb-2.5 text-sm font-medium">{$i18n.t('Delete a model')}</div>
|
|
|
|
|
|
+ <div class=" mb-2.5 text-sm font-medium">Delete a model</div>
|
|
<div class="flex w-full">
|
|
<div class="flex w-full">
|
|
<div class="flex-1 mr-2">
|
|
<div class="flex-1 mr-2">
|
|
<select
|
|
<select
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
bind:value={deleteLiteLLMModelId}
|
|
bind:value={deleteLiteLLMModelId}
|
|
- placeholder={$i18n.t('Select a model')}
|
|
|
|
|
|
+ placeholder="Select a model"
|
|
>
|
|
>
|
|
{#if !deleteLiteLLMModelId}
|
|
{#if !deleteLiteLLMModelId}
|
|
- <option value="" disabled selected>{$i18n.t('Select a model')}</option>
|
|
|
|
|
|
+ <option value="" disabled selected>Select a model</option>
|
|
{/if}
|
|
{/if}
|
|
{#each liteLLMModelInfo as model}
|
|
{#each liteLLMModelInfo as model}
|
|
<option value={model.model_info.id} class="bg-gray-100 dark:bg-gray-700"
|
|
<option value={model.model_info.id} class="bg-gray-100 dark:bg-gray-700"
|