refac: remove modelfiles completely

This commit is contained in:
Timothy J. Baek
2024-05-24 22:40:36 -07:00
parent c8393db97c
commit 83097cd8be
10 changed files with 24 additions and 49 deletions

View File

@@ -19,7 +19,6 @@
showSettings,
settings,
models,
modelfiles,
prompts,
documents,
tags,

View File

@@ -2,7 +2,7 @@
import { v4 as uuidv4 } from 'uuid';
import { toast } from 'svelte-sonner';
import { goto } from '$app/navigation';
import { settings, user, config, modelfiles, models } from '$lib/stores';
import { settings, user, config, models } from '$lib/stores';
import { onMount, tick, getContext } from 'svelte';
import { addNewModel, getModelById, getModelInfos } from '$lib/apis/models';

View File

@@ -14,10 +14,10 @@
].includes(event.origin)
)
return;
const modelfile = JSON.parse(event.data);
sessionStorage.modelfile = JSON.stringify(modelfile);
const model = JSON.parse(event.data);
sessionStorage.model = JSON.stringify(model);
goto('/workspace/modelfiles/create');
goto('/workspace/models/create');
});
if (window.opener ?? false) {

View File

@@ -5,7 +5,7 @@
import dayjs from 'dayjs';
import { modelfiles, settings, chatId, WEBUI_NAME } from '$lib/stores';
import { settings, chatId, WEBUI_NAME, models } from '$lib/stores';
import { convertMessagesToHistory } from '$lib/utils';
import { getChatByShareId } from '$lib/apis/chats';
@@ -14,6 +14,7 @@
import Navbar from '$lib/components/layout/Navbar.svelte';
import { getUserById } from '$lib/apis/users';
import { error } from '@sveltejs/kit';
import { getModels } from '$lib/apis';
const i18n = getContext('i18n');
@@ -27,17 +28,6 @@
let showModelSelector = false;
let selectedModels = [''];
let selectedModelfiles = {};
$: selectedModelfiles = selectedModels.reduce((a, tagName, i, arr) => {
const modelfile =
$modelfiles.filter((modelfile) => modelfile.tagName === tagName)?.at(0) ?? undefined;
return {
...a,
...(modelfile && { [tagName]: modelfile })
};
}, {});
let chat = null;
let user = null;
@@ -69,10 +59,6 @@
if (await loadSharedChat()) {
await tick();
loaded = true;
window.setTimeout(() => scrollToBottom(), 0);
const chatInput = document.getElementById('chat-textarea');
chatInput?.focus();
} else {
await goto('/');
}
@@ -84,6 +70,7 @@
//////////////////////////
const loadSharedChat = async () => {
await models.set(await getModels(localStorage.token));
await chatId.set($page.params.id);
chat = await getChatByShareId(localStorage.token, $chatId).catch(async (error) => {
await goto('/');
@@ -168,7 +155,6 @@
chatId={$chatId}
readOnly={true}
{selectedModels}
{selectedModelfiles}
{processing}
bind:history
bind:messages