feat(frontend): add publish integrations center and streamline agent editor

Move IM and web embed channel management into a dedicated sidebar entry,
remove the user-menu IM overview submenu, and show a lightweight publish
channel status row in the agent editor basic settings instead of full panels.
This commit is contained in:
wizardchen
2026-06-24 16:28:39 +08:00
committed by lyingbug
parent 4db727ac69
commit 314b2a035c
19 changed files with 1398 additions and 876 deletions
+98 -42
View File
@@ -71,6 +71,29 @@
</div>
</div>
<!-- 集成渠道状态(编辑模式,配置在集成中心) -->
<div v-if="editorMode === 'edit' && editorAgent?.id" class="setting-row">
<div class="setting-info">
<label>{{ $t('integrations.agentEditor.label') }}</label>
<p class="desc">{{ $t('integrations.agentEditor.desc') }}</p>
</div>
<div class="setting-control">
<div class="integration-inline">
<span class="integration-inline__stat">
{{ $t('integrations.tabs.im') }} · {{ agentIMChannelCount }}
</span>
<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>
<t-icon name="chevron-right" size="14px" />
</button>
</div>
</div>
</div>
<!-- 运行模式(首先选择) -->
<div class="setting-row">
<div class="setting-info">
@@ -1315,39 +1338,6 @@
v-show="currentSection === 'share'" class="section">
<AgentShareSettings :agent-id="editorAgent.id" :agent="editorAgent" />
</div>
<!-- IM集成(仅编辑模式) -->
<div v-if="editorMode === 'edit' && editorAgent?.id && currentSection === 'im'" class="section">
<div class="section-header">
<h2>{{ $t('agentEditor.im.title') }}</h2>
<p class="section-description">
{{ $t('agentEditor.im.description') }}
<a href="https://github.com/Tencent/WeKnora/blob/main/docs/IM%E9%9B%86%E6%88%90%E5%BC%80%E5%8F%91%E6%96%87%E6%A1%A3.md"
target="_blank" rel="noopener noreferrer" class="doc-link">
{{ $t('agentEditor.im.docLink') }}
<t-icon name="link" class="link-icon" />
</a>
</p>
</div>
<div class="settings-group">
<IMChannelPanel :agent-id="editorAgent.id" />
</div>
</div>
<!-- 网页嵌入(仅编辑模式) -->
<div v-if="editorMode === 'edit' && editorAgent?.id && currentSection === 'embed'" class="section">
<div class="section-header">
<h2>{{ $t('agentEditor.embed.title') }}</h2>
<p class="section-description">{{ $t('agentEditor.embed.description') }}</p>
</div>
<div class="settings-group">
<AgentEmbedChannelPanel
:agent-id="editorAgent.id"
:agent-web-search-enabled="formData.config?.web_search_enabled === true"
:agent-image-upload-enabled="formData.config?.image_upload_enabled === true"
/>
</div>
</div>
</div>
<!-- 底部操作栏 -->
@@ -1372,6 +1362,7 @@
<script setup lang="ts">
import { ref, computed, watch, nextTick, onMounted, onBeforeUnmount } from 'vue';
import { useRouter } from 'vue-router';
import AgentCreateContextualGuide from '@/components/AgentCreateContextualGuide.vue';
import {
AGENT_EDITOR_FOCUS_SECTION_EVENT,
@@ -1382,6 +1373,7 @@ import { MessagePlugin } from 'tdesign-vue-next';
import {
createAgent,
updateAgent,
listIMChannels,
type CustomAgent,
type PlaceholderDefinition,
type AgentTypePreset,
@@ -1403,8 +1395,7 @@ import AgentAvatar from '@/components/AgentAvatar.vue';
import PromptTemplateSelector from '@/components/PromptTemplateSelector.vue';
import ModelSelector from '@/components/ModelSelector.vue';
import AgentShareSettings from '@/components/AgentShareSettings.vue';
import IMChannelPanel from '@/components/IMChannelPanel.vue';
import AgentEmbedChannelPanel from '@/components/AgentEmbedChannelPanel.vue';
import { listEmbedChannels } from '@/api/embed';
import { getRootZoom, rectToCssPx } from '@/utils/zoom';
import {
evaluateToolRequirement,
@@ -1415,6 +1406,7 @@ import {
const uiStore = useUIStore();
const authStore = useAuthStore();
const router = useRouter();
const orgStore = useOrganizationStore();
const chatResources = useChatResourcesStore();
const editorResources = useEditorResourcesStore();
@@ -1472,7 +1464,7 @@ const currentSection = ref(props.initialSection || 'basic');
const onAgentEditorFocusSection = (event: Event) => {
const section = (event as CustomEvent<{ section?: string }>).detail?.section
if (section) {
if (section && navItems.value.some((item) => item.key === section)) {
currentSection.value = section
}
}
@@ -1857,14 +1849,10 @@ const navItems = computed(() => {
if (isAgentMode.value && skillsAvailable.value) {
items.push({ key: 'skills', icon: 'lightbulb', label: t('agent.editor.skillsConfig') });
}
// 发布与集成(仅编辑模式)
// 发布(仅编辑模式)
if (editorMode.value === 'edit' && editorAgent.value?.id && !editorAgent.value?.is_builtin && !authStore.isLiteMode) {
items.push({ key: 'share', icon: 'share', label: t('knowledgeEditor.sidebar.share') });
}
if (editorMode.value === 'edit' && editorAgent.value?.id) {
items.push({ key: 'im', icon: 'chat-message', label: t('agentEditor.im.title') });
items.push({ key: 'embed', icon: 'internet', label: t('agentEditor.embed.title') });
}
return items;
});
@@ -1892,7 +1880,7 @@ const navGroups = computed(() => {
{
key: 'integration',
label: t('agentEditor.navGroups.integration'),
items: pickItems(['share', 'im', 'embed']),
items: pickItems(['share']),
},
].filter((group) => group.items.length > 0);
});
@@ -2079,6 +2067,30 @@ watch(currentSection, (section) => {
}
});
const agentIMChannelCount = ref(0);
const agentEmbedChannelCount = ref(0);
async function loadAgentIntegrationCounts(agentId: string) {
try {
const [imResp, embedResp] = await Promise.all([
listIMChannels(agentId),
listEmbedChannels(agentId),
]);
agentIMChannelCount.value = imResp?.data?.length ?? 0;
agentEmbedChannelCount.value = embedResp?.data?.length ?? 0;
} catch {
agentIMChannelCount.value = 0;
agentEmbedChannelCount.value = 0;
}
}
function gotoIntegrations() {
const agentId = editorAgent.value?.id;
if (!agentId) return;
handleClose();
router.push({ path: '/platform/integrations', query: { agentId } });
}
const filteredIntentPlaceholders = computed(() => {
if (!intentPromptPopup.value.prefix) {
return placeholderData.value.system_prompt;
@@ -2492,6 +2504,7 @@ watch(() => props.visible, async (val) => {
if (agentData.is_builtin) {
fillBuiltinAgentDefaults();
}
void loadAgentIntegrationCounts(agentData.id);
} else {
// 创建新智能体,使用系统默认值
const newFormData = JSON.parse(JSON.stringify(defaultFormData));
@@ -2557,6 +2570,9 @@ watch(() => props.visible, async (val) => {
}
applyDefaultChatModelIfEmpty()
}
} else {
agentIMChannelCount.value = 0;
agentEmbedChannelCount.value = 0;
}
});
@@ -4259,6 +4275,46 @@ const handleSave = async () => {
}
}
.integration-inline {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
justify-content: flex-end;
&__stat {
font-size: 13px;
color: var(--td-text-color-secondary);
}
&__sep {
color: var(--td-component-stroke);
font-size: 12px;
}
&__link {
display: inline-flex;
align-items: center;
gap: 2px;
margin-left: 4px;
padding: 0;
border: none;
background: transparent;
font-size: 13px;
line-height: 1;
color: var(--td-brand-color);
cursor: pointer;
&:hover {
opacity: 0.85;
}
:deep(.t-icon) {
display: block;
}
}
}
.select-option-with-tag {
display: flex;
align-items: center;
+7
View File
@@ -1128,6 +1128,13 @@ const fetchList = (force = false) => {
const checkAndOpenEditModal = () => {
const editId = route.query.edit as string
const section = route.query.section as string
if (editId && (section === 'im' || section === 'embed' || section === 'integrations')) {
router.replace({
path: '/platform/integrations',
query: { tab: section, agentId: editId },
})
return
}
if (editId) {
const agent = agents.value.find(a => a.id === editId)
if (agent) {
@@ -0,0 +1,330 @@
<template>
<Teleport to="body">
<Transition name="modal">
<div v-if="visible" class="settings-overlay" @click.self="handleClose">
<div class="settings-modal">
<button class="close-btn" @click="handleClose" :aria-label="$t('common.close')">
<svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
<path d="M15 5L5 15M5 5L15 15" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
</svg>
</button>
<div class="settings-container">
<div class="settings-sidebar">
<div class="sidebar-header">
<h2 class="sidebar-title">{{ $t('integrations.title') }}</h2>
<p class="sidebar-subtitle">{{ $t('integrations.subtitle') }}</p>
</div>
<div class="settings-nav">
<div
v-for="item in navItems"
:key="item.key"
:class="['nav-item', { active: currentSection === item.key }]"
@click="currentSection = item.key"
>
<t-icon :name="item.icon" class="nav-icon" />
<span class="nav-label">{{ item.label }}</span>
</div>
</div>
</div>
<div class="settings-content">
<div class="content-wrapper">
<div v-show="currentSection === 'im'" class="section">
<div class="section-header">
<h2>{{ $t('agentEditor.im.title') }}</h2>
<p class="section-description">
{{ $t('agentEditor.im.description') }}
<a
href="https://github.com/Tencent/WeKnora/blob/main/docs/IM%E9%9B%86%E6%88%90%E5%BC%80%E5%8F%91%E6%96%87%E6%A1%A3.md"
target="_blank"
rel="noopener noreferrer"
class="doc-link"
>
{{ $t('agentEditor.im.docLink') }}
<t-icon name="link" class="link-icon" />
</a>
</p>
</div>
<IMChannelPanel tenant-mode :initial-agent-id="initialAgentId" />
</div>
<div v-show="currentSection === 'embed'" class="section">
<div class="section-header">
<h2>{{ $t('agentEditor.embed.title') }}</h2>
<p class="section-description">{{ $t('agentEditor.embed.description') }}</p>
</div>
<AgentEmbedChannelPanel tenant-mode :initial-agent-id="initialAgentId" />
</div>
</div>
</div>
</div>
</div>
</div>
</Transition>
</Teleport>
</template>
<script setup lang="ts">
import { computed, ref, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import IMChannelPanel from '@/components/IMChannelPanel.vue';
import AgentEmbedChannelPanel from '@/components/AgentEmbedChannelPanel.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const currentSection = ref<'im' | 'embed'>('im');
const initialAgentId = ref('');
const visible = computed(() => route.name === 'integrations');
const navItems = computed(() => [
{ key: 'im' as const, icon: 'chat-message', label: t('integrations.tabs.im') },
{ key: 'embed' as const, icon: 'code', label: t('integrations.tabs.embed') },
]);
function applyRouteQuery() {
const tab = route.query.tab as string;
if (tab === 'im' || tab === 'embed') {
currentSection.value = tab;
}
initialAgentId.value = (route.query.agentId as string) || '';
}
function syncRouteQuery() {
const query: Record<string, string> = { tab: currentSection.value };
if (initialAgentId.value) {
query.agentId = initialAgentId.value;
}
router.replace({ path: route.path, query });
}
function handleClose() {
if (route.name !== 'integrations') return;
if (window.history.length > 1) {
router.back();
} else {
router.push('/platform/knowledge-bases');
}
}
watch(visible, (open) => {
if (open) applyRouteQuery();
});
watch(currentSection, () => {
if (visible.value) syncRouteQuery();
});
watch(
() => [route.query.tab, route.query.agentId],
() => {
if (visible.value) applyRouteQuery();
},
);
</script>
<style scoped lang="less">
.settings-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
backdrop-filter: blur(4px);
}
.settings-modal {
position: relative;
width: 90vw;
max-width: 1100px;
height: 85vh;
max-height: 750px;
background: var(--td-bg-color-container);
border-radius: 12px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
display: flex;
flex-direction: column;
overflow: hidden;
}
.close-btn {
position: absolute;
top: 16px;
right: 16px;
width: 32px;
height: 32px;
border: none;
background: transparent;
border-radius: 6px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
color: var(--td-text-color-secondary);
transition: all 0.2s ease;
z-index: 10;
&:hover {
background: var(--td-bg-color-container-hover);
color: var(--td-text-color-primary);
}
}
.settings-container {
display: flex;
height: 100%;
width: 100%;
overflow: hidden;
}
.settings-sidebar {
width: 208px;
background-color: var(--td-bg-color-settings-modal);
border-right: 1px solid var(--td-component-stroke);
flex-shrink: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.sidebar-header {
padding: 16px 14px 12px;
border-bottom: 1px solid var(--td-component-stroke);
flex-shrink: 0;
}
.sidebar-title {
margin: 0;
font-size: 16px;
font-weight: 600;
color: var(--td-text-color-primary);
}
.sidebar-subtitle {
margin: 6px 0 0;
font-size: 12px;
line-height: 1.45;
color: var(--td-text-color-placeholder);
}
.settings-nav {
flex: 1;
padding: 8px;
overflow-y: auto;
min-height: 0;
}
.nav-item {
display: flex;
align-items: center;
padding: 6px 12px;
margin-bottom: 2px;
border-radius: 6px;
cursor: pointer;
transition: all 0.2s ease;
font-size: 14px;
color: var(--td-text-color-primary);
&:hover {
background: var(--td-bg-color-container-hover);
}
&.active {
background: var(--td-bg-color-secondarycontainer);
color: var(--td-brand-color);
font-weight: 500;
.nav-icon {
color: var(--td-brand-color);
}
}
}
.nav-icon {
margin-right: 8px;
font-size: 16px;
color: var(--td-text-color-secondary);
flex-shrink: 0;
}
.nav-label {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.settings-content {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.content-wrapper {
flex: 1;
overflow-y: auto;
padding: 24px 28px 28px;
}
.section-header {
margin-bottom: 20px;
h2 {
margin: 0 0 8px;
font-size: 18px;
font-weight: 600;
color: var(--td-text-color-primary);
}
}
.section-description {
margin: 0;
font-size: 13px;
line-height: 1.6;
color: var(--td-text-color-secondary);
.doc-link {
color: var(--td-brand-color);
text-decoration: none;
display: inline-flex;
align-items: center;
gap: 4px;
&:hover {
text-decoration: underline;
}
}
.link-icon {
font-size: 14px;
}
}
.modal-enter-active,
.modal-leave-active {
transition: opacity 0.2s ease;
.settings-modal {
transition: transform 0.2s ease, opacity 0.2s ease;
}
}
.modal-enter-from,
.modal-leave-to {
opacity: 0;
.settings-modal {
transform: scale(0.98);
opacity: 0;
}
}
</style>
@@ -0,0 +1,7 @@
<template><div class="route-placeholder" aria-hidden="true" /></template>
<style scoped>
.route-placeholder {
display: none;
}
</style>
+2
View File
@@ -10,6 +10,7 @@
</div>
<!-- 全局设置模态框,供所有 platform 子路由使用 -->
<Settings />
<IntegrationsModal />
<!-- 全局命令面板 (⌘K),随 platform 路由存活 -->
<GlobalCommandPalette />
<!-- 全局右上角"待处理邀请"铃铛。固定定位,z-index 低于抽屉,业务页面
@@ -26,6 +27,7 @@ import { useRoute, useRouter } from 'vue-router'
import useKnowledgeBase from '@/hooks/useKnowledgeBase'
import UploadMask from '@/components/upload-mask.vue'
import Settings from '@/views/settings/Settings.vue'
import IntegrationsModal from '@/views/integrations/IntegrationsModal.vue'
import GlobalCommandPalette from '@/components/GlobalCommandPalette.vue'
import GlobalInvitationBell from '@/components/GlobalInvitationBell.vue'
import NewUserGuide from '@/components/NewUserGuide.vue'