feat(api): integrate per-organization resource counts into organization listing
- Added `resource_counts` to the `ListOrganizationsResponse` to include per-organization knowledge base and agent counts, enhancing the sidebar display. - Removed the deprecated `getMeResourceCounts` API endpoint, consolidating resource count retrieval into the organization listing. - Updated the organization store to manage and utilize the new resource counts effectively. - Adjusted UI components to leverage the new resource counts structure, improving data retrieval and display for agents and knowledge bases. This update streamlines resource count management and enhances the user experience by providing relevant data in a single API call.
This commit is contained in:
@@ -540,7 +540,7 @@ import { listKnowledgeBases, deleteKnowledgeBase } from '@/api/knowledge-base'
|
||||
import { formatStringDate } from '@/utils/index'
|
||||
import { useUIStore } from '@/stores/ui'
|
||||
import { useOrganizationStore } from '@/stores/organization'
|
||||
import { listOrganizationSharedKnowledgeBases, getMeResourceCounts, type SharedKnowledgeBase, type OrganizationSharedKnowledgeBaseItem, type SourceFromAgentInfo } from '@/api/organization'
|
||||
import { listOrganizationSharedKnowledgeBases, type SharedKnowledgeBase, type OrganizationSharedKnowledgeBaseItem, type SourceFromAgentInfo } from '@/api/organization'
|
||||
import KnowledgeBaseEditorModal from './KnowledgeBaseEditorModal.vue'
|
||||
import ShareKnowledgeBaseDialog from '@/components/ShareKnowledgeBaseDialog.vue'
|
||||
import ListSpaceSidebar from '@/components/ListSpaceSidebar.vue'
|
||||
@@ -703,12 +703,9 @@ const fetchList = () => {
|
||||
orgStore.fetchSharedKnowledgeBases(),
|
||||
orgStore.fetchOrganizations()
|
||||
]).finally(() => { loading.value = false }).then(() => {
|
||||
// 一次请求拉取各空间内全部知识库数量(含我共享的),用于侧栏展示
|
||||
getMeResourceCounts().then((res) => {
|
||||
if (res.success && res.data?.knowledge_bases?.by_organization) {
|
||||
spaceCountByOrg.value = { ...res.data.knowledge_bases.by_organization }
|
||||
}
|
||||
})
|
||||
// 各空间知识库数量已由 GET /organizations 的 resource_counts 带回,存于 orgStore.resourceCounts
|
||||
const counts = orgStore.resourceCounts?.knowledge_bases?.by_organization
|
||||
if (counts) spaceCountByOrg.value = { ...counts }
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user