feat: add sidebar toggle to workspace and admin models pages (#20176)

This commit is contained in:
G30
2025-12-29 00:45:45 +04:00
committed by GitHub
parent 3994d88c90
commit 9a9b5ef699
5 changed files with 89 additions and 6 deletions
@@ -24,6 +24,7 @@
import { getModels } from '$lib/apis';
import { getGroups } from '$lib/apis/groups';
import { updateUserSettings } from '$lib/apis/users';
import { capitalizeFirstLetter, copyToClipboard } from '$lib/utils';
@@ -215,6 +216,19 @@
saveAs(blob, `${model.id}-${Date.now()}.json`);
};
const pinModelHandler = async (modelId) => {
let pinnedModels = $settings?.pinnedModels ?? [];
if (pinnedModels.includes(modelId)) {
pinnedModels = pinnedModels.filter((id) => id !== modelId);
} else {
pinnedModels = [...new Set([...pinnedModels, modelId])];
}
settings.set({ ...$settings, pinnedModels: pinnedModels });
await updateUserSettings(localStorage.token, { ui: $settings });
};
onMount(async () => {
viewOption = localStorage.workspaceViewOption ?? '';
page = 1;
@@ -547,6 +561,9 @@
hideHandler={() => {
hideModelHandler(model);
}}
pinModelHandler={() => {
pinModelHandler(model.id);
}}
copyLinkHandler={() => {
copyLinkHandler(model);
}}