mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-21 13:38:19 -05:00
fix: keep the workspace tab counts in sync with each section's list (#28983)
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
|
||||
const i18n = getContext<Writable<i18nType>>('i18n');
|
||||
|
||||
import { WEBUI_NAME, user, workspaceActions } from '$lib/stores';
|
||||
import { WEBUI_NAME, user, workspaceActions, workspaceCounts } from '$lib/stores';
|
||||
import {
|
||||
deleteKnowledgeById,
|
||||
searchKnowledgeBases,
|
||||
@@ -153,6 +153,7 @@
|
||||
if (res) {
|
||||
console.log(res);
|
||||
total = res.total;
|
||||
workspaceCounts.update((counts) => ({ ...counts, knowledge: total }));
|
||||
const pageItems: KnowledgeListItem[] = res.items ?? [];
|
||||
|
||||
if ((pageItems ?? []).length === 0) {
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
pinnedModels,
|
||||
settings,
|
||||
user,
|
||||
workspaceActions
|
||||
workspaceActions,
|
||||
workspaceCounts
|
||||
} from '$lib/stores';
|
||||
import { WEBUI_API_BASE_URL } from '$lib/constants';
|
||||
import {
|
||||
@@ -165,6 +166,7 @@
|
||||
if (res) {
|
||||
models = res.items;
|
||||
total = res.total;
|
||||
workspaceCounts.update((counts) => ({ ...counts, models: total }));
|
||||
|
||||
// get tags
|
||||
tags = await getModelTags(localStorage.token).catch((error) => {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import { onMount, getContext, tick, onDestroy } from 'svelte';
|
||||
import type { Writable } from 'svelte/store';
|
||||
import type { i18n as i18nType } from 'i18next';
|
||||
import { WEBUI_NAME, config, user, workspaceActions } from '$lib/stores';
|
||||
import { WEBUI_NAME, config, user, workspaceActions, workspaceCounts } from '$lib/stores';
|
||||
|
||||
import {
|
||||
createNewPrompt,
|
||||
@@ -179,6 +179,7 @@
|
||||
if (res) {
|
||||
prompts = res.items;
|
||||
total = res.total;
|
||||
workspaceCounts.update((counts) => ({ ...counts, prompts: total }));
|
||||
|
||||
// get tags
|
||||
tags = await getPromptTags(localStorage.token).catch((error) => {
|
||||
|
||||
@@ -10,7 +10,13 @@
|
||||
import { onMount, getContext, tick, onDestroy } from 'svelte';
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
import { WEBUI_NAME, user, skills as _skills, workspaceActions } from '$lib/stores';
|
||||
import {
|
||||
WEBUI_NAME,
|
||||
user,
|
||||
skills as _skills,
|
||||
workspaceActions,
|
||||
workspaceCounts
|
||||
} from '$lib/stores';
|
||||
import { goto } from '$app/navigation';
|
||||
import {
|
||||
getSkills,
|
||||
@@ -117,6 +123,7 @@
|
||||
if (res) {
|
||||
filteredItems = res.items;
|
||||
total = res.total;
|
||||
workspaceCounts.update((counts) => ({ ...counts, skills: total }));
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
|
||||
@@ -10,7 +10,14 @@
|
||||
import { onMount, getContext, tick, onDestroy } from 'svelte';
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
import { WEBUI_NAME, config, tools as _tools, user, workspaceActions } from '$lib/stores';
|
||||
import {
|
||||
WEBUI_NAME,
|
||||
config,
|
||||
tools as _tools,
|
||||
user,
|
||||
workspaceActions,
|
||||
workspaceCounts
|
||||
} from '$lib/stores';
|
||||
|
||||
import { goto } from '$app/navigation';
|
||||
import {
|
||||
@@ -152,6 +159,8 @@
|
||||
|
||||
return direction * ((a.updated_at ?? 0) - (b.updated_at ?? 0));
|
||||
});
|
||||
|
||||
workspaceCounts.update((counts) => ({ ...counts, tools: filteredItems.length }));
|
||||
};
|
||||
|
||||
const setSortKey = (key: string) => {
|
||||
|
||||
Reference in New Issue
Block a user