feat(agent): enhance agent sharing and selection features
- Updated the AgentSelector component to improve agent selection logic, ensuring accurate representation of selected agents. - Introduced new AgentShareSettings component for managing agent sharing with organizations, including UI for selecting organizations and displaying shared agents. - Enhanced API interactions for sharing agents, including new methods for listing and managing agent shares. - Improved localization support for agent sharing features across multiple languages. - Updated various components to reflect changes in agent capabilities and sharing status, enhancing user experience and clarity. This update strengthens the agent management features, providing users with better tools for sharing and selecting agents within organizations.
This commit is contained in:
@@ -38,13 +38,17 @@
|
||||
</t-tag>
|
||||
</div>
|
||||
<div class="org-option-meta">
|
||||
<span class="org-meta-item">
|
||||
<span class="org-meta-tag">
|
||||
<t-icon name="user" class="org-meta-icon org-meta-icon-user" />
|
||||
{{ org.member_count || 0 }} {{ $t('organization.members') }}
|
||||
{{ org.member_count ?? 0 }}
|
||||
</span>
|
||||
<span v-if="org.share_count !== undefined" class="org-meta-item">
|
||||
<span class="org-meta-tag">
|
||||
<img src="@/assets/img/zhishiku.svg" class="org-meta-icon org-meta-icon-kb" alt="" aria-hidden="true" />
|
||||
{{ org.share_count }} {{ $t('organization.share.sharedKBs') }}
|
||||
{{ org.share_count ?? 0 }}
|
||||
</span>
|
||||
<span class="org-meta-tag">
|
||||
<img src="@/assets/img/organization-grey.svg" class="org-meta-icon org-meta-icon-kb" alt="" aria-hidden="true" />
|
||||
{{ org.agent_share_count ?? 0 }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -91,28 +95,39 @@
|
||||
<div v-else class="shares-list">
|
||||
<div v-for="share in shares" :key="share.id" class="share-item">
|
||||
<div class="share-info">
|
||||
<div class="share-org">
|
||||
<SpaceAvatar
|
||||
:name="share.organization_name || ''"
|
||||
:avatar="orgStore.organizations.find(o => o.id === share.organization_id)?.avatar"
|
||||
<div class="share-info-top">
|
||||
<div class="share-org">
|
||||
<SpaceAvatar
|
||||
:name="share.organization_name || ''"
|
||||
:avatar="orgStore.organizations.find(o => o.id === share.organization_id)?.avatar"
|
||||
size="small"
|
||||
/>
|
||||
<span class="org-name">{{ share.organization_name }}</span>
|
||||
</div>
|
||||
<t-tag
|
||||
:theme="share.permission === 'editor' ? 'warning' : 'default'"
|
||||
size="small"
|
||||
/>
|
||||
<span class="org-name">{{ share.organization_name }}</span>
|
||||
variant="light"
|
||||
>
|
||||
{{ share.permission === 'editor' ? $t('organization.share.permissionEditable') : $t('organization.share.permissionReadonly') }}
|
||||
</t-tag>
|
||||
</div>
|
||||
<div class="share-item-meta">
|
||||
<span class="org-meta-tag">
|
||||
<t-icon name="user" class="org-meta-icon org-meta-icon-user" />
|
||||
{{ getOrgForShare(share.organization_id)?.member_count ?? 0 }}
|
||||
</span>
|
||||
<span class="org-meta-tag">
|
||||
<img src="@/assets/img/zhishiku.svg" class="org-meta-icon org-meta-icon-kb" alt="" aria-hidden="true" />
|
||||
{{ getOrgForShare(share.organization_id)?.share_count ?? 0 }}
|
||||
</span>
|
||||
<span class="org-meta-tag">
|
||||
<img src="@/assets/img/organization-grey.svg" class="org-meta-icon org-meta-icon-kb" alt="" aria-hidden="true" />
|
||||
{{ getOrgForShare(share.organization_id)?.agent_share_count ?? 0 }}
|
||||
</span>
|
||||
</div>
|
||||
<t-tag
|
||||
:theme="share.permission === 'editor' ? 'warning' : 'default'"
|
||||
size="small"
|
||||
variant="light"
|
||||
>
|
||||
{{ share.permission === 'editor' ? $t('organization.share.permissionEditable') : $t('organization.share.permissionReadonly') }}
|
||||
</t-tag>
|
||||
</div>
|
||||
<div class="share-actions">
|
||||
<t-tooltip :content="$t('organization.settings.editTitle')" placement="top">
|
||||
<t-button variant="text" theme="default" size="small" @click="handleGoToOrgSettings(share.organization_id)">
|
||||
<t-icon name="setting" />
|
||||
</t-button>
|
||||
</t-tooltip>
|
||||
<t-select
|
||||
:value="share.permission"
|
||||
size="small"
|
||||
@@ -151,16 +166,18 @@
|
||||
import { ref, computed, watch, onMounted } from 'vue'
|
||||
import { MessagePlugin } from 'tdesign-vue-next'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useOrganizationStore } from '@/stores/organization'
|
||||
import { shareKnowledgeBase, listKBShares, removeShare, updateSharePermission } from '@/api/organization'
|
||||
import type { KnowledgeBaseShare } from '@/api/organization'
|
||||
import SpaceAvatar from '@/components/SpaceAvatar.vue'
|
||||
|
||||
const { t } = useI18n()
|
||||
const router = useRouter()
|
||||
const orgStore = useOrganizationStore()
|
||||
|
||||
function getOrgForShare(organizationId: string) {
|
||||
return orgStore.organizations.find(o => o.id === organizationId)
|
||||
}
|
||||
|
||||
interface Props {
|
||||
kbId: string
|
||||
}
|
||||
@@ -275,14 +292,6 @@ async function handleUnshare(share: KnowledgeBaseShare) {
|
||||
}
|
||||
}
|
||||
|
||||
// Navigate to organization settings
|
||||
function handleGoToOrgSettings(orgId: string) {
|
||||
router.push({
|
||||
path: '/platform/organizations',
|
||||
query: { orgId }
|
||||
})
|
||||
}
|
||||
|
||||
// Watch for kbId changes
|
||||
watch(() => props.kbId, async (newKbId) => {
|
||||
if (newKbId) {
|
||||
@@ -439,6 +448,12 @@ onMounted(async () => {
|
||||
}
|
||||
|
||||
.share-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.share-info-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
@@ -457,6 +472,39 @@ onMounted(async () => {
|
||||
}
|
||||
}
|
||||
|
||||
.share-item-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
color: #00000099;
|
||||
|
||||
.org-meta-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 3px;
|
||||
padding: 2px 6px;
|
||||
background: #f0f0f0;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.org-meta-icon {
|
||||
flex-shrink: 0;
|
||||
vertical-align: middle;
|
||||
color: #00000099;
|
||||
}
|
||||
|
||||
.org-meta-icon-user {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.org-meta-icon-kb {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
opacity: 0.75;
|
||||
}
|
||||
}
|
||||
|
||||
.share-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -558,15 +606,18 @@ onMounted(async () => {
|
||||
.org-option-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
gap: 6px;
|
||||
font-family: "PingFang SC";
|
||||
font-size: 12px;
|
||||
color: #00000099;
|
||||
|
||||
.org-meta-item {
|
||||
display: flex;
|
||||
.org-meta-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 3px;
|
||||
padding: 0px 4px;
|
||||
background: #f0f0f0;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.org-meta-icon {
|
||||
@@ -576,14 +627,12 @@ onMounted(async () => {
|
||||
}
|
||||
|
||||
.org-meta-icon-user {
|
||||
font-size: 14px;
|
||||
margin-right: 2px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.org-meta-icon-kb {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
margin-right: 2px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
opacity: 0.75;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user