mirror of
https://github.com/open-webui/open-webui
synced 2025-06-22 18:07:17 +00:00
Merge 1e05852cdb
into aef0ad2d10
This commit is contained in:
commit
be5826b350
@ -12,7 +12,8 @@
|
|||||||
deleteAllModels,
|
deleteAllModels,
|
||||||
getBaseModels,
|
getBaseModels,
|
||||||
toggleModelById,
|
toggleModelById,
|
||||||
updateModelById
|
updateModelById,
|
||||||
|
getModelById
|
||||||
} from '$lib/apis/models';
|
} from '$lib/apis/models';
|
||||||
|
|
||||||
import { getModels } from '$lib/apis';
|
import { getModels } from '$lib/apis';
|
||||||
@ -36,6 +37,9 @@
|
|||||||
import Eye from '$lib/components/icons/Eye.svelte';
|
import Eye from '$lib/components/icons/Eye.svelte';
|
||||||
import { copyToClipboard } from '$lib/utils';
|
import { copyToClipboard } from '$lib/utils';
|
||||||
|
|
||||||
|
import { page } from '$app/stores';
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
let shiftKey = false;
|
let shiftKey = false;
|
||||||
|
|
||||||
let importFiles;
|
let importFiles;
|
||||||
@ -67,6 +71,24 @@
|
|||||||
|
|
||||||
let searchValue = '';
|
let searchValue = '';
|
||||||
|
|
||||||
|
$: {
|
||||||
|
if ($page.url.pathname === '/admin/settings/models/edit') {
|
||||||
|
const modelIdFromUrl = $page.url.searchParams.get('id');
|
||||||
|
if (modelIdFromUrl && models) {
|
||||||
|
const modelExists = models.some((m) => m.id === modelIdFromUrl);
|
||||||
|
if (modelExists) {
|
||||||
|
selectedModelId = modelIdFromUrl;
|
||||||
|
} else {
|
||||||
|
goto('/admin/settings/models', { replaceState: true });
|
||||||
|
}
|
||||||
|
} else if (!modelIdFromUrl) {
|
||||||
|
goto('/admin/settings/models', { replaceState: true });
|
||||||
|
}
|
||||||
|
} else if ($page.url.pathname === '/admin/settings/models' && selectedModelId !== null) {
|
||||||
|
selectedModelId = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const downloadModels = async (models) => {
|
const downloadModels = async (models) => {
|
||||||
let blob = new Blob([JSON.stringify(models)], {
|
let blob = new Blob([JSON.stringify(models)], {
|
||||||
type: 'application/json'
|
type: 'application/json'
|
||||||
@ -316,7 +338,7 @@
|
|||||||
class=" flex flex-1 text-left space-x-3.5 cursor-pointer w-full"
|
class=" flex flex-1 text-left space-x-3.5 cursor-pointer w-full"
|
||||||
type="button"
|
type="button"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selectedModelId = model.id;
|
goto(`/admin/settings/models/edit?id=${model.id}`);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div class=" self-center w-8">
|
<div class=" self-center w-8">
|
||||||
@ -380,7 +402,7 @@
|
|||||||
class="self-center w-fit text-sm px-2 py-2 dark:text-gray-300 dark:hover:text-white hover:bg-black/5 dark:hover:bg-white/5 rounded-xl"
|
class="self-center w-fit text-sm px-2 py-2 dark:text-gray-300 dark:hover:text-white hover:bg-black/5 dark:hover:bg-white/5 rounded-xl"
|
||||||
type="button"
|
type="button"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selectedModelId = model.id;
|
goto(`/admin/settings/models/edit?id=${model.id}`);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
@ -554,10 +576,10 @@
|
|||||||
onSubmit={(model) => {
|
onSubmit={(model) => {
|
||||||
console.log(model);
|
console.log(model);
|
||||||
upsertModelHandler(model);
|
upsertModelHandler(model);
|
||||||
selectedModelId = null;
|
goto('/admin/settings/models');
|
||||||
}}
|
}}
|
||||||
onBack={() => {
|
onBack={() => {
|
||||||
selectedModelId = null;
|
goto('/admin/settings/models');
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
5
src/routes/(app)/admin/settings/models/edit/+page.svelte
Normal file
5
src/routes/(app)/admin/settings/models/edit/+page.svelte
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
import Models from '$lib/components/admin/Settings/Models.svelte';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Models />
|
Loading…
Reference in New Issue
Block a user