feat: unified /models endpoint

This commit is contained in:
Timothy J. Baek committed 2024-05-24 01:40:48 -07:00
1 parent 4d57e08b38
commit 110ed67468
16 files changed
+166 -170

No files matched your search

-24
View File
@@ -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