mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
feat: unified /models endpoint
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
|
||||
import { getAllModels as _getAllModels } from '$lib/utils';
|
||||
import { getOllamaVersion } from '$lib/apis/ollama';
|
||||
import { getModels } from '$lib/apis/models';
|
||||
import { getPrompts } from '$lib/apis/prompts';
|
||||
|
||||
import { getDocs } from '$lib/apis/documents';
|
||||
@@ -50,21 +49,6 @@
|
||||
return _getAllModels(localStorage.token);
|
||||
};
|
||||
|
||||
const setOllamaVersion = async (version: string = '') => {
|
||||
if (version === '') {
|
||||
version = await getOllamaVersion(localStorage.token).catch((error) => {
|
||||
return '';
|
||||
});
|
||||
}
|
||||
|
||||
ollamaVersion = version;
|
||||
|
||||
console.log(ollamaVersion);
|
||||
if (compareVersion(REQUIRED_OLLAMA_VERSION, ollamaVersion)) {
|
||||
toast.error(`Ollama Version: ${ollamaVersion !== '' ? ollamaVersion : 'Not Detected'}`);
|
||||
}
|
||||
};
|
||||
|
||||
onMount(async () => {
|
||||
if ($user === undefined) {
|
||||
await goto('/auth');
|
||||
@@ -93,9 +77,6 @@
|
||||
(async () => {
|
||||
models.set(await getAllModels());
|
||||
})(),
|
||||
(async () => {
|
||||
modelfiles.set(await getModels(localStorage.token));
|
||||
})(),
|
||||
(async () => {
|
||||
prompts.set(await getPrompts(localStorage.token));
|
||||
})(),
|
||||
@@ -107,11 +88,6 @@
|
||||
})()
|
||||
]);
|
||||
|
||||
modelfiles.subscribe(async () => {
|
||||
// should fetch models
|
||||
models.set(await getAllModels());
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', function (event) {
|
||||
const isCtrlPressed = event.ctrlKey || event.metaKey; // metaKey is for Cmd key on Mac
|
||||
// Check if the Shift key is pressed
|
||||
|
||||
@@ -39,10 +39,10 @@
|
||||
class="flex scrollbar-none overflow-x-auto w-fit text-center text-sm font-medium rounded-xl bg-transparent/10 p-1"
|
||||
>
|
||||
<a
|
||||
class="min-w-fit rounded-lg p-1.5 px-3 {$page.url.pathname.includes('/workspace/modelfiles')
|
||||
class="min-w-fit rounded-lg p-1.5 px-3 {$page.url.pathname.includes('/workspace/models')
|
||||
? 'bg-gray-50 dark:bg-gray-850'
|
||||
: ''} transition"
|
||||
href="/workspace/modelfiles">{$i18n.t('Modelfiles')}</a
|
||||
href="/workspace/models">{$i18n.t('Models')}</a
|
||||
>
|
||||
|
||||
<a
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
onMount(() => {
|
||||
goto('/workspace/modelfiles');
|
||||
goto('/workspace/models');
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<script>
|
||||
import Modelfiles from '$lib/components/workspace/Modelfiles.svelte';
|
||||
</script>
|
||||
|
||||
<Modelfiles />
|
||||
5
src/routes/(app)/workspace/models/+page.svelte
Normal file
5
src/routes/(app)/workspace/models/+page.svelte
Normal file
@@ -0,0 +1,5 @@
|
||||
<script>
|
||||
import Models from '$lib/components/workspace/Models.svelte';
|
||||
</script>
|
||||
|
||||
<Models />
|
||||
Reference in New Issue
Block a user