|
@@ -14,6 +14,7 @@
|
|
import { splitStream } from '$lib/utils';
|
|
import { splitStream } from '$lib/utils';
|
|
import { onMount } 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';
|
|
|
|
|
|
export let getModels: Function;
|
|
export let getModels: Function;
|
|
|
|
|
|
@@ -27,6 +28,7 @@
|
|
let liteLLMAPIBase = '';
|
|
let liteLLMAPIBase = '';
|
|
let liteLLMAPIKey = '';
|
|
let liteLLMAPIKey = '';
|
|
let liteLLMRPM = '';
|
|
let liteLLMRPM = '';
|
|
|
|
+ let liteLLMMaxTokens = '';
|
|
|
|
|
|
let deleteLiteLLMModelId = '';
|
|
let deleteLiteLLMModelId = '';
|
|
|
|
|
|
@@ -36,6 +38,10 @@
|
|
|
|
|
|
let OLLAMA_URLS = [];
|
|
let OLLAMA_URLS = [];
|
|
let selectedOllamaUrlIdx: string | null = null;
|
|
let selectedOllamaUrlIdx: string | null = null;
|
|
|
|
+
|
|
|
|
+ let updateModelId = null;
|
|
|
|
+ let updateProgress = null;
|
|
|
|
+
|
|
let showExperimentalOllama = false;
|
|
let showExperimentalOllama = false;
|
|
let ollamaVersion = '';
|
|
let ollamaVersion = '';
|
|
const MAX_PARALLEL_DOWNLOADS = 3;
|
|
const MAX_PARALLEL_DOWNLOADS = 3;
|
|
@@ -60,6 +66,71 @@
|
|
|
|
|
|
let deleteModelTag = '';
|
|
let deleteModelTag = '';
|
|
|
|
|
|
|
|
+ const updateModelsHandler = async () => {
|
|
|
|
+ for (const model of $models.filter(
|
|
|
|
+ (m) =>
|
|
|
|
+ m.size != null &&
|
|
|
|
+ (selectedOllamaUrlIdx === null ? true : (m?.urls ?? []).includes(selectedOllamaUrlIdx))
|
|
|
|
+ )) {
|
|
|
|
+ console.log(model);
|
|
|
|
+
|
|
|
|
+ updateModelId = model.id;
|
|
|
|
+ const res = await pullModel(localStorage.token, model.id, selectedOllamaUrlIdx).catch(
|
|
|
|
+ (error) => {
|
|
|
|
+ toast.error(error);
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ if (res) {
|
|
|
|
+ const reader = res.body
|
|
|
|
+ .pipeThrough(new TextDecoderStream())
|
|
|
|
+ .pipeThrough(splitStream('\n'))
|
|
|
|
+ .getReader();
|
|
|
|
+
|
|
|
|
+ while (true) {
|
|
|
|
+ try {
|
|
|
|
+ const { value, done } = await reader.read();
|
|
|
|
+ if (done) break;
|
|
|
|
+
|
|
|
|
+ let lines = value.split('\n');
|
|
|
|
+
|
|
|
|
+ for (const line of lines) {
|
|
|
|
+ if (line !== '') {
|
|
|
|
+ let data = JSON.parse(line);
|
|
|
|
+
|
|
|
|
+ console.log(data);
|
|
|
|
+ if (data.error) {
|
|
|
|
+ throw data.error;
|
|
|
|
+ }
|
|
|
|
+ if (data.detail) {
|
|
|
|
+ throw data.detail;
|
|
|
|
+ }
|
|
|
|
+ if (data.status) {
|
|
|
|
+ if (data.digest) {
|
|
|
|
+ updateProgress = 0;
|
|
|
|
+ if (data.completed) {
|
|
|
|
+ updateProgress = Math.round((data.completed / data.total) * 1000) / 10;
|
|
|
|
+ } else {
|
|
|
|
+ updateProgress = 100;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ toast.success(data.status);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ updateModelId = null;
|
|
|
|
+ updateProgress = null;
|
|
|
|
+ };
|
|
|
|
+
|
|
const pullModelHandler = async () => {
|
|
const pullModelHandler = async () => {
|
|
const sanitizedModelTag = modelTag.trim();
|
|
const sanitizedModelTag = modelTag.trim();
|
|
if (modelDownloadStatus[sanitizedModelTag]) {
|
|
if (modelDownloadStatus[sanitizedModelTag]) {
|
|
@@ -326,7 +397,8 @@
|
|
model: liteLLMModel,
|
|
model: liteLLMModel,
|
|
api_base: liteLLMAPIBase,
|
|
api_base: liteLLMAPIBase,
|
|
api_key: liteLLMAPIKey,
|
|
api_key: liteLLMAPIKey,
|
|
- rpm: liteLLMRPM
|
|
|
|
|
|
+ rpm: liteLLMRPM,
|
|
|
|
+ max_tokens: liteLLMMaxTokens
|
|
}).catch((error) => {
|
|
}).catch((error) => {
|
|
toast.error(error);
|
|
toast.error(error);
|
|
return null;
|
|
return null;
|
|
@@ -346,6 +418,7 @@
|
|
liteLLMAPIBase = '';
|
|
liteLLMAPIBase = '';
|
|
liteLLMAPIKey = '';
|
|
liteLLMAPIKey = '';
|
|
liteLLMRPM = '';
|
|
liteLLMRPM = '';
|
|
|
|
+ liteLLMMaxTokens = '';
|
|
|
|
|
|
liteLLMModelInfo = await getLiteLLMModelInfo(localStorage.token);
|
|
liteLLMModelInfo = await getLiteLLMModelInfo(localStorage.token);
|
|
models.set(await getModels());
|
|
models.set(await getModels());
|
|
@@ -376,7 +449,7 @@
|
|
return [];
|
|
return [];
|
|
});
|
|
});
|
|
|
|
|
|
- if (OLLAMA_URLS.length > 1) {
|
|
|
|
|
|
+ if (OLLAMA_URLS.length > 0) {
|
|
selectedOllamaUrlIdx = 0;
|
|
selectedOllamaUrlIdx = 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -391,18 +464,51 @@
|
|
<div class="space-y-2 pr-1.5">
|
|
<div class="space-y-2 pr-1.5">
|
|
<div class="text-sm font-medium">Manage Ollama Models</div>
|
|
<div class="text-sm font-medium">Manage Ollama Models</div>
|
|
|
|
|
|
- {#if OLLAMA_URLS.length > 1}
|
|
|
|
- <div class="flex-1 pb-1">
|
|
|
|
- <select
|
|
|
|
- class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
|
- bind:value={selectedOllamaUrlIdx}
|
|
|
|
- placeholder="Select an Ollama instance"
|
|
|
|
- >
|
|
|
|
- {#each OLLAMA_URLS as url, idx}
|
|
|
|
- <option value={idx} class="bg-gray-100 dark:bg-gray-700">{url}</option>
|
|
|
|
- {/each}
|
|
|
|
- </select>
|
|
|
|
|
|
+ {#if OLLAMA_URLS.length > 0}
|
|
|
|
+ <div class="flex gap-2">
|
|
|
|
+ <div class="flex-1 pb-1">
|
|
|
|
+ <select
|
|
|
|
+ class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
|
+ bind:value={selectedOllamaUrlIdx}
|
|
|
|
+ placeholder="Select an Ollama instance"
|
|
|
|
+ >
|
|
|
|
+ {#each OLLAMA_URLS as url, idx}
|
|
|
|
+ <option value={idx} class="bg-gray-100 dark:bg-gray-700">{url}</option>
|
|
|
|
+ {/each}
|
|
|
|
+ </select>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div>
|
|
|
|
+ <div class="flex w-full justify-end">
|
|
|
|
+ <Tooltip content="Update All Models" placement="top">
|
|
|
|
+ <button
|
|
|
|
+ class="p-2.5 flex gap-2 items-center 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 transition"
|
|
|
|
+ on:click={() => {
|
|
|
|
+ updateModelsHandler();
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ <svg
|
|
|
|
+ xmlns="http://www.w3.org/2000/svg"
|
|
|
|
+ viewBox="0 0 16 16"
|
|
|
|
+ fill="currentColor"
|
|
|
|
+ class="w-4 h-4"
|
|
|
|
+ >
|
|
|
|
+ <path
|
|
|
|
+ d="M7 1a.75.75 0 0 1 .75.75V6h-1.5V1.75A.75.75 0 0 1 7 1ZM6.25 6v2.94L5.03 7.72a.75.75 0 0 0-1.06 1.06l2.5 2.5a.75.75 0 0 0 1.06 0l2.5-2.5a.75.75 0 1 0-1.06-1.06L7.75 8.94V6H10a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2.25Z"
|
|
|
|
+ />
|
|
|
|
+ <path
|
|
|
|
+ d="M4.268 14A2 2 0 0 0 6 15h6a2 2 0 0 0 2-2v-3a2 2 0 0 0-1-1.732V11a3 3 0 0 1-3 3H4.268Z"
|
|
|
|
+ />
|
|
|
|
+ </svg>
|
|
|
|
+ </button>
|
|
|
|
+ </Tooltip>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
|
|
+ {#if updateModelId}
|
|
|
|
+ Updating "{updateModelId}" {updateProgress ? `(${updateProgress}%)` : ''}
|
|
|
|
+ {/if}
|
|
{/if}
|
|
{/if}
|
|
|
|
|
|
<div class="space-y-2">
|
|
<div class="space-y-2">
|
|
@@ -467,12 +573,14 @@
|
|
</button>
|
|
</button>
|
|
</div>
|
|
</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 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}
|
|
@@ -589,7 +697,7 @@
|
|
on:change={() => {
|
|
on:change={() => {
|
|
console.log(modelInputFile);
|
|
console.log(modelInputFile);
|
|
}}
|
|
}}
|
|
- accept=".gguf"
|
|
|
|
|
|
+ accept=".gguf,.safetensors"
|
|
required
|
|
required
|
|
hidden
|
|
hidden
|
|
/>
|
|
/>
|
|
@@ -722,245 +830,193 @@
|
|
<div class=" space-y-3">
|
|
<div class=" space-y-3">
|
|
<div class="mt-2 space-y-3 pr-1.5">
|
|
<div class="mt-2 space-y-3 pr-1.5">
|
|
<div>
|
|
<div>
|
|
- <div class=" mb-2 text-sm font-medium">Manage LiteLLM Models</div>
|
|
|
|
-
|
|
|
|
- <div>
|
|
|
|
|
|
+ <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">Add a model</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={() => {
|
|
- showLiteLLMParams = !showLiteLLMParams;
|
|
|
|
- }}>{showLiteLLMParams ? 'Hide Additional Params' : 'Show Additional Params'}</button
|
|
|
|
|
|
+ showLiteLLM = !showLiteLLM;
|
|
|
|
+ }}>{showLiteLLM ? 'Hide' : 'Show'}</button
|
|
>
|
|
>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- <div class="my-2 space-y-2">
|
|
|
|
- <div class="flex w-full mb-1.5">
|
|
|
|
- <div class="flex-1 mr-2">
|
|
|
|
- <input
|
|
|
|
- class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
|
- placeholder="Enter LiteLLM Model (litellm_params.model)"
|
|
|
|
- bind:value={liteLLMModel}
|
|
|
|
- autocomplete="off"
|
|
|
|
- />
|
|
|
|
|
|
+ {#if showLiteLLM}
|
|
|
|
+ <div>
|
|
|
|
+ <div class="flex justify-between items-center text-xs">
|
|
|
|
+ <div class=" text-sm font-medium">Add a model</div>
|
|
|
|
+ <button
|
|
|
|
+ class=" text-xs font-medium text-gray-500"
|
|
|
|
+ type="button"
|
|
|
|
+ on:click={() => {
|
|
|
|
+ showLiteLLMParams = !showLiteLLMParams;
|
|
|
|
+ }}
|
|
|
|
+ >{showLiteLLMParams ? 'Hide Additional Params' : 'Show Additional Params'}</button
|
|
|
|
+ >
|
|
</div>
|
|
</div>
|
|
|
|
+ </div>
|
|
|
|
|
|
- <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 transition"
|
|
|
|
- on:click={() => {
|
|
|
|
- addLiteLLMModelHandler();
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- <svg
|
|
|
|
- xmlns="http://www.w3.org/2000/svg"
|
|
|
|
- viewBox="0 0 16 16"
|
|
|
|
- fill="currentColor"
|
|
|
|
- class="w-4 h-4"
|
|
|
|
- >
|
|
|
|
- <path
|
|
|
|
- d="M8.75 3.75a.75.75 0 0 0-1.5 0v3.5h-3.5a.75.75 0 0 0 0 1.5h3.5v3.5a.75.75 0 0 0 1.5 0v-3.5h3.5a.75.75 0 0 0 0-1.5h-3.5v-3.5Z"
|
|
|
|
|
|
+ <div class="my-2 space-y-2">
|
|
|
|
+ <div class="flex w-full mb-1.5">
|
|
|
|
+ <div class="flex-1 mr-2">
|
|
|
|
+ <input
|
|
|
|
+ class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
|
+ placeholder="Enter LiteLLM Model (litellm_params.model)"
|
|
|
|
+ bind:value={liteLLMModel}
|
|
|
|
+ autocomplete="off"
|
|
/>
|
|
/>
|
|
- </svg>
|
|
|
|
- </button>
|
|
|
|
- </div>
|
|
|
|
|
|
+ </div>
|
|
|
|
|
|
- {#if showLiteLLMParams}
|
|
|
|
- <div>
|
|
|
|
- <div class=" mb-1.5 text-sm font-medium">Model Name</div>
|
|
|
|
- <div class="flex w-full">
|
|
|
|
- <div class="flex-1">
|
|
|
|
- <input
|
|
|
|
- class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
|
- placeholder="Enter Model Name (model_name)"
|
|
|
|
- bind:value={liteLLMModelName}
|
|
|
|
- autocomplete="off"
|
|
|
|
|
|
+ <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 transition"
|
|
|
|
+ on:click={() => {
|
|
|
|
+ addLiteLLMModelHandler();
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ <svg
|
|
|
|
+ xmlns="http://www.w3.org/2000/svg"
|
|
|
|
+ viewBox="0 0 16 16"
|
|
|
|
+ fill="currentColor"
|
|
|
|
+ class="w-4 h-4"
|
|
|
|
+ >
|
|
|
|
+ <path
|
|
|
|
+ d="M8.75 3.75a.75.75 0 0 0-1.5 0v3.5h-3.5a.75.75 0 0 0 0 1.5h3.5v3.5a.75.75 0 0 0 1.5 0v-3.5h3.5a.75.75 0 0 0 0-1.5h-3.5v-3.5Z"
|
|
/>
|
|
/>
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
|
|
+ </svg>
|
|
|
|
+ </button>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- <div>
|
|
|
|
- <div class=" mb-1.5 text-sm font-medium">API Base URL</div>
|
|
|
|
- <div class="flex w-full">
|
|
|
|
- <div class="flex-1">
|
|
|
|
- <input
|
|
|
|
- class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
|
- placeholder="Enter LiteLLM API Base URL (litellm_params.api_base)"
|
|
|
|
- bind:value={liteLLMAPIBase}
|
|
|
|
- autocomplete="off"
|
|
|
|
- />
|
|
|
|
|
|
+ {#if showLiteLLMParams}
|
|
|
|
+ <div>
|
|
|
|
+ <div class=" mb-1.5 text-sm font-medium">Model Name</div>
|
|
|
|
+ <div class="flex w-full">
|
|
|
|
+ <div class="flex-1">
|
|
|
|
+ <input
|
|
|
|
+ class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
|
+ placeholder="Enter Model Name (model_name)"
|
|
|
|
+ bind:value={liteLLMModelName}
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
|
|
|
|
- <div>
|
|
|
|
- <div class=" mb-1.5 text-sm font-medium">API Key</div>
|
|
|
|
- <div class="flex w-full">
|
|
|
|
- <div class="flex-1">
|
|
|
|
- <input
|
|
|
|
- class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
|
- placeholder="Enter LiteLLM API Key (litellm_params.api_key)"
|
|
|
|
- bind:value={liteLLMAPIKey}
|
|
|
|
- autocomplete="off"
|
|
|
|
- />
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <div class=" mb-1.5 text-sm font-medium">API Base URL</div>
|
|
|
|
+ <div class="flex w-full">
|
|
|
|
+ <div class="flex-1">
|
|
|
|
+ <input
|
|
|
|
+ class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
|
+ placeholder="Enter LiteLLM API Base URL (litellm_params.api_base)"
|
|
|
|
+ bind:value={liteLLMAPIBase}
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
|
|
|
|
- <div>
|
|
|
|
- <div class="mb-1.5 text-sm font-medium">API RPM</div>
|
|
|
|
- <div class="flex w-full">
|
|
|
|
- <div class="flex-1">
|
|
|
|
- <input
|
|
|
|
- class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
|
- placeholder="Enter LiteLLM API RPM (litellm_params.rpm)"
|
|
|
|
- bind:value={liteLLMRPM}
|
|
|
|
- autocomplete="off"
|
|
|
|
- />
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <div class=" mb-1.5 text-sm font-medium">API Key</div>
|
|
|
|
+ <div class="flex w-full">
|
|
|
|
+ <div class="flex-1">
|
|
|
|
+ <input
|
|
|
|
+ class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
|
+ placeholder="Enter LiteLLM API Key (litellm_params.api_key)"
|
|
|
|
+ bind:value={liteLLMAPIKey}
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
- {/if}
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
- <div class="mb-2 text-xs text-gray-400 dark:text-gray-500">
|
|
|
|
- Not sure what to add?
|
|
|
|
- <a
|
|
|
|
- class=" text-gray-300 font-medium underline"
|
|
|
|
- href="https://litellm.vercel.app/docs/proxy/configs#quick-start"
|
|
|
|
- target="_blank"
|
|
|
|
- >
|
|
|
|
- Click here for help.
|
|
|
|
- </a>
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
- <div>
|
|
|
|
- <div class=" mb-2.5 text-sm font-medium">Delete a model</div>
|
|
|
|
- <div class="flex w-full">
|
|
|
|
- <div class="flex-1 mr-2">
|
|
|
|
- <select
|
|
|
|
- class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
|
- bind:value={deleteLiteLLMModelId}
|
|
|
|
- placeholder="Select a model"
|
|
|
|
- >
|
|
|
|
- {#if !deleteLiteLLMModelId}
|
|
|
|
- <option value="" disabled selected>Select a model</option>
|
|
|
|
- {/if}
|
|
|
|
- {#each liteLLMModelInfo as model}
|
|
|
|
- <option value={model.model_info.id} class="bg-gray-100 dark:bg-gray-700"
|
|
|
|
- >{model.model_name}</option
|
|
|
|
- >
|
|
|
|
- {/each}
|
|
|
|
- </select>
|
|
|
|
- </div>
|
|
|
|
- <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 transition"
|
|
|
|
- on:click={() => {
|
|
|
|
- deleteLiteLLMModelHandler();
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- <svg
|
|
|
|
- xmlns="http://www.w3.org/2000/svg"
|
|
|
|
- viewBox="0 0 16 16"
|
|
|
|
- fill="currentColor"
|
|
|
|
- class="w-4 h-4"
|
|
|
|
- >
|
|
|
|
- <path
|
|
|
|
- fill-rule="evenodd"
|
|
|
|
- d="M5 3.25V4H2.75a.75.75 0 0 0 0 1.5h.3l.815 8.15A1.5 1.5 0 0 0 5.357 15h5.285a1.5 1.5 0 0 0 1.493-1.35l.815-8.15h.3a.75.75 0 0 0 0-1.5H11v-.75A2.25 2.25 0 0 0 8.75 1h-1.5A2.25 2.25 0 0 0 5 3.25Zm2.25-.75a.75.75 0 0 0-.75.75V4h3v-.75a.75.75 0 0 0-.75-.75h-1.5ZM6.05 6a.75.75 0 0 1 .787.713l.275 5.5a.75.75 0 0 1-1.498.075l-.275-5.5A.75.75 0 0 1 6.05 6Zm3.9 0a.75.75 0 0 1 .712.787l-.275 5.5a.75.75 0 0 1-1.498-.075l.275-5.5a.75.75 0 0 1 .786-.711Z"
|
|
|
|
- clip-rule="evenodd"
|
|
|
|
- />
|
|
|
|
- </svg>
|
|
|
|
- </button>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
- <!-- <div class="mt-2 space-y-3 pr-1.5">
|
|
|
|
- <div>
|
|
|
|
- <div class=" mb-2.5 text-sm font-medium">Add LiteLLM Model</div>
|
|
|
|
- <div class="flex w-full mb-2">
|
|
|
|
- <div class="flex-1">
|
|
|
|
- <input
|
|
|
|
- class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"
|
|
|
|
- placeholder="Enter LiteLLM Model (e.g. ollama/mistral)"
|
|
|
|
- bind:value={liteLLMModel}
|
|
|
|
- autocomplete="off"
|
|
|
|
- />
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
|
|
|
|
- <div class="flex justify-between items-center text-sm">
|
|
|
|
- <div class=" font-medium">Advanced Model Params</div>
|
|
|
|
- <button
|
|
|
|
- class=" text-xs font-medium text-gray-500"
|
|
|
|
- type="button"
|
|
|
|
- on:click={() => {
|
|
|
|
- showLiteLLMParams = !showLiteLLMParams;
|
|
|
|
- }}>{showLiteLLMParams ? 'Hide' : 'Show'}</button
|
|
|
|
- >
|
|
|
|
- </div>
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <div class="mb-1.5 text-sm font-medium">API RPM</div>
|
|
|
|
+ <div class="flex w-full">
|
|
|
|
+ <div class="flex-1">
|
|
|
|
+ <input
|
|
|
|
+ class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
|
+ placeholder="Enter LiteLLM API RPM (litellm_params.rpm)"
|
|
|
|
+ bind:value={liteLLMRPM}
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
|
|
- {#if showLiteLLMParams}
|
|
|
|
- <div>
|
|
|
|
- <div class=" mb-2.5 text-sm font-medium">LiteLLM API Key</div>
|
|
|
|
- <div class="flex w-full">
|
|
|
|
- <div class="flex-1">
|
|
|
|
- <input
|
|
|
|
- class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"
|
|
|
|
- placeholder="Enter LiteLLM API Key (e.g. os.environ/AZURE_API_KEY_CA)"
|
|
|
|
- bind:value={liteLLMAPIKey}
|
|
|
|
- autocomplete="off"
|
|
|
|
- />
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <div class="mb-1.5 text-sm font-medium">Max Tokens</div>
|
|
|
|
+ <div class="flex w-full">
|
|
|
|
+ <div class="flex-1">
|
|
|
|
+ <input
|
|
|
|
+ class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
|
+ placeholder="Enter Max Tokens (litellm_params.max_tokens)"
|
|
|
|
+ bind:value={liteLLMMaxTokens}
|
|
|
|
+ type="number"
|
|
|
|
+ min="1"
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
|
|
+ {/if}
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- <div>
|
|
|
|
- <div class=" mb-2.5 text-sm font-medium">LiteLLM API Base URL</div>
|
|
|
|
- <div class="flex w-full">
|
|
|
|
- <div class="flex-1">
|
|
|
|
- <input
|
|
|
|
- class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"
|
|
|
|
- placeholder="Enter LiteLLM API Base URL"
|
|
|
|
- bind:value={liteLLMAPIBase}
|
|
|
|
- autocomplete="off"
|
|
|
|
- />
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <div class="mb-2 text-xs text-gray-400 dark:text-gray-500">
|
|
|
|
+ Not sure what to add?
|
|
|
|
+ <a
|
|
|
|
+ class=" text-gray-300 font-medium underline"
|
|
|
|
+ href="https://litellm.vercel.app/docs/proxy/configs#quick-start"
|
|
|
|
+ target="_blank"
|
|
|
|
+ >
|
|
|
|
+ Click here for help.
|
|
|
|
+ </a>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div>
|
|
<div>
|
|
- <div class=" mb-2.5 text-sm font-medium">LiteLLM API RPM</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">
|
|
|
|
- <input
|
|
|
|
- class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"
|
|
|
|
- placeholder="Enter LiteLLM API RPM"
|
|
|
|
- bind:value={liteLLMRPM}
|
|
|
|
- autocomplete="off"
|
|
|
|
- />
|
|
|
|
|
|
+ <div class="flex-1 mr-2">
|
|
|
|
+ <select
|
|
|
|
+ class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
|
+ bind:value={deleteLiteLLMModelId}
|
|
|
|
+ placeholder="Select a model"
|
|
|
|
+ >
|
|
|
|
+ {#if !deleteLiteLLMModelId}
|
|
|
|
+ <option value="" disabled selected>Select a model</option>
|
|
|
|
+ {/if}
|
|
|
|
+ {#each liteLLMModelInfo as model}
|
|
|
|
+ <option value={model.model_info.id} class="bg-gray-100 dark:bg-gray-700"
|
|
|
|
+ >{model.model_name}</option
|
|
|
|
+ >
|
|
|
|
+ {/each}
|
|
|
|
+ </select>
|
|
</div>
|
|
</div>
|
|
|
|
+ <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 transition"
|
|
|
|
+ on:click={() => {
|
|
|
|
+ deleteLiteLLMModelHandler();
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ <svg
|
|
|
|
+ xmlns="http://www.w3.org/2000/svg"
|
|
|
|
+ viewBox="0 0 16 16"
|
|
|
|
+ fill="currentColor"
|
|
|
|
+ class="w-4 h-4"
|
|
|
|
+ >
|
|
|
|
+ <path
|
|
|
|
+ fill-rule="evenodd"
|
|
|
|
+ d="M5 3.25V4H2.75a.75.75 0 0 0 0 1.5h.3l.815 8.15A1.5 1.5 0 0 0 5.357 15h5.285a1.5 1.5 0 0 0 1.493-1.35l.815-8.15h.3a.75.75 0 0 0 0-1.5H11v-.75A2.25 2.25 0 0 0 8.75 1h-1.5A2.25 2.25 0 0 0 5 3.25Zm2.25-.75a.75.75 0 0 0-.75.75V4h3v-.75a.75.75 0 0 0-.75-.75h-1.5ZM6.05 6a.75.75 0 0 1 .787.713l.275 5.5a.75.75 0 0 1-1.498.075l-.275-5.5A.75.75 0 0 1 6.05 6Zm3.9 0a.75.75 0 0 1 .712.787l-.275 5.5a.75.75 0 0 1-1.498-.075l.275-5.5a.75.75 0 0 1 .786-.711Z"
|
|
|
|
+ clip-rule="evenodd"
|
|
|
|
+ />
|
|
|
|
+ </svg>
|
|
|
|
+ </button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{/if}
|
|
{/if}
|
|
-
|
|
|
|
- <div class="mt-2 text-xs text-gray-400 dark:text-gray-500">
|
|
|
|
- Not sure what to add?
|
|
|
|
- <a
|
|
|
|
- class=" text-gray-300 font-medium underline"
|
|
|
|
- href="https://litellm.vercel.app/docs/proxy/configs#quick-start"
|
|
|
|
- target="_blank"
|
|
|
|
- >
|
|
|
|
- Click here for help.
|
|
|
|
- </a>
|
|
|
|
- </div>
|
|
|
|
</div>
|
|
</div>
|
|
- </div> -->
|
|
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|