fix(integrations): polish agent filter UX and embed session rebind

Add compact agent filter beside channel list titles with selected name
display, fix embed localStorage agentId read on rebind, add IM agent
rebind tests, and deep-link agent editor counts to the matching tab.
This commit is contained in:
wizardchen
2026-06-24 20:08:14 +08:00
committed by lyingbug
parent ec5c3ac638
commit babe3f2315
11 changed files with 309 additions and 120 deletions
+24 -10
View File
@@ -79,15 +79,13 @@
</div>
<div class="setting-control">
<div class="integration-inline">
<span class="integration-inline__stat">
{{ $t('integrations.tabs.im') }} · {{ agentIMChannelCount }}
</span>
<button type="button" class="integration-inline__stat integration-inline__link" @click="gotoIntegrations('im')">
<span>{{ $t('integrations.tabs.im') }} · {{ agentIMChannelCount }}</span>
<t-icon name="chevron-right" size="14px" />
</button>
<span class="integration-inline__sep" aria-hidden="true">|</span>
<span class="integration-inline__stat">
{{ $t('integrations.tabs.embed') }} · {{ agentEmbedChannelCount }}
</span>
<button type="button" class="integration-inline__link" @click="gotoIntegrations">
<span>{{ $t('integrations.agentEditor.manage') }}</span>
<button type="button" class="integration-inline__stat integration-inline__link" @click="gotoIntegrations('embed')">
<span>{{ $t('integrations.tabs.embed') }} · {{ agentEmbedChannelCount }}</span>
<t-icon name="chevron-right" size="14px" />
</button>
</div>
@@ -2084,11 +2082,11 @@ async function loadAgentIntegrationCounts(agentId: string) {
}
}
function gotoIntegrations() {
function gotoIntegrations(tab: 'im' | 'embed') {
const agentId = editorAgent.value?.id;
if (!agentId) return;
handleClose();
router.push({ path: '/platform/integrations', query: { agentId } });
router.push({ path: '/platform/integrations', query: { agentId, tab } });
}
const filteredIntentPlaceholders = computed(() => {
@@ -4285,6 +4283,22 @@ const handleSave = async () => {
&__stat {
font-size: 13px;
color: var(--td-text-color-secondary);
&.integration-inline__link {
display: inline-flex;
align-items: center;
gap: 2px;
padding: 0;
border: none;
background: transparent;
line-height: 1;
color: var(--td-brand-color);
cursor: pointer;
&:hover {
opacity: 0.85;
}
}
}
&__sep {
@@ -46,7 +46,7 @@
</a>
</p>
</div>
<IMChannelPanel tenant-mode :initial-agent-id="initialAgentId" />
<IMChannelPanel v-model:filter-agent-id="filterAgentId" />
</div>
<div v-if="currentSection === 'embed'" class="section">
@@ -54,7 +54,7 @@
<h2>{{ $t('agentEditor.embed.title') }}</h2>
<p class="section-description">{{ $t('agentEditor.embed.description') }}</p>
</div>
<AgentEmbedChannelPanel tenant-mode :initial-agent-id="initialAgentId" />
<AgentEmbedChannelPanel v-model:filter-agent-id="filterAgentId" />
</div>
</div>
</div>
@@ -77,7 +77,7 @@ const route = useRoute();
const router = useRouter();
const currentSection = ref<'im' | 'embed'>('im');
const initialAgentId = ref('');
const filterAgentId = ref('');
const visible = computed(() => route.name === 'integrations');
@@ -91,13 +91,13 @@ function applyRouteQuery() {
if (tab === 'im' || tab === 'embed') {
currentSection.value = tab;
}
initialAgentId.value = (route.query.agentId as string) || '';
filterAgentId.value = (route.query.agentId as string) || '';
}
function syncRouteQuery() {
const query: Record<string, string> = { tab: currentSection.value };
if (initialAgentId.value) {
query.agentId = initialAgentId.value;
if (filterAgentId.value) {
query.agentId = filterAgentId.value;
}
router.replace({ path: route.path, query });
}
@@ -119,6 +119,10 @@ watch(currentSection, () => {
if (visible.value) syncRouteQuery();
});
watch(filterAgentId, () => {
if (visible.value) syncRouteQuery();
});
watch(
() => [route.query.tab, route.query.agentId],
() => {