feat(api): enhance organization shared knowledge base and agent functionalities

- Introduced new interfaces for handling shared knowledge bases and agents, including visibility and selection modes for agents.
- Added API functions to list shared knowledge bases and agents within an organization, improving data retrieval for UI components.
- Updated existing components to utilize the new API endpoints and interfaces, ensuring accurate representation of shared resources.
- Enhanced error handling in API calls to provide clearer feedback on failures.

This update improves the functionality and user experience by providing better access to shared resources and enhancing the overall data structure within the application.
This commit is contained in:
wizardchen
2026-02-08 14:32:18 +08:00
committed by lyingbug
parent 1bdd9a4693
commit 9a073d62bf
25 changed files with 1119 additions and 118 deletions
@@ -51,7 +51,7 @@
{{ org.share_count ?? 0 }}
</span>
<span class="org-meta-tag">
<t-icon name="control-platform" class="org-meta-icon org-meta-icon-agent" />
<img src="@/assets/img/agent.svg" class="org-meta-icon org-meta-icon-agent" alt="" aria-hidden="true" />
{{ org.agent_share_count ?? 0 }}
</span>
</div>
@@ -107,7 +107,7 @@
</span>
<t-tooltip :content="$t('organization.share.spaceAgentShareCountTip')" placement="top">
<span class="org-meta-tag">
<t-icon name="control-platform" class="org-meta-icon org-meta-icon-agent" />
<img src="@/assets/img/agent.svg" class="org-meta-icon org-meta-icon-agent" alt="" aria-hidden="true" />
{{ getOrgForShare(share.organization_id)?.agent_share_count ?? 0 }}
</span>
</t-tooltip>
@@ -378,7 +378,8 @@ defineExpose({ loadShares })
opacity: 0.75;
}
.org-meta-icon-agent {
font-size: 12px;
width: 12px;
height: 12px;
opacity: 0.75;
}
}
@@ -491,7 +492,8 @@ defineExpose({ loadShares })
opacity: 0.75;
}
.org-meta-icon-agent {
font-size: 12px;
width: 12px;
height: 12px;
opacity: 0.75;
}
}
+10 -3
View File
@@ -7,8 +7,9 @@
</div>
</div>
<nav class="sidebar-nav">
<!-- 全部 -->
<!-- 全部:仅组织模式显示;知识库/智能体列表不展示「全部」 -->
<div
v-if="mode !== 'resource'"
class="sidebar-item"
:class="{ active: selected === 'all' }"
@click="select('all')"
@@ -32,12 +33,12 @@
</div>
<span v-if="countMine !== undefined" class="item-count">{{ countMine }}</span>
</div>
<template v-if="organizations.length">
<template v-if="organizationsWithCount.length">
<div class="sidebar-section">
<span class="section-title">{{ $t('listSpaceSidebar.spaces') }}</span>
</div>
<div
v-for="org in organizations"
v-for="org in organizationsWithCount"
:key="org.id"
class="sidebar-item org-item"
:class="{ active: selected === org.id }"
@@ -117,6 +118,12 @@ const selected = computed({
const organizations = computed(() => orgStore.organizations || [])
/** 资源模式下只展示数量大于 0 的空间 */
const organizationsWithCount = computed(() => {
if (props.mode !== 'resource') return organizations.value
return organizations.value.filter((org) => (props.countByOrg?.[org.id] ?? 0) > 0)
})
function select(value: string) {
selected.value = value
}
@@ -61,6 +61,9 @@
{{ detailCache[item.id].data.org_name || item.orgName }}
</span>
</span>
<span v-if="agentIdForDetail && (detailCache[item.id].data.org_name || item.orgName)" class="detail-readonly-hint">
{{ $t('mentionDetail.readOnlyFromAgent') }}
</span>
</div>
</template>
</div>
@@ -509,6 +512,14 @@ const scrollToItem = (index: number) => {
gap: 6px;
align-items: flex-start;
}
.mention-detail-content .detail-readonly-hint {
display: block;
margin-top: 6px;
font-size: var(--td-font-size-mark-small, 12px);
color: var(--td-text-color-placeholder, #999);
font-style: italic;
}
.mention-detail-content .detail-org,
.mention-detail-content .detail-kb {
display: inline-flex;