Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

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

wizardchen314b2a035c8a
diff --git a/frontend/src/assets/img/integration-green.svg b/frontend/src/assets/img/integration-green.svg
new file mode 100644
index 000000000..5701e72fe
--- /dev/null
+++ b/frontend/src/assets/img/integration-green.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none">
+ <path d="M4.25 8V12a2 2 0 0 0 2 2H11.5" stroke="#07C05F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+ <path d="M15.75 12V8a2 2 0 0 0-2-2H8.5" stroke="#07C05F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/frontend/src/assets/img/integration.svg b/frontend/src/assets/img/integration.svg
new file mode 100644
index 000000000..35ff4d68a
--- /dev/null
+++ b/frontend/src/assets/img/integration.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none">
+ <path d="M4.25 8V12a2 2 0 0 0 2 2H11.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+ <path d="M15.75 12V8a2 2 0 0 0-2-2H8.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/frontend/src/components/AgentEmbedChannelPanel.vue b/frontend/src/components/AgentEmbedChannelPanel.vue
index 37408d406..5a3f9bff6 100644
--- a/frontend/src/components/AgentEmbedChannelPanel.vue
+++ b/frontend/src/components/AgentEmbedChannelPanel.vue
@@ -20,7 +20,7 @@
@click="openDrawer(ch)"
>
<div class="channel-card__badge">
- <t-icon name="internet" size="18px" />
+ <t-icon name="code" size="18px" />
</div>
<div class="channel-card__body">
<div class="channel-card__header">
@@ -75,7 +75,7 @@
v-model:visible="showDrawer"
:title="drawerTitle"
:description="drawerDescription"
- icon="internet"
+ icon="code"
storage-key="setting-drawer:embed-channel"
:confirm-loading="saving"
:hide-footer="!isAdmin"
@@ -85,6 +85,16 @@
<section class="setting-drawer__section embed-drawer__section">
<h4 class="setting-drawer__section-title">{{ $t('embedPublish.sectionChannel') }}</h4>
+ <div v-if="tenantMode && !editingId" class="form-item">
+ <label class="form-label">{{ $t('integrations.selectAgent') }}</label>
+ <t-select
+ v-model="createAgentId"
+ :options="agentOptions"
+ filterable
+ :placeholder="$t('integrations.selectAgentPlaceholder')"
+ />
+ </div>
+
<div v-if="editingId && isAdmin" class="form-item">
<div class="enable-row">
<span class="form-label form-label--inline">{{ $t('embedPublish.enabled') }}</span>
@@ -182,7 +192,7 @@
<div class="setting-info">
<label>{{ $t('embedPublish.allowWebSearch') }}</label>
<p class="desc">{{ $t('embedPublish.allowWebSearchDesc') }}</p>
- <p v-if="form.allow_web_search && !agentWebSearchEnabled" class="desc desc--warn">
+ <p v-if="form.allow_web_search && !agentWebSearchEnabledEffective" class="desc desc--warn">
{{ $t('embedPublish.agentWebSearchDisabledHint') }}
</p>
</div>
@@ -199,7 +209,7 @@
<div class="setting-info">
<label>{{ $t('embedPublish.allowFileUpload') }}</label>
<p class="desc">{{ $t('embedPublish.allowFileUploadDesc') }}</p>
- <p v-if="form.allow_file_upload && !agentImageUploadEnabled" class="desc desc--warn">
+ <p v-if="form.allow_file_upload && !agentImageUploadEnabledEffective" class="desc desc--warn">
{{ $t('embedPublish.agentImageUploadDisabledHint') }}
</p>
</div>
@@ -477,6 +487,7 @@ import SettingDrawer from '@/components/settings/SettingDrawer.vue'
import EmbedChannelPreview from '@/components/EmbedChannelPreview.vue'
import {
listEmbedChannels,
+ listAllEmbedChannels,
createEmbedChannel,
updateEmbedChannel,
deleteEmbedChannel,
@@ -498,12 +509,17 @@ import {
validateAllowedOrigins,
type AllowedOriginsValidationError,
} from '@/utils/embedAllowedOrigins'
+import { listAgents, type CustomAgent } from '@/api/agent'
-const props = defineProps<{
- agentId: string
+const props = withDefaults(defineProps<{
+ agentId?: string
+ tenantMode?: boolean
+ initialAgentId?: string
agentWebSearchEnabled?: boolean
agentImageUploadEnabled?: boolean
-}>()
+}>(), {
+ tenantMode: false,
+})
const { t } = useI18n()
const authStore = useAuthStore()
@@ -530,6 +546,38 @@ const originsError = ref('')
const drawerSnippetTab = ref<'iframe' | 'widget' | 'secure'>('iframe')
const secureServerLangTab = ref<'node' | 'go'>('node')
const sessionStats = ref<Record<string, number>>({})
+const agents = ref<CustomAgent[]>([])
+const createAgentId = ref('')
+
+const agentOptions = computed(() =>
+ agents.value.map((agent) => ({ label: agent.name, value: agent.id })),
+)
+
+const drawerAgentId = computed(() => {
+ if (!props.tenantMode) return props.agentId || ''
+ if (editingId.value) {
+ return drawerChannel.value?.agent_id || ''
+ }
+ return createAgentId.value
+})
+
+const drawerAgent = computed(() =>
+ agents.value.find((agent) => agent.id === drawerAgentId.value),
+)
+
+const agentWebSearchEnabledEffective = computed(() => {
+ if (props.tenantMode) {
+ return drawerAgent.value?.config?.web_search_enabled === true
+ }
+ return props.agentWebSearchEnabled === true
+})
+
+const agentImageUploadEnabledEffective = computed(() => {
+ if (props.tenantMode) {
+ return drawerAgent.value?.config?.image_upload_enabled === true
+ }
+ return props.agentImageUploadEnabled === true
+})
const EMBED_TOKEN_STORAGE = 'weknora_embed_publish_tokens'
const WEKNORA_BRAND_COLOR = '#07C05F'
@@ -618,6 +666,10 @@ const channelSummary = (ch: EmbedChannel) => {
const parts = [
`${t('embedPublish.rateLimit')} ${ch.rate_limit_per_minute || 30}${t('embedPublish.rateLimitUnit')}`,
]
+ if (props.tenantMode) {
+ const agentName = agents.value.find((agent) => agent.id === ch.agent_id)?.name
+ if (agentName) parts.unshift(agentName)
+ }
if (ch.allowed_origins?.length) {
parts.push(t('embedPublish.originsCount', { n: ch.allowed_origins.length }))
}
@@ -644,11 +696,20 @@ const storeToken = (channelId: string, token: string) => {
}
const load = async () => {
- if (!props.agentId) return
+ if (!props.tenantMode && !props.agentId) return
loading.value = true
try {
- const res = await listEmbedChannels(props.agentId)
- channels.value = res?.data || []
+ if (props.tenantMode) {
+ const [res, agentRes] = await Promise.all([
+ listAllEmbedChannels(),
+ listAgents(),
+ ])
+ channels.value = res?.data || []
+ agents.value = agentRes?.data || []
+ } else {
+ const res = await listEmbedChannels(props.agentId!)
+ channels.value = res?.data || []
+ }
tokenByChannel.value = { ...loadStoredTokens(), ...tokenByChannel.value }
await Promise.all(channels.value.map(async (ch) => {
try {
@@ -665,8 +726,8 @@ const load = async () => {
}
}
-watch(() => props.agentId, () => {
- if (props.agentId) load()
+watch(() => [props.tenantMode, props.agentId], () => {
+ if (props.tenantMode || props.agentId) load()
}, { immediate: true })
const tokenFor = (ch: EmbedChannel) => tokenByChannel.value[ch.id] || ch.publish_token
@@ -779,6 +840,7 @@ const fillFormFromChannel = (ch: EmbedChannel) => {
const openCreate = () => {
editingId.value = ''
editingEnabled.value = true
+ createAgentId.value = props.tenantMode ? (props.initialAgentId || '') : ''
form.value = defaultForm()
originsText.value = ''
originsError.value = ''
@@ -854,7 +916,12 @@ const saveForm = async () => {
const updated = channels.value.find((ch) => ch.id === editingId.value) ?? res?.data
if (updated) fillFormFromChannel(updated)
} else {
- const res = await createEmbedChannel(props.agentId, payload)
+ const targetAgentId = props.tenantMode ? createAgentId.value : props.agentId
+ if (!targetAgentId) {
+ MessagePlugin.warning(t('integrations.selectAgentHint'))
+ return
+ }
+ const res = await createEmbedChannel(targetAgentId, payload)
if (res?.data?.publish_token) {
storeToken(res.data.id, res.data.publish_token)
revealedTokens[res.data.id] = true
diff --git a/frontend/src/components/IMChannelPanel.vue b/frontend/src/components/IMChannelPanel.vue
index 3f6b1b66f..6635a4f37 100644
--- a/frontend/src/components/IMChannelPanel.vue
+++ b/frontend/src/components/IMChannelPanel.vue
@@ -19,8 +19,14 @@
class="channel-card channel-card--clickable"
@click="openDrawer(channel)"
>
- <div class="channel-card__badge">
- <t-icon name="chat-message" size="18px" />
+ <div class="channel-card__badge" :class="`channel-card__badge--${channel.platform}`">
+ <img
+ v-if="platformLogo(channel.platform)"
+ :src="platformLogo(channel.platform)"
+ :alt="platformLabel(channel.platform)"
+ class="channel-card__logo"
+ />
+ <t-icon v-else name="chat-message" size="18px" />
</div>
<div class="channel-card__body">
<div class="channel-card__header">
@@ -73,115 +79,238 @@
<SettingDrawer
v-model:visible="showCreateDialog"
+ class="im-channel-drawer"
:title="drawerTitle"
- icon="chat-message"
+ :description="drawerStepDescription"
storage-key="setting-drawer:im-channel"
width="560px"
:confirm-loading="saving"
+ :confirm-text="drawerConfirmText"
:hide-footer="!authStore.hasRole('admin')"
- @confirm="handleSave"
+ @confirm="handleDrawerConfirm"
@cancel="resetForm"
>
- <div class="drawer-form">
- <!-- Platform -->
- <div class="form-item">
- <label class="form-label">{{ $t('agentEditor.im.platform') }}</label>
- <t-select v-model="formData.platform" :disabled="!!editingChannel" @change="onPlatformChange">
- <t-option value="wecom" :label="$t('agentEditor.im.wecom')">
- <span class="platform-badge wecom" style="margin-right: 8px;">{{ $t('agentEditor.im.wecom') }}</span>
- </t-option>
- <t-option value="feishu" :label="$t('agentEditor.im.feishu')">
- <span class="platform-badge feishu" style="margin-right: 8px;">{{ $t('agentEditor.im.feishu') }}</span>
- </t-option>
- <t-option value="slack" :label="$t('agentEditor.im.slack')">
- <span class="platform-badge slack" style="margin-right: 8px;">{{ $t('agentEditor.im.slack') }}</span>
- </t-option>
- <t-option value="telegram" :label="$t('agentEditor.im.telegram')">
- <span class="platform-badge telegram" style="margin-right: 8px;">{{ $t('agentEditor.im.telegram') }}</span>
- </t-option>
- <t-option value="dingtalk" :label="$t('agentEditor.im.dingtalk')">
- <span class="platform-badge dingtalk" style="margin-right: 8px;">{{ $t('agentEditor.im.dingtalk') }}</span>
- </t-option>
- <t-option value="mattermost" :label="$t('agentEditor.im.mattermost')">
- <span class="platform-badge mattermost" style="margin-right: 8px;">{{ $t('agentEditor.im.mattermost') }}</span>
- </t-option>
- <t-option value="wechat" :label="$t('agentEditor.im.wechat')">
- <span class="platform-badge wechat" style="margin-right: 8px;">{{ $t('agentEditor.im.wechat') }}</span>
- </t-option>
- </t-select>
+ <template #headerIcon>
+ <img
+ v-if="platformLogo(formData.platform)"
+ :src="platformLogo(formData.platform)"
+ :alt="platformLabel(formData.platform)"
+ class="drawer-platform-icon"
+ />
+ <t-icon v-else name="chat-message" />
+ </template>
+
+ <template v-if="wizardStep > 0" #footer-left>
+ <t-button variant="outline" @click="prevWizardStep">
+ {{ $t('datasource.back') }}
+ </t-button>
+ </template>
+
+ <div class="im-steps">
+ <div
+ v-for="(title, i) in stepTitles"
+ :key="i"
+ :class="['im-step', { active: wizardStep === i, done: wizardStep > i }]"
+ >
+ <span class="im-step-num">
+ <t-icon v-if="wizardStep > i" name="check" class="im-step-check" />
+ <template v-else>{{ i + 1 }}</template>
+ </span>
+ <span class="im-step-title">{{ title }}</span>
</div>
+ </div>
- <!-- Name -->
- <div class="form-item">
- <label class="form-label">{{ $t('agentEditor.im.channelName') }}</label>
- <t-input v-model="formData.name" :placeholder="$t('agentEditor.im.channelNamePlaceholder')" />
- </div>
+ <!-- Step 1: Basic -->
+ <div v-if="wizardStep === 0" class="im-step-body">
+ <section class="setting-drawer__section im-drawer__section">
+ <h4 class="setting-drawer__section-title">{{ $t('agentEditor.im.sectionChannel') }}</h4>
+
+ <div v-if="tenantMode && !editingChannel" class="form-item">
+ <label class="form-label required">{{ $t('integrations.selectAgent') }}</label>
+ <t-select
+ v-model="formData.target_agent_id"
+ :options="agentOptions"
+ filterable
+ :placeholder="$t('integrations.selectAgentPlaceholder')"
+ />
+ </div>
- <!-- Mode (hidden for WeChat) -->
- <div v-if="formData.platform !== 'wechat'" class="form-item">
- <label class="form-label">{{ $t('agentEditor.im.mode') }}</label>
- <t-radio-group v-model="formData.mode">
- <t-radio-button value="websocket" :disabled="formData.platform === 'mattermost'">WebSocket</t-radio-button>
- <t-radio-button value="webhook">Webhook</t-radio-button>
- </t-radio-group>
- <p v-if="formData.platform === 'mattermost'" class="form-hint">{{ $t('agentEditor.im.mattermostModeHint') }}</p>
- <p v-else class="form-hint">{{ $t('agentEditor.im.modeHint') }}</p>
- </div>
+ <div class="form-item">
+ <label class="form-label required">{{ $t('agentEditor.im.platform') }}</label>
+ <t-select
+ v-model="formData.platform"
+ :disabled="!!editingChannel"
+ class="im-platform-select"
+ @change="onPlatformChange"
+ >
+ <template v-if="platformLogo(formData.platform)" #prefixIcon>
+ <img
+ :src="platformLogo(formData.platform)"
+ :alt="platformLabel(formData.platform)"
+ class="im-platform-select-prefix"
+ />
+ </template>
+ <t-option
+ v-for="item in platformOptions"
+ :key="item.value"
+ :value="item.value"
+ :label="item.label"
+ >
+ <div class="im-platform-select-option">
+ <img :src="item.logo" :alt="item.label" class="im-platform-select-option__icon" />
+ <span>{{ item.label }}</span>
+ </div>
+ </t-option>
+ </t-select>
+ </div>
- <!-- Callback URL (webhook mode, edit only) -->
- <div v-if="editingChannel && formData.mode === 'webhook'" class="form-item">
- <label class="form-label">{{ $t('agentEditor.im.callbackUrl') }}</label>
- <div class="callback-url-control">
+ <div class="form-item">
+ <label class="form-label">{{ $t('agentEditor.im.channelName') }}</label>
<t-input
- :model-value="getCallbackUrl(editingChannel)"
- readonly
- class="mono-text-input callback-url-input"
+ v-model="formData.name"
+ :placeholder="$t('agentEditor.im.channelNamePlaceholder')"
+ @focus="channelNameTouched = true"
/>
- <t-button size="small" variant="text" :title="$t('common.copy')" @click="copyUrl(editingChannel)">
- <t-icon name="file-copy" />
- </t-button>
+ <p v-if="!editingChannel" class="form-desc">{{ $t('agentEditor.im.channelNameDefaultHint') }}</p>
</div>
- </div>
+ </section>
- <!-- Output mode (hidden for WeChat) -->
- <div v-if="formData.platform !== 'wechat'" class="form-item">
- <label class="form-label">{{ $t('agentEditor.im.outputMode') }}</label>
- <t-radio-group v-model="formData.output_mode">
- <t-radio-button value="stream">{{ $t('agentEditor.im.outputStream') }}</t-radio-button>
- <t-radio-button value="full">{{ $t('agentEditor.im.outputFull') }}</t-radio-button>
- </t-radio-group>
- </div>
+ <section v-if="editingChannel && authStore.hasRole('admin')" class="setting-drawer__section im-drawer__section">
+ <h4 class="setting-drawer__section-title">{{ $t('agentEditor.im.sectionStatus') }}</h4>
+ <div class="setting-row setting-row--last">
+ <div class="setting-info">
+ <label>{{ $t('agentEditor.im.enabled') }}</label>
+ </div>
+ <div class="setting-control">
+ <t-switch v-model="editingEnabled" size="small" />
+ </div>
+ </div>
+ </section>
+ </div>
- <!-- Session Mode -->
- <div class="form-item">
- <label class="form-label">{{ $t('agentEditor.im.sessionMode') }}</label>
- <t-radio-group v-model="formData.session_mode">
- <t-radio-button value="user">{{ $t('agentEditor.im.sessionModeUser') }}</t-radio-button>
- <t-radio-button value="thread"
- :disabled="!platformSupportsThread(formData.platform)">
- {{ $t('agentEditor.im.sessionModeThread') }}
- </t-radio-button>
- </t-radio-group>
- <p class="form-hint">{{ $t('agentEditor.im.sessionModeHint') }}</p>
- </div>
+ <!-- Step 2: Connection -->
+ <div v-else-if="wizardStep === 1" class="im-step-body">
+ <section v-if="formData.platform !== 'wechat'" class="setting-drawer__section im-drawer__section">
+ <h4 class="setting-drawer__section-title">{{ $t('agentEditor.im.sectionAccess') }}</h4>
- <!-- Knowledge base for file messages -->
- <div class="form-item">
- <label class="form-label">{{ $t('agentEditor.im.fileKnowledgeBase') }}</label>
- <t-select
- v-model="formData.knowledge_base_id"
- :placeholder="$t('agentEditor.im.fileKnowledgeBasePlaceholder')"
- clearable
- filterable
- >
- <t-option v-for="kb in knowledgeBases" :key="kb.id" :value="kb.id" :label="kb.name" />
- </t-select>
- <p class="form-hint">{{ $t('agentEditor.im.fileKnowledgeBaseHint') }}</p>
- </div>
+ <div class="form-item">
+ <label class="form-label required">{{ $t('agentEditor.im.mode') }}</label>
+ <div class="option-chips">
+ <button
+ type="button"
+ class="option-chip"
+ :class="{ 'option-chip--active': formData.mode === 'websocket' }"
+ :disabled="formData.platform === 'mattermost'"
+ @click="formData.mode = 'websocket'"
+ >
+ WebSocket
+ </button>
+ <button
+ type="button"
+ class="option-chip"
+ :class="{ 'option-chip--active': formData.mode === 'webhook' }"
+ @click="formData.mode = 'webhook'"
+ >
+ Webhook
+ </button>
+ </div>
+ <p class="form-desc">
+ {{ formData.platform === 'mattermost' ? $t('agentEditor.im.mattermostModeHint') : $t('agentEditor.im.modeHint') }}
+ </p>
+ </div>
+
+ <div class="form-item">
+ <label class="form-label required">{{ $t('agentEditor.im.outputMode') }}</label>
+ <div class="option-chips">
+ <button
+ type="button"
+ class="option-chip"
+ :class="{ 'option-chip--active': formData.output_mode === 'stream' }"
+ @click="formData.output_mode = 'stream'"
+ >
+ {{ $t('agentEditor.im.outputStream') }}
+ </button>
+ <button
+ type="button"
+ class="option-chip"
+ :class="{ 'option-chip--active': formData.output_mode === 'full' }"
+ @click="formData.output_mode = 'full'"
+ >
+ {{ $t('agentEditor.im.outputFull') }}
+ </button>
+ </div>
+ </div>
+ </section>
+
+ <section class="setting-drawer__section im-drawer__section">
+ <h4 class="setting-drawer__section-title">{{ $t('agentEditor.im.sectionSession') }}</h4>
+ <div class="form-item">
+ <label class="form-label required">{{ $t('agentEditor.im.sessionMode') }}</label>
+ <div class="option-chips">
+ <button
+ type="button"
+ class="option-chip"
+ :class="{ 'option-chip--active': formData.session_mode === 'user' }"
+ @click="formData.session_mode = 'user'"
+ >
+ {{ $t('agentEditor.im.sessionModeUser') }}
+ </button>
+ <button
+ type="button"
+ class="option-chip"
+ :class="{ 'option-chip--active': formData.session_mode === 'thread' }"
+ :disabled="!platformSupportsThread(formData.platform)"
+ @click="formData.session_mode = 'thread'"
+ >
+ {{ $t('agentEditor.im.sessionModeThread') }}
+ </button>
+ </div>
+ <p class="form-desc">{{ $t('agentEditor.im.sessionModeHint') }}</p>
+ </div>
+ </section>
+
+ <section v-if="editingChannel && formData.mode === 'webhook'" class="setting-drawer__section im-drawer__section">
+ <h4 class="setting-drawer__section-title">{{ $t('agentEditor.im.sectionCallback') }}</h4>
+ <div class="form-item">
+ <label class="form-label">{{ $t('agentEditor.im.callbackUrl') }}</label>
+ <div class="callback-url-control">
+ <t-input
+ :model-value="getCallbackUrl(editingChannel)"
+ readonly
+ class="mono-text-input callback-url-input"
+ />
+ <t-button size="small" variant="text" :title="$t('common.copy')" @click="copyUrl(editingChannel)">
+ <t-icon name="file-copy" />
+ </t-button>
+ </div>
+ </div>
+ </section>
+ </div>
- <!-- Credentials divider -->
- <div class="form-divider"></div>
+ <!-- Step 3: File knowledge base -->
+ <div v-else-if="wizardStep === 2" class="im-step-body">
+ <section class="setting-drawer__section im-drawer__section">
+ <h4 class="setting-drawer__section-title">{{ $t('agentEditor.im.sectionKnowledge') }}</h4>
+ <div class="form-item">
+ <label class="form-label">{{ $t('agentEditor.im.fileKnowledgeBase') }}</label>
+ <t-select
+ v-model="formData.knowledge_base_id"
+ :placeholder="$t('agentEditor.im.fileKnowledgeBasePlaceholder')"
+ clearable
+ filterable
+ >
+ <t-option v-for="kb in knowledgeBases" :key="kb.id" :value="kb.id" :label="kb.name" />
+ </t-select>
+ <p class="form-desc">{{ $t('agentEditor.im.fileKnowledgeBaseHint') }}</p>
+ </div>
+ </section>
+ </div>
+ <!-- Step 4: Credentials -->
+ <div v-else class="im-step-body">
+ <section class="setting-drawer__section im-drawer__section">
+ <h4 class="setting-drawer__section-title">{{ $t('agentEditor.im.sectionCredentials') }}</h4>
+ <div class="drawer-form">
<!-- WeCom credentials -->
<template v-if="formData.platform === 'wecom'">
<div class="platform-link-hint">
@@ -203,7 +332,7 @@
<div class="form-item">
<label class="form-label">WebSocket Endpoint</label>
<t-input v-model="formData.credentials.ws_endpoint" placeholder="wss://openws.work.weixin.qq.com" />
- <p class="form-hint">{{ $t('agentEditor.im.wecomWSEndpointHint') }}</p>
+ <p class="form-desc">{{ $t('agentEditor.im.wecomWSEndpointHint') }}</p>
</div>
</template>
<template v-else>
@@ -230,7 +359,7 @@
<div class="form-item">
<label class="form-label">API Base URL</label>
<t-input v-model="formData.credentials.api_base_url" placeholder="https://qyapi.weixin.qq.com" />
- <p class="form-hint">{{ $t('agentEditor.im.wecomAPIBaseURLHint') }}</p>
+ <p class="form-desc">{{ $t('agentEditor.im.wecomAPIBaseURLHint') }}</p>
</div>
</template>
</template>
@@ -336,7 +465,7 @@
<div class="form-item">
<label class="form-label">{{ $t('agentEditor.im.dingtalkCardTemplateId') }}</label>
<t-input v-model="formData.credentials.card_template_id" placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.schema" />
- <p class="form-hint">{{ $t('agentEditor.im.dingtalkCardTemplateIdHint') }}</p>
+ <p class="form-desc">{{ $t('agentEditor.im.dingtalkCardTemplateIdHint') }}</p>
</div>
</template>
@@ -365,20 +494,25 @@
<label class="form-label">Bot User ID</label>
<t-input v-model="formData.credentials.bot_user_id" placeholder="Optional — filter bot self-messages" />
</div>
- <div class="form-item mattermost-post-main-row">
- <div class="mattermost-post-main-label">
- <label class="form-label">{{ $t('agentEditor.im.mattermostPostToMain') }}</label>
- <t-switch
- :value="!!formData.credentials.post_to_main"
- @change="(v: boolean) => { formData.credentials.post_to_main = v }"
- />
+ <div class="settings-group">
+ <div class="setting-row setting-row--last">
+ <div class="setting-info">
+ <label>{{ $t('agentEditor.im.mattermostPostToMain') }}</label>
+ <p class="desc">{{ $t('agentEditor.im.mattermostPostToMainHint') }}</p>
+ </div>
+ <div class="setting-control">
+ <t-switch
+ :value="!!formData.credentials.post_to_main"
+ size="small"
+ @change="(v: boolean) => { formData.credentials.post_to_main = v }"
+ />
+ </div>
</div>
- <p class="form-hint">{{ $t('agentEditor.im.mattermostPostToMainHint') }}</p>
</div>
</template>
<!-- WeChat credentials (QR code binding) -->
<template v-if="formData.platform === 'wechat'">
- <p class="form-hint">{{ $t('agentEditor.im.wechatHint') }}</p>
+ <p class="form-desc">{{ $t('agentEditor.im.wechatHint') }}</p>
<!-- Already bound state -->
<div v-if="wechatBound" class="wechat-bound-status">
@@ -419,6 +553,8 @@
</div>
</div>
</template>
+ </div>
+ </section>
</div>
</SettingDrawer>
</div>
@@ -430,30 +566,111 @@ import { useI18n } from 'vue-i18n';
import { DialogPlugin, MessagePlugin } from 'tdesign-vue-next';
import {
listIMChannels, createIMChannel, updateIMChannel, deleteIMChannel, toggleIMChannel,
- getWeChatQRCode, pollWeChatQRCodeStatus,
+ getWeChatQRCode, pollWeChatQRCodeStatus, listAllIMChannels, listAgents,
+ type IMChannelOverview, type CustomAgent,
} from '@/api/agent';
import { useChatResourcesStore } from '@/stores/chatResources';
import type { IMChannel } from '@/api/agent';
import { useAuthStore } from '@/stores/auth';
import SettingDrawer from '@/components/settings/SettingDrawer.vue';
+import wecomLogo from '@/assets/img/im/wecom.svg';
+import feishuLogo from '@/assets/img/im/feishu.svg';
+import slackLogo from '@/assets/img/im/slack.svg';
+import telegramLogo from '@/assets/img/im/telegram.svg';
+import dingtalkLogo from '@/assets/img/im/dingtalk.svg';
+import mattermostLogo from '@/assets/img/im/mattermost.svg';
+import wechatLogo from '@/assets/img/im/wechat.svg';
+
+type IMPlatform = IMChannel['platform'];
+
+const PLATFORM_LOGO: Record<string, string> = {
+ wecom: wecomLogo,
+ feishu: feishuLogo,
+ slack: slackLogo,
+ telegram: telegramLogo,
+ dingtalk: dingtalkLogo,
+ mattermost: mattermostLogo,
+ wechat: wechatLogo,
+};
+
+const platformLogo = (platform: string): string => (platform ? PLATFORM_LOGO[platform] || '' : '');
const { t } = useI18n();
const authStore = useAuthStore();
-const props = defineProps<{
- agentId: string;
-}>();
+const props = withDefaults(defineProps<{
+ agentId?: string;
+ tenantMode?: boolean;
+ initialAgentId?: string;
+}>(), {
+ tenantMode: false,
+});
+
+const agents = ref<CustomAgent[]>([]);
+const agentOptions = computed(() =>
+ agents.value.map((agent) => ({ label: agent.name, value: agent.id })),
+);
-const channels = ref<IMChannel[]>([]);
+const channels = ref<Array<IMChannel | IMChannelOverview>>([]);
const loading = ref(false);
const saving = ref(false);
const showCreateDialog = ref(false);
const editingChannel = ref<IMChannel | null>(null);
+const editingEnabled = ref(true);
+const wizardStep = ref(0);
+const channelNameTouched = ref(false);
+
+const stepTitles = computed(() => [
+ t('agentEditor.im.stepBasic'),
+ t('agentEditor.im.stepConnection'),
+ t('agentEditor.im.stepKnowledge'),
+ t('agentEditor.im.stepCredentials'),
+]);
-const drawerTitle = computed(() =>
- editingChannel.value ? t('agentEditor.im.editChannel') : t('agentEditor.im.addChannel'),
+const drawerStepDescription = computed(() => stepTitles.value[wizardStep.value] ?? '');
+
+const drawerConfirmText = computed(() =>
+ wizardStep.value < stepTitles.value.length - 1 ? t('common.next') : t('common.save'),
);
+const platformOptions = computed(() => ([
+ { value: 'wecom' as IMPlatform, label: t('agentEditor.im.wecom'), logo: wecomLogo },
+ { value: 'feishu' as IMPlatform, label: t('agentEditor.im.feishu'), logo: feishuLogo },
+ { value: 'slack' as IMPlatform, label: t('agentEditor.im.slack'), logo: slackLogo },
+ { value: 'telegram' as IMPlatform, label: t('agentEditor.im.telegram'), logo: telegramLogo },
+ { value: 'dingtalk' as IMPlatform, label: t('agentEditor.im.dingtalk'), logo: dingtalkLogo },
+ { value: 'mattermost' as IMPlatform, label: t('agentEditor.im.mattermost'), logo: mattermostLogo },
+ { value: 'wechat' as IMPlatform, label: t('agentEditor.im.wechat'), logo: wechatLogo },
+]));
+
+const drawerTitle = computed(() => {
+ if (editingChannel.value) {
+ return formData.value.name?.trim() || t('agentEditor.im.unnamed');
+ }
+ return t('agentEditor.im.addChannel');
+});
+
+function validateWizardStep(step: number): boolean {
+ if (step === 0 && props.tenantMode && !editingChannel.value && !formData.value.target_agent_id) {
+ MessagePlugin.warning(t('integrations.selectAgentHint'));
+ return false;
+ }
+ return true;
+}
+
+function prevWizardStep() {
+ if (wizardStep.value > 0) wizardStep.value -= 1;
+}
+
+async function handleDrawerConfirm() {
+ if (wizardStep.value < stepTitles.value.length - 1) {
+ if (!validateWizardStep(wizardStep.value)) return;
+ wizardStep.value += 1;
+ return;
+ }
+ await handleSave();
+}
+
// Knowledge base options for file-to-KB feature
const knowledgeBases = ref<{ id: string; name: string }[]>([]);
@@ -469,6 +686,7 @@ let wechatPollTimer: ReturnType<typeof setTimeout> | null = null;
const defaultCredentials = (): Record<string, any> => ({});
const formData = ref({
+ target_agent_id: '',
platform: 'wecom' as 'wecom' | 'feishu' | 'slack' | 'telegram' | 'dingtalk' | 'mattermost' | 'wechat',
name: '',
mode: 'websocket' as 'webhook' | 'websocket' | 'longpoll',
@@ -482,7 +700,7 @@ const channelMenuOptions = computed(() => ([
{ content: t('common.delete'), value: 'delete', theme: 'error' },
]));
-const channelSummary = (channel: IMChannel) => {
+const channelSummary = (channel: IMChannel | IMChannelOverview) => {
const parts = [
platformLabel(channel.platform),
channel.mode,
@@ -491,14 +709,31 @@ const channelSummary = (channel: IMChannel) => {
if (channel.session_mode === 'thread') {
parts.push(t('agentEditor.im.sessionModeThread'));
}
+ if (props.tenantMode) {
+ const agentName = agentLabel(channel.agent_id, (channel as IMChannelOverview).agent_name);
+ if (agentName) parts.unshift(agentName);
+ }
return parts.join(' · ');
};
+function agentLabel(agentId: string, overviewName?: string): string {
+ if (overviewName) return overviewName;
+ return agents.value.find((agent) => agent.id === agentId)?.name || '';
+}
+
function platformLabel(platform: string): string {
const key = `agentEditor.im.${platform}`;
return t(key);
}
+function defaultChannelName(platform: string = formData.value.platform): string {
+ return platformLabel(platform);
+}
+
+function resolvedChannelName(): string {
+ return formData.value.name.trim() || defaultChannelName();
+}
+
function platformSupportsThread(platform: string): boolean {
return ['slack', 'mattermost', 'feishu', 'telegram'].includes(platform);
}
@@ -526,6 +761,7 @@ const wechatBound = computed(() => {
function onPlatformChange(val: string | number | boolean) {
+ if (editingChannel.value) return;
formData.value.credentials = defaultCredentials();
stopWeChatPolling();
wechatQRContent.value = '';
@@ -540,6 +776,9 @@ function onPlatformChange(val: string | number | boolean) {
formData.value.mode = 'websocket';
formData.value.output_mode = 'stream';
}
+ if (!channelNameTouched.value) {
+ formData.value.name = defaultChannelName(String(val));
+ }
}
async function startWeChatBinding() {
@@ -617,11 +856,23 @@ async function loadChannels() {
loading.value = true;
try {
const chatResources = useChatResourcesStore();
- const [channelRes] = await Promise.all([
- listIMChannels(props.agentId),
- chatResources.ensureKnowledgeBases(),
- ]);
- channels.value = channelRes.data || [];
+ if (props.tenantMode) {
+ const [channelRes, agentRes] = await Promise.all([
+ listAllIMChannels(),
+ listAgents(),
+ chatResources.ensureKnowledgeBases(),
+ ]);
+ channels.value = channelRes.data || [];
+ agents.value = agentRes?.data || [];
+ } else if (props.agentId) {
+ const [channelRes] = await Promise.all([
+ listIMChannels(props.agentId),
+ chatResources.ensureKnowledgeBases(),
+ ]);
+ channels.value = channelRes.data || [];
+ } else {
+ channels.value = [];
+ }
knowledgeBases.value = chatResources.rawKnowledgeBases.map((kb: any) => ({ id: kb.id, name: kb.name }));
} catch {
channels.value = [];
@@ -659,11 +910,14 @@ async function copyUrl(channel: IMChannel) {
function openCreate() {
resetForm();
+ if (props.tenantMode && props.initialAgentId) {
+ formData.value.target_agent_id = props.initialAgentId;
+ }
showCreateDialog.value = true;
}
-function openDrawer(channel: IMChannel) {
- editChannel(channel);
+function openDrawer(channel: IMChannel | IMChannelOverview) {
+ void editChannel(channel);
}
function confirmDelete(id: string) {
@@ -680,30 +934,53 @@ function confirmDelete(id: string) {
});
}
-function editChannel(channel: IMChannel) {
- editingChannel.value = channel;
+async function editChannel(channel: IMChannel | IMChannelOverview) {
+ wizardStep.value = 0;
+ let fullChannel: IMChannel | null = null;
+ if (props.tenantMode && !('credentials' in channel)) {
+ try {
+ const res = await listIMChannels(channel.agent_id);
+ fullChannel = (res.data || []).find((item) => item.id === channel.id) || null;
+ } catch {
+ fullChannel = null;
+ }
+ } else {
+ fullChannel = channel as IMChannel;
+ }
+ if (!fullChannel) {
+ MessagePlugin.error(t('common.operationFailed'));
+ return;
+ }
+ editingChannel.value = fullChannel;
+ editingEnabled.value = fullChannel.enabled;
+ channelNameTouched.value = true;
formData.value = {
- platform: channel.platform,
- name: channel.name,
- mode: channel.mode,
- output_mode: channel.output_mode,
- session_mode: channel.session_mode || 'user',
- knowledge_base_id: channel.knowledge_base_id || '',
- credentials: { ...channel.credentials },
+ target_agent_id: fullChannel.agent_id,
+ platform: fullChannel.platform,
+ name: fullChannel.name,
+ mode: fullChannel.mode,
+ output_mode: fullChannel.output_mode,
+ session_mode: fullChannel.session_mode || 'user',
+ knowledge_base_id: fullChannel.knowledge_base_id || '',
+ credentials: { ...fullChannel.credentials },
};
showCreateDialog.value = true;
}
function resetForm() {
editingChannel.value = null;
+ editingEnabled.value = true;
+ wizardStep.value = 0;
+ channelNameTouched.value = false;
stopWeChatPolling();
wechatQRContent.value = '';
wechatQRImgUrl.value = '';
wechatQRCode.value = '';
wechatQRStatus.value = '';
formData.value = {
+ target_agent_id: props.tenantMode ? (props.initialAgentId || '') : '',
platform: 'wecom',
- name: '',
+ name: defaultChannelName('wecom'),
mode: 'websocket',
output_mode: 'stream',
session_mode: 'user',
@@ -723,18 +1000,24 @@ async function handleSave() {
if (editingChannel.value) {
await updateIMChannel(editingChannel.value.id, {
- name: formData.value.name,
+ name: resolvedChannelName(),
mode: formData.value.mode,
output_mode: formData.value.output_mode,
session_mode: formData.value.session_mode,
knowledge_base_id: formData.value.knowledge_base_id,
credentials: formData.value.credentials,
+ enabled: editingEnabled.value,
});
MessagePlugin.success(t('common.updateSuccess'));
} else {
- await createIMChannel(props.agentId, {
+ const targetAgentId = props.tenantMode ? formData.value.target_agent_id : props.agentId;
+ if (!targetAgentId) {
+ MessagePlugin.warning(t('integrations.selectAgentHint'));
+ return;
+ }
+ await createIMChannel(targetAgentId, {
platform: formData.value.platform,
- name: formData.value.name,
+ name: resolvedChannelName(),
mode: formData.value.mode,
output_mode: formData.value.output_mode,
session_mode: formData.value.session_mode,
@@ -754,7 +1037,7 @@ async function handleSave() {
}
}
-async function handleToggle(channel: IMChannel) {
+async function handleToggle(channel: IMChannel | IMChannelOverview) {
try {
await toggleIMChannel(channel.id);
await loadChannels();
@@ -774,9 +1057,20 @@ async function handleDelete(id: string) {
}
onMounted(() => {
- loadChannels();
+ if (props.tenantMode || props.agentId) {
+ loadChannels();
+ }
});
+watch(
+ () => [props.tenantMode, props.agentId],
+ () => {
+ if (props.tenantMode || props.agentId) {
+ loadChannels();
+ }
+ },
+);
+
onUnmounted(() => {
stopWeChatPolling();
});
@@ -895,14 +1189,20 @@ onUnmounted(() => {
&__badge {
flex-shrink: 0;
- width: 36px;
- height: 36px;
- border-radius: 9px;
+ width: 28px;
+ height: 28px;
+ border-radius: 7px;
display: flex;
align-items: center;
justify-content: center;
- background: color-mix(in srgb, var(--td-brand-color) 10%, transparent);
- color: var(--td-brand-color);
+ background: var(--td-bg-color-secondarycontainer);
+ overflow: hidden;
+ }
+
+ &__logo {
+ width: 16px;
+ height: 16px;
+ object-fit: contain;
}
&__body {
@@ -969,48 +1269,87 @@ onUnmounted(() => {
}
}
-.platform-badge {
- display: inline-block;
- padding: 2px 8px;
- border-radius: 4px;
+.drawer-platform-icon {
+ width: 16px;
+ height: 16px;
+ object-fit: contain;
+}
+
+.im-steps {
+ display: flex;
+ gap: 8px;
+ margin-bottom: 16px;
+ border-bottom: 1px solid var(--td-component-stroke);
+ padding-bottom: 12px;
+}
+
+.im-step {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ flex: 1;
+ min-width: 0;
font-size: 12px;
+ color: var(--td-text-color-placeholder);
+}
+
+.im-step-title {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.im-step.active {
+ color: var(--td-brand-color);
font-weight: 500;
- line-height: 18px;
+}
- &.wecom {
- background: rgba(0, 130, 239, 0.08);
- color: #0082ef;
- }
+.im-step.done {
+ color: var(--td-text-color-secondary);
+ font-weight: 500;
+}
- &.feishu {
- background: rgba(51, 112, 255, 0.08);
- color: #3370ff;
- }
+.im-step-num {
+ flex-shrink: 0;
+ width: 20px;
+ height: 20px;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 11px;
+ font-weight: 600;
+ border: 1px solid var(--td-component-stroke);
+ color: var(--td-text-color-placeholder);
+ background: transparent;
+}
- &.slack {
- background: rgba(224, 30, 90, 0.08);
- color: #e01e5a;
- }
+.im-step.active .im-step-num {
+ background: var(--td-brand-color);
+ color: #fff;
+ border-color: var(--td-brand-color);
+}
- &.telegram {
- background: rgba(38, 166, 219, 0.08);
- color: #26a6db;
- }
+.im-step.done .im-step-num {
+ background: var(--td-bg-color-secondarycontainer);
+ color: var(--td-brand-color);
+ border-color: var(--td-component-stroke);
+}
- &.dingtalk {
- background: rgba(23, 126, 251, 0.08);
- color: #177efb;
- }
+.im-step-check {
+ font-size: 12px;
+}
- &.mattermost {
- background: rgba(25, 42, 77, 0.08);
- color: #192a4d;
- }
+.im-step-body {
+ display: flex;
+ flex-direction: column;
+ gap: 0;
+}
- &.wechat {
- background: rgba(7, 193, 96, 0.08);
- color: #07c160;
- }
+:deep(.im-drawer__section.setting-drawer__section) {
+ gap: 10px;
+ padding: 10px 0 14px;
}
.callback-url-control {
@@ -1032,44 +1371,143 @@ onUnmounted(() => {
.drawer-form {
display: flex;
flex-direction: column;
- gap: 16px;
+ gap: 12px;
}
.form-item {
- .form-label {
- display: block;
- margin-bottom: 8px;
- font-size: 14px;
- font-weight: 500;
- color: var(--td-text-color-primary);
- }
+ margin-bottom: 0;
}
-.mattermost-post-main-row {
- .mattermost-post-main-label {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 12px;
+.form-label {
+ display: block;
+ margin-bottom: 6px;
+ font-size: 13px;
+ font-weight: 500;
+ color: var(--td-text-color-primary);
+ line-height: 1.4;
- .form-label {
- margin-bottom: 0;
- flex: 1;
- }
+ &--inline {
+ margin-bottom: 0;
+ }
+
+ &.required::after {
+ content: '*';
+ color: var(--td-error-color);
+ margin-left: 4px;
}
}
-.form-divider {
- height: 1px;
- background: var(--td-component-stroke);
- margin: 4px 0;
+.im-platform-select-prefix {
+ width: 16px;
+ height: 16px;
+ object-fit: contain;
}
-.form-hint {
- margin: 6px 0 0;
+.im-platform-select-option {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+
+ &__icon {
+ width: 16px;
+ height: 16px;
+ object-fit: contain;
+ flex-shrink: 0;
+ }
+}
+
+.form-desc {
+ margin: 4px 0 0;
font-size: 12px;
+ line-height: 1.45;
color: var(--td-text-color-placeholder);
- line-height: 1.4;
+}
+
+.option-chips {
+ display: inline-flex;
+ flex-wrap: wrap;
+ gap: 4px;
+ padding: 3px;
+ border-radius: 8px;
+ background: var(--td-bg-color-secondarycontainer);
+}
+
+.option-chip {
+ border: none;
+ background: transparent;
+ color: var(--td-text-color-secondary);
+ font: inherit;
+ font-size: 12px;
+ line-height: 1.3;
+ padding: 5px 10px;
+ border-radius: 6px;
+ cursor: pointer;
+ transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
+ white-space: nowrap;
+
+ &:hover:not(:disabled) {
+ color: var(--td-text-color-primary);
+ }
+
+ &:disabled {
+ opacity: 0.45;
+ cursor: not-allowed;
+ }
+
+ &--active {
+ background: var(--td-bg-color-container);
+ color: var(--td-brand-color);
+ font-weight: 500;
+ box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
+ }
+}
+
+.settings-group {
+ display: flex;
+ flex-direction: column;
+ gap: 0;
+}
+
+.setting-row {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: 12px;
+ padding: 12px 0;
+ border-bottom: 1px solid var(--td-component-stroke);
+
+ &--last {
+ border-bottom: none;
+ padding-bottom: 0;
+ }
+}
+
+.setting-info {
+ flex: 1;
+ min-width: 0;
+ max-width: 72%;
+ padding-right: 8px;
+
+ label {
+ display: block;
+ margin: 0 0 4px;
+ font-size: 13px;
+ font-weight: 500;
+ color: var(--td-text-color-primary);
+ line-height: 1.4;
+ }
+
+ .desc {
+ margin: 0;
+ font-size: 12px;
+ line-height: 1.45;
+ color: var(--td-text-color-placeholder);
+ }
+}
+
+.setting-control {
+ flex-shrink: 0;
+ padding-top: 2px;
}
.platform-link-hint {
@@ -1171,3 +1609,17 @@ onUnmounted(() => {
text-align: center;
}
</style>
+
+<style lang="less">
+.im-channel-drawer .setting-drawer__header-icon:has(.drawer-platform-icon) {
+ background: var(--td-bg-color-container, #fff);
+ box-shadow: inset 0 0 0 1px var(--td-component-stroke);
+}
+
+.im-channel-drawer .drawer-platform-icon {
+ display: block;
+ width: 20px;
+ height: 20px;
+ object-fit: contain;
+}
+</style>
diff --git a/frontend/src/components/IMChannelsOverviewPanel.vue b/frontend/src/components/IMChannelsOverviewPanel.vue
deleted file mode 100644
index 57d38a836..000000000
--- a/frontend/src/components/IMChannelsOverviewPanel.vue
+++ /dev/null
@@ -1,442 +0,0 @@
-<template>
- <div class="im-submenu" @click.stop>
- <div class="submenu-header">
- <div class="titles">
- <h4 class="title">{{ $t('imOverview.pageTitle') }}</h4>
- <p class="subtitle" :title="$t('imOverview.subtitle')">
- {{ $t('imOverview.subtitle') }}
- </p>
- </div>
- <t-button
- variant="text"
- theme="default"
- size="small"
- :loading="loading"
- @click="loadAll"
- >
- <template #icon><t-icon name="refresh" /></template>
- </t-button>
- </div>
-
- <div class="submenu-body">
- <div v-if="loading && channels.length === 0" class="state-placeholder">
- <t-loading size="small" />
- </div>
-
- <div v-else-if="channels.length === 0" class="state-placeholder">
- <span class="empty-text">{{ $t('imOverview.empty') }}</span>
- </div>
-
- <div v-else class="channels-list">
- <div
- v-for="ch in channels"
- :key="ch.id"
- class="channel-item"
- :class="{ 'is-disabled': !ch.enabled }"
- role="button"
- :tabindex="0"
- :title="$t('imOverview.gotoAgentEditor')"
- @click="gotoAgentEditor(ch)"
- @keydown.enter="gotoAgentEditor(ch)"
- @keydown.space.prevent="gotoAgentEditor(ch)"
- >
- <div class="item-main">
- <div class="channel-primary">
- <span class="platform-avatar">
- <img
- v-if="hasPlatformLogo(ch.platform)"
- :src="platformLogo(ch.platform)"
- :alt="platformLabel(ch.platform)"
- />
- <t-icon v-else name="link" size="14px" />
- </span>
- <span class="channel-name" :title="channelDisplayName(ch)">
- {{ channelDisplayName(ch) }}
- </span>
- </div>
- <div class="channel-secondary">
- <span class="agent-avatar-sm">
- <span
- v-if="agentMeta(ch.agent_id)?.is_builtin"
- class="builtin-avatar"
- :class="agentMeta(ch.agent_id)?.config?.agent_mode === 'smart-reasoning' ? 'agent' : 'normal'"
- >
- <t-icon
- :name="agentMeta(ch.agent_id)?.config?.agent_mode === 'smart-reasoning' ? 'control-platform' : 'chat'"
- size="10px"
- />
- </span>
- <span
- v-else-if="agentMeta(ch.agent_id)?.avatar"
- class="builtin-avatar agent-emoji"
- >{{ agentMeta(ch.agent_id)!.avatar }}</span>
- <AgentAvatar
- v-else
- :name="agentDisplayName(ch)"
- size="small"
- />
- </span>
- <span class="agent-name" :title="agentDisplayName(ch)">
- {{ agentDisplayName(ch) }}
- </span>
- </div>
- </div>
-
- <div class="item-actions" @click.stop>
- <t-switch
- :value="ch.enabled"
- size="small"
- :loading="togglingId === ch.id"
- :disabled="!authStore.hasRole('admin')"
- @change="handleToggle(ch)"
- />
- </div>
- </div>
- </div>
- </div>
- </div>
-</template>
-
-<script setup lang="ts">
-import { ref, watch } from 'vue';
-import { useRouter } from 'vue-router';
-import { useI18n } from 'vue-i18n';
-import { MessagePlugin } from 'tdesign-vue-next';
-import { useAuthStore } from '@/stores/auth';
-import {
- listAllIMChannels,
- listAgents,
- toggleIMChannel,
- type IMChannelOverview,
- type CustomAgent,
-} from '@/api/agent';
-import AgentAvatar from '@/components/AgentAvatar.vue';
-
-import wecomLogo from '@/assets/img/im/wecom.svg';
-import feishuLogo from '@/assets/img/im/feishu.svg';
-import slackLogo from '@/assets/img/im/slack.svg';
-import telegramLogo from '@/assets/img/im/telegram.svg';
-import dingtalkLogo from '@/assets/img/im/dingtalk.svg';
-import mattermostLogo from '@/assets/img/im/mattermost.svg';
-import wechatLogo from '@/assets/img/im/wechat.svg';
-
-const PLATFORM_LOGO: Record<string, string> = {
- wecom: wecomLogo,
- feishu: feishuLogo,
- slack: slackLogo,
- telegram: telegramLogo,
- dingtalk: dingtalkLogo,
- mattermost: mattermostLogo,
- wechat: wechatLogo,
-};
-
-const props = defineProps<{
- active: boolean;
-}>();
-
-const emit = defineEmits<{
- (e: 'close'): void;
- (e: 'channels-changed', channels: IMChannelOverview[]): void;
-}>();
-
-const { t } = useI18n();
-const router = useRouter();
-const authStore = useAuthStore();
-
-const channels = ref<IMChannelOverview[]>([]);
-const agentMap = ref<Map<string, CustomAgent>>(new Map());
-const loading = ref(false);
-const togglingId = ref<string>('');
-
-watch(
- () => props.active,
- (v, old) => {
- if (v && !old) loadAll();
- },
- { immediate: true },
-);
-
-function hasPlatformLogo(p: string): boolean {
- return Boolean(PLATFORM_LOGO[p]);
-}
-
-function platformLogo(p: string): string {
- return PLATFORM_LOGO[p] || '';
-}
-
-function platformLabel(p: string): string {
- return t(`agentEditor.im.${p}`);
-}
-
-function channelDisplayName(ch: IMChannelOverview): string {
- return ch.name || platformLabel(ch.platform);
-}
-
-function agentMeta(agentId: string): CustomAgent | undefined {
- return agentMap.value.get(agentId);
-}
-
-function agentDisplayName(ch: IMChannelOverview): string {
- return ch.agent_name || agentMeta(ch.agent_id)?.name || t('imOverview.builtinAgent');
-}
-
-async function loadAll() {
- loading.value = true;
- try {
- const [chanResp, agentResp] = await Promise.all([
- listAllIMChannels(),
- listAgents(),
- ]);
- channels.value = chanResp?.data || [];
- const m = new Map<string, CustomAgent>();
- (agentResp?.data || []).forEach((a) => m.set(a.id, a));
- agentMap.value = m;
- emit('channels-changed', channels.value);
- } catch (err) {
- console.error('Failed to load IM overview:', err);
- MessagePlugin.error(t('imOverview.loadFailed'));
- } finally {
- loading.value = false;
- }
-}
-
-async function handleToggle(ch: IMChannelOverview) {
- if (togglingId.value === ch.id) return;
- togglingId.value = ch.id;
- const prev = ch.enabled;
- ch.enabled = !prev;
- try {
- await toggleIMChannel(ch.id);
- const resp = await listAllIMChannels();
- channels.value = resp?.data || [];
- emit('channels-changed', channels.value);
- } catch (err: any) {
- ch.enabled = prev;
- console.error('Failed to toggle IM channel:', err);
- MessagePlugin.error(err?.message || t('common.operationFailed'));
- } finally {
- if (togglingId.value === ch.id) togglingId.value = '';
- }
-}
-
-function gotoAgentEditor(ch: IMChannelOverview) {
- emit('close');
- router.push({
- path: '/platform/agents',
- query: { edit: ch.agent_id, section: 'im' },
- });
-}
-</script>
-
-<style lang="less" scoped>
-.im-submenu {
- display: flex;
- flex-direction: column;
- width: 300px;
- max-height: 520px;
- background: var(--td-bg-color-container);
- border-radius: 10px;
- box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
- border: 0.5px solid var(--td-component-stroke);
- overflow: hidden;
-}
-
-.submenu-header {
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- gap: 8px;
- padding: 10px 12px 8px;
- border-bottom: 0.5px solid var(--td-component-stroke);
-
- .titles {
- min-width: 0;
- }
-
- .title {
- margin: 0 0 4px;
- font-size: 12px;
- font-weight: 600;
- color: var(--td-text-color-secondary);
- line-height: 1.3;
- }
-
- .subtitle {
- margin: 0;
- font-size: 11px;
- color: var(--td-text-color-placeholder);
- line-height: 1.45;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- line-clamp: 2;
- overflow: hidden;
- }
-}
-
-.submenu-body {
- flex: 1;
- overflow-y: auto;
- padding: 4px;
-}
-
-.state-placeholder {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- gap: 10px;
- padding: 40px 0;
- color: var(--td-text-color-placeholder);
-
- .empty-text {
- font-size: 12px;
- }
-}
-
-.channels-list {
- display: flex;
- flex-direction: column;
-}
-
-.channel-item {
- display: flex;
- align-items: flex-start;
- gap: 8px;
- padding: 8px;
- border-radius: 6px;
- cursor: pointer;
- outline: none;
- transition: background 0.15s;
-
- & + & {
- border-top: 0.5px solid var(--td-component-stroke);
- }
-
- &:hover,
- &:focus-visible {
- background: var(--td-bg-color-secondarycontainer);
- }
-
- &.is-disabled .item-main {
- opacity: 0.6;
- }
-}
-
-.item-main {
- flex: 1;
- min-width: 0;
- display: flex;
- flex-direction: column;
- gap: 4px;
-}
-
-.channel-primary {
- display: flex;
- align-items: center;
- gap: 8px;
- min-width: 0;
-}
-
-.platform-avatar {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: 24px;
- height: 24px;
- border-radius: 6px;
- flex-shrink: 0;
- background: var(--td-bg-color-secondarycontainer);
-
- img {
- width: 18px;
- height: 18px;
- object-fit: contain;
- }
-
- .t-icon {
- color: var(--td-text-color-placeholder);
- }
-}
-
-.channel-name {
- font-size: 13px;
- font-weight: 500;
- color: var(--td-text-color-primary);
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- min-width: 0;
- line-height: 1.35;
-}
-
-.channel-secondary {
- display: flex;
- align-items: center;
- gap: 6px;
- min-width: 0;
- padding-left: 32px;
-}
-
-.agent-avatar-sm {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: 16px;
- height: 16px;
- flex-shrink: 0;
-
- :deep(.agent-avatar),
- :deep(.agent-avatar-small) {
- width: 16px;
- height: 16px;
- }
-
- :deep(.agent-avatar-letter) {
- font-size: 9px !important;
- }
-}
-
-.agent-name {
- font-size: 11px;
- color: var(--td-text-color-placeholder);
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- min-width: 0;
- line-height: 1.35;
-}
-
-.item-actions {
- flex-shrink: 0;
- display: inline-flex;
- align-items: center;
- padding-top: 2px;
-}
-
-.builtin-avatar {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 16px;
- height: 16px;
- border-radius: 4px;
- flex-shrink: 0;
-
- &.agent-emoji {
- font-size: 11px;
- line-height: 1;
- background: var(--td-bg-color-container-hover);
- }
-
- &.normal {
- background: linear-gradient(135deg, rgba(7, 192, 95, 0.15) 0%, rgba(7, 192, 95, 0.08) 100%);
- color: var(--td-brand-color-active);
- }
-
- &.agent {
- background: linear-gradient(135deg, rgba(124, 77, 255, 0.15) 0%, rgba(124, 77, 255, 0.08) 100%);
- color: var(--td-brand-color);
- }
-}
-</style>
diff --git a/frontend/src/components/SessionSourceFilter.vue b/frontend/src/components/SessionSourceFilter.vue
index 2f78843be..cc31b3b66 100644
--- a/frontend/src/components/SessionSourceFilter.vue
+++ b/frontend/src/components/SessionSourceFilter.vue
@@ -75,7 +75,7 @@ const currentOption = computed(() =>
const iconFor = (item: SourceItem | undefined): string => {
if (!item) return 'chat'
if (item.value === DEFAULT_SESSION_BUCKET_KEY) return 'chat'
- if (item.value.startsWith('embed:')) return 'internet'
+ if (item.value.startsWith('embed:')) return 'code'
return 'link'
}
diff --git a/frontend/src/components/UserMenu.vue b/frontend/src/components/UserMenu.vue
index 356e18486..12701be1f 100644
--- a/frontend/src/components/UserMenu.vue
+++ b/frontend/src/components/UserMenu.vue
@@ -103,16 +103,6 @@
<t-icon name="secured" class="menu-icon" />
<span>{{ $t('settings.apiInfo') }}</span>
</div>
- <div ref="imMenuItemRef" class="menu-item menu-item--submenu" :class="{ 'is-open': imSubmenuOpen }"
- @mouseenter="showIMSubmenu" @mouseleave="scheduleHideIMSubmenu">
- <t-icon name="link" class="menu-icon" />
- <span class="menu-item-label">{{ $t('imOverview.menuTitle') }}</span>
- <span v-if="hasActiveIMChannels" class="live-indicator" :title="$t('imOverview.liveIndicator')"
- aria-hidden="true">
- <span class="live-indicator-dot"></span>
- </span>
- <t-icon name="chevron-right" class="menu-chevron" />
- </div>
<div class="menu-divider"></div>
<div class="menu-item" @click="handleSettings">
<t-icon name="setting" class="menu-icon" />
@@ -173,16 +163,6 @@
</div>
</Transition>
- <!-- IM submenu is teleported to body because the sidebar (.aside_box) has
- overflow:hidden, which would otherwise clip any absolutely-positioned
- child that reaches past its bounds. -->
- <Teleport to="body">
- <div v-if="imSubmenuOpen" class="im-submenu-floating" :style="imSubmenuStyle" @mouseenter="showIMSubmenu"
- @mouseleave="scheduleHideIMSubmenu">
- <IMChannelsOverviewPanel :active="imSubmenuOpen" @close="closeAll" @channels-changed="onChannelsChanged" />
- </div>
- </Teleport>
-
<!-- Tenant switcher floating panel — shares the same teleport rationale
as the IM submenu. Data comes from authStore.memberships, kept fresh via
GET /auth/me when the submenu opens (throttled) and after invite/create. -->
@@ -251,9 +231,7 @@ import { useAuthStore } from '@/stores/auth'
import { MessagePlugin } from 'tdesign-vue-next'
import { getCurrentUser, logout as logoutApi, userInfoFromApi } from '@/api/auth'
import { useI18n } from 'vue-i18n'
-import IMChannelsOverviewPanel from '@/components/IMChannelsOverviewPanel.vue'
import CreateTenantDialog from '@/components/CreateTenantDialog.vue'
-import { listAllIMChannels, type IMChannelOverview } from '@/api/agent'
import {
navigateAfterTenantSwitch,
persistLastActiveTenantPreference,
@@ -309,15 +287,10 @@ const canSeeQuickNav = (key: string): boolean => {
}
const menuRef = ref<HTMLElement>()
-const imMenuItemRef = ref<HTMLElement>()
const tenantMenuItemRef = ref<HTMLElement>()
const menuVisible = ref(false)
-const imSubmenuOpen = ref(false)
-const imSubmenuStyle = ref<Record<string, string>>({})
const tenantSubmenuOpen = ref(false)
const tenantSubmenuStyle = ref<Record<string, string>>({})
-const hasActiveIMChannels = ref(false)
-let imSubmenuHideTimer: ReturnType<typeof setTimeout> | null = null
let tenantSubmenuHideTimer: ReturnType<typeof setTimeout> | null = null
// 用户信息
@@ -375,28 +348,7 @@ const handleSystemAdmin = () => {
// Hover-driven submenu controls. A small hide delay tolerates the pointer
// slipping off briefly onto the gap between menu item and submenu pane.
-const showIMSubmenu = () => {
- if (imSubmenuHideTimer) {
- clearTimeout(imSubmenuHideTimer)
- imSubmenuHideTimer = null
- }
- // Compute panel position based on the menu item's rect — the panel is
- // teleported to body so we can't rely on CSS `left: 100%`.
- positionIMSubmenu()
- imSubmenuOpen.value = true
- clampFloatingToViewport('.im-submenu-floating', imSubmenuStyle)
-}
-
-const scheduleHideIMSubmenu = () => {
- if (imSubmenuHideTimer) clearTimeout(imSubmenuHideTimer)
- imSubmenuHideTimer = setTimeout(() => {
- imSubmenuOpen.value = false
- imSubmenuHideTimer = null
- }, 180)
-}
-
const closeAll = () => {
- imSubmenuOpen.value = false
tenantSubmenuOpen.value = false
menuVisible.value = false
}
@@ -423,7 +375,7 @@ const onTenantCreated = async (newTenant: TenantInfo) => {
// ---------- Tenant switcher submenu ----------
//
-// Same hover-driven submenu pattern as the IM panel above; data comes from
+// Same hover-driven submenu pattern; data comes from
// authStore.memberships (refreshed from /auth/me when the submenu opens and
// after membership-changing actions). PR 4 of #1303 relaxed the X-Tenant-ID
// gate in middleware/auth.go to accept active membership rows, so flipping
@@ -550,58 +502,8 @@ const positionTenantSubmenu = () => {
}
}
-// Silent prefetch so the "live" indicator on the IM menu item reflects reality
-// as soon as the user sees the avatar area. Errors are swallowed — the
-// indicator just stays off if the request fails, which is the conservative
-// default. The panel component emits channels-changed after toggle/refresh so
-// we stay in sync without re-polling.
-const refreshIMStatus = async () => {
- try {
- const resp = await listAllIMChannels()
- const data: IMChannelOverview[] = resp?.data || []
- hasActiveIMChannels.value = data.some((c) => c.enabled)
- } catch {
- // Intentionally ignored — indicator just stays off.
- }
-}
-
-const onChannelsChanged = (channels: IMChannelOverview[]) => {
- hasActiveIMChannels.value = channels.some((c) => c.enabled)
-}
-
// Anchor the floating submenu just to the right of the hovered menu item,
// clamped to the viewport so it stays visible near the screen edge.
-const positionIMSubmenu = () => {
- const el = imMenuItemRef.value
- if (!el) return
- // Same rationale as `positionTenantSubmenu` — convert visual-pixel rect to
- // CSS pixels before feeding the fixed submenu's CSS lengths.
- const zoom = getRootZoom()
- const rect = rectToCssPx(el.getBoundingClientRect(), zoom)
- const { width: vw } = cssViewportSize(zoom)
- const PANEL_WIDTH = 300
- const GAP = 8
- const MARGIN = 8
-
- let left = rect.right + GAP
- // If the panel would overflow the right edge, flip to the left side.
- if (left + PANEL_WIDTH + MARGIN > vw) {
- left = Math.max(MARGIN, rect.left - PANEL_WIDTH - GAP)
- }
-
- // Align with the menu item's top; bottom-clamping is done after render
- // when we know the panel's actual height (see clampSubmenuToViewport).
- // 之前用 PANEL_MAX_HEIGHT=520 提前 clamp 会把实际只有 ~140px 的面板
- // 顶到屏幕中上方,与菜单项错开很多。
- const top = Math.max(MARGIN, rect.top)
-
- imSubmenuStyle.value = {
- left: `${left}px`,
- top: `${top}px`,
- }
-}
-
-// 在面板真正渲染后,按它的实际高度做底部 clamp,避免面板跑出屏幕外。
const clampFloatingToViewport = (selector: string, target: { value: Record<string, string> }) => {
requestAnimationFrame(() => {
const panel = document.querySelector(selector) as HTMLElement | null
@@ -712,22 +614,16 @@ const loadUserInfo = async () => {
const handleClickOutside = (e: MouseEvent) => {
const target = e.target as Node
if (menuRef.value && menuRef.value.contains(target)) return
- // The IM and tenant submenus are teleported to body, so they're not inside
- // menuRef — check them separately to avoid closing the dropdown when the
- // user clicks one of the floating panels.
- const imFloating = document.querySelector('.im-submenu-floating')
- if (imFloating && imFloating.contains(target)) return
+ // Tenant submenu is teleported to body, so it's not inside menuRef.
const tenantFloating = document.querySelector('.tenant-submenu-floating')
if (tenantFloating && tenantFloating.contains(target)) return
menuVisible.value = false
- imSubmenuOpen.value = false
tenantSubmenuOpen.value = false
}
onMounted(() => {
document.addEventListener('click', handleClickOutside)
loadUserInfo()
- refreshIMStatus()
})
onUnmounted(() => {
@@ -1103,45 +999,6 @@ onUnmounted(() => {
color: var(--td-text-color-secondary);
}
}
-
- // "Live" indicator — shown when at least one IM channel is enabled.
- // A small green dot with a halo that pulses to signal active connections.
- .live-indicator {
- position: relative;
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: 10px;
- height: 10px;
- margin-right: 2px;
- flex-shrink: 0;
- }
-
- .live-indicator-dot {
- position: relative;
- width: 6px;
- height: 6px;
- border-radius: 50%;
- background: var(--td-success-color, #07c160);
-
- // Pulsing halo around the dot. Prefers-reduced-motion disables it.
- &::after {
- content: '';
- position: absolute;
- inset: -3px;
- border-radius: 50%;
- background: var(--td-success-color, #07c160);
- opacity: 0.45;
- animation: im-live-pulse 1.6s ease-out infinite;
- pointer-events: none;
- }
- }
-
- @media (prefers-reduced-motion: reduce) {
- .live-indicator-dot::after {
- animation: none;
- }
- }
}
.menu-icon {
@@ -1246,39 +1103,10 @@ onUnmounted(() => {
transform: translateY(0);
}
-// Live indicator halo animation — a soft expanding ring to signal that at
-// least one IM channel is actively connected.
-@keyframes im-live-pulse {
- 0% {
- transform: scale(0.9);
- opacity: 0.45;
- }
-
- 70% {
- transform: scale(1.8);
- opacity: 0;
- }
-
- 100% {
- transform: scale(1.8);
- opacity: 0;
- }
-}
</style>
<style lang="less">
-// Non-scoped: the IM submenu is teleported to <body> so scoped styles
-// from this component won't reach it. The panel component's own CSS is
-// scoped and self-contained; this rule only positions the wrapper.
-.im-submenu-floating {
- position: fixed;
- z-index: 1100;
- // Invisible padding forms a pointer bridge from the menu item to the
- // panel so hovering across the gap doesn't fire mouseleave-hide.
- padding-left: 2px;
-}
-
-// Tenant switcher submenu — same teleport rationale as .im-submenu-floating.
+// Tenant switcher submenu — teleported to <body>.
// All styling for the panel itself lives here (not in a child component) so
// the markup in UserMenu.vue stays self-contained.
.tenant-submenu-floating {
diff --git a/frontend/src/components/menu.vue b/frontend/src/components/menu.vue
index a6a4a11fa..74c59b096 100644
--- a/frontend/src/components/menu.vue
+++ b/frontend/src/components/menu.vue
@@ -85,7 +85,7 @@
<div class="menu_item-box">
<div class="menu_icon">
<img class="icon"
- :src="getImgSrc(item.icon == 'zhishiku' ? knowledgeIcon : item.icon == 'agent' ? agentIcon : item.icon == 'organization' ? organizationIcon : item.icon == 'logout' ? logoutIcon : item.icon == 'setting' ? settingIcon : prefixIcon)"
+ :src="getImgSrc(item.icon == 'zhishiku' ? knowledgeIcon : item.icon == 'agent' ? agentIcon : item.icon == 'integration' ? integrationIcon : item.icon == 'organization' ? organizationIcon : item.icon == 'logout' ? logoutIcon : item.icon == 'setting' ? settingIcon : prefixIcon)"
alt="">
</div>
<template v-if="!uiStore.sidebarCollapsed">
@@ -392,6 +392,8 @@ const isMenuItemActive = (itemPath: string): boolean => {
currentRoute === 'knowledgeBaseSettings';
case 'agents':
return currentRoute === 'agentList';
+ case 'integrations':
+ return currentRoute === 'integrations';
case 'organizations':
return currentRoute === 'organizationList';
case 'creatChat':
@@ -422,13 +424,13 @@ const getIconActiveState = (itemPath: string) => {
// 分离上下两部分菜单(使用 visibleMenuArr 以便 lite 模式过滤 logout)
const topMenuItems = computed<MenuItem[]>(() => {
return (visibleMenuArr.value as unknown as MenuItem[]).filter((item: MenuItem) =>
- item.path === 'knowledge-bases' || item.path === 'agents' || item.path === 'organizations' || item.path === 'creatChat'
+ item.path === 'knowledge-bases' || item.path === 'agents' || item.path === 'integrations' || item.path === 'organizations' || item.path === 'creatChat'
);
});
const bottomMenuItems = computed<MenuItem[]>(() => {
return (visibleMenuArr.value as unknown as MenuItem[]).filter((item: MenuItem) => {
- if (item.path === 'knowledge-bases' || item.path === 'agents' || item.path === 'organizations' || item.path === 'creatChat') {
+ if (item.path === 'knowledge-bases' || item.path === 'agents' || item.path === 'integrations' || item.path === 'organizations' || item.path === 'creatChat') {
return false;
}
return true;
@@ -1009,6 +1011,7 @@ let prefixIcon = ref('prefixIcon.svg');
let logoutIcon = ref('logout.svg');
let settingIcon = ref('setting.svg');
let agentIcon = ref('agent.svg');
+let integrationIcon = ref('integration.svg');
let organizationIcon = ref('organization.svg');
let pathPrefix = ref(route.name)
const getIcon = (path: string) => {
@@ -1017,6 +1020,7 @@ const getIcon = (path: string) => {
const creatChatActiveState = getIconActiveState('creatChat');
const settingsActiveState = getIconActiveState('settings');
const agentsActiveState = route.name === 'agentList';
+ const integrationsActiveState = route.name === 'integrations';
const organizationsActiveState = route.name === 'organizationList';
// 知识库图标:只在知识库页面显示绿色
@@ -1025,6 +1029,8 @@ const getIcon = (path: string) => {
// 智能体图标:只在智能体页面显示绿色
agentIcon.value = agentsActiveState ? 'agent-green.svg' : 'agent.svg';
+ integrationIcon.value = integrationsActiveState ? 'integration-green.svg' : 'integration.svg';
+
// 组织图标:只在组织页面显示绿色
organizationIcon.value = organizationsActiveState ? 'organization-green.svg' : 'organization.svg';
@@ -1049,6 +1055,8 @@ const handleMenuClick = async (path: string) => {
}
} else if (path === 'agents') {
router.push('/platform/agents')
+ } else if (path === 'integrations') {
+ router.push('/platform/integrations')
} else if (path === 'organizations') {
// 组织菜单项:跳转到组织列表
router.push('/platform/organizations')
diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts
index a32a4f9e0..80351ea68 100755
--- a/frontend/src/i18n/locales/en-US.ts
+++ b/frontend/src/i18n/locales/en-US.ts
@@ -2,6 +2,7 @@ export default {
menu: {
knowledgeBase: 'Knowledge Base',
agents: 'Agents',
+ integrations: 'Publish & Integrations',
organizations: 'Shared Spaces',
chat: 'Chat',
newChat: 'New Chat',
@@ -5059,7 +5060,7 @@ export default {
basic: 'Basics',
knowledge: 'Knowledge & Retrieval',
capability: 'Extensions',
- integration: 'Publish & Integrate',
+ integration: 'Publish & Integrations',
},
placeholders: {
available: 'Available variables: ',
@@ -5220,6 +5221,7 @@ export default {
deleteConfirm: 'Are you sure you want to delete this channel? This action cannot be undone.',
channelName: 'Channel Name',
channelNamePlaceholder: 'Enter a name for easy identification',
+ channelNameDefaultHint: 'Defaults to the platform name; you can customize it, or leave blank to use the platform name on save',
platform: 'Platform',
mode: 'Connection Mode',
outputMode: 'Output Mode',
@@ -5259,6 +5261,21 @@ export default {
wechatHint: 'Requires iOS WeChat 8.0.70+, direct messages only',
wechatQRExpired: 'QR code expired, please try again',
wechatBinding: 'Binding...',
+ sectionChannel: 'Channel info',
+ sectionConnection: 'Connection',
+ sectionCredentials: 'Platform credentials',
+ selectPlatform: 'Select platform',
+ selectPlatformDesc: 'Choose the messaging platform to connect',
+ enabled: 'Enable channel',
+ stepBasic: 'Basic info',
+ stepConnection: 'Connection',
+ stepKnowledge: 'File storage',
+ stepCredentials: 'Credentials',
+ sectionAccess: 'Access & output',
+ sectionSession: 'Session',
+ sectionCallback: 'Callback URL',
+ sectionKnowledge: 'File storage',
+ sectionStatus: 'Status',
},
agentType: {
label: 'Agent Type',
@@ -5574,6 +5591,37 @@ export default {
syncResultDeleted: '-{n}',
moreActions: 'More',
},
+ integrations: {
+ title: 'Publish & Integrations',
+ subtitle: 'Publish agents to IM platforms and websites',
+ tabs: {
+ im: 'IM Integration',
+ embed: 'Web Embed',
+ },
+ manageSectionTitle: 'Channel configuration',
+ manageSectionDesc: 'Select an agent to create or edit integration channels for that agent',
+ selectAgent: 'Select agent',
+ selectAgentDesc: 'Each integration channel is bound to one agent. Choose the agent to configure.',
+ selectAgentPlaceholder: 'Choose an agent',
+ selectAgentHint: 'Please select an agent first',
+ manageChannel: 'Manage channel',
+ goToCenter: 'Open Integrations',
+ imOverview: {
+ title: 'Connected IM channels',
+ subtitle: 'All IM channels across agents in this workspace. Toggle quickly or configure details below.',
+ },
+ embedOverview: {
+ title: 'Web embed channels',
+ subtitle: 'All web embed channels across agents in this workspace. Toggle quickly or configure details below.',
+ empty: 'No web embed channels configured yet',
+ loadFailed: 'Failed to load web embed channels',
+ },
+ agentEditor: {
+ label: 'Publish channels',
+ desc: 'Publish this agent to IM platforms or websites. Manage in Integrations.',
+ manage: 'Manage',
+ },
+ },
imOverview: {
menuTitle: 'Connected IMs',
pageTitle: 'Connected IMs',
diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts
index 0dcea4527..3366d4f0a 100755
--- a/frontend/src/i18n/locales/ko-KR.ts
+++ b/frontend/src/i18n/locales/ko-KR.ts
@@ -2,6 +2,7 @@ export default {
menu: {
knowledgeBase: "지식베이스",
agents: "에이전트",
+ integrations: "게시 및 통합",
organizations: "공유 스페이스",
chat: "대화",
newChat: "새 대화",
@@ -5161,6 +5162,7 @@ export default {
deleteConfirm: "이 채널을 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다.",
channelName: "채널 이름",
channelNamePlaceholder: "식별하기 쉬운 이름을 입력하세요",
+ channelNameDefaultHint: "기본값은 플랫폼 이름이며, 직접 수정할 수 있습니다. 비워 두면 저장 시 플랫폼 이름이 사용됩니다",
platform: "플랫폼",
mode: "연결 모드",
outputMode: "출력 모드",
@@ -5200,6 +5202,21 @@ export default {
wechatHint: "iOS WeChat 8.0.70+ 버전이 필요하며, 1:1 채팅 메시지만 지원됩니다",
wechatQRExpired: "QR 코드가 만료되었습니다. 다시 가져오세요",
wechatBinding: "연결 중...",
+ sectionChannel: "채널 정보",
+ sectionConnection: "연결 설정",
+ sectionCredentials: "플랫폼 자격 증명",
+ selectPlatform: "플랫폼 선택",
+ selectPlatformDesc: "연결할 메시징 플랫폼을 선택하세요",
+ enabled: "채널 활성화",
+ stepBasic: "기본 정보",
+ stepConnection: "연결 설정",
+ stepKnowledge: "파일 저장",
+ stepCredentials: "플랫폼 자격 증명",
+ sectionAccess: "접속 및 출력",
+ sectionSession: "세션 설정",
+ sectionCallback: "콜백 URL",
+ sectionKnowledge: "파일 저장",
+ sectionStatus: "실행 상태",
},
tools: {
thinking: '사고',
@@ -5585,6 +5602,37 @@ export default {
syncResultUpdated: "~{n}",
syncResultDeleted: "-{n}",
},
+ integrations: {
+ title: "게시 및 통합",
+ subtitle: "에이전트를 IM 플랫폼과 웹사이트에 게시",
+ tabs: {
+ im: "IM 통합",
+ embed: "웹 임베드",
+ },
+ manageSectionTitle: "채널 구성",
+ manageSectionDesc: "에이전트를 선택한 후 해당 에이전트의 통합 채널을 생성하거나 편집할 수 있습니다",
+ selectAgent: "에이전트 선택",
+ selectAgentDesc: "각 통합 채널은 하나의 에이전트에 연결됩니다. 구성할 에이전트를 선택하세요",
+ selectAgentPlaceholder: "에이전트를 선택하세요",
+ selectAgentHint: "먼저 에이전트를 선택하세요",
+ manageChannel: "채널 관리",
+ goToCenter: "통합 센터로 이동",
+ imOverview: {
+ title: "연결된 IM",
+ subtitle: "현재 워크스페이스의 모든 IM 채널입니다. 빠르게 켜고 끄거나 아래에서 상세 구성할 수 있습니다",
+ },
+ embedOverview: {
+ title: "웹 임베드 채널",
+ subtitle: "현재 워크스페이스의 모든 웹 임베드 채널입니다. 빠르게 켜고 끄거나 아래에서 상세 구성할 수 있습니다",
+ empty: "아직 웹 임베드 채널이 없습니다",
+ loadFailed: "웹 임베드 채널을 불러오지 못했습니다",
+ },
+ agentEditor: {
+ label: "게시 채널",
+ desc: "IM 플랫폼 또는 웹사이트에 에이전트를 게시합니다. 통합 센터에서 관리하세요.",
+ manage: "관리",
+ },
+ },
imOverview: {
menuTitle: "연결된 IM",
pageTitle: "연결된 IM",
diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts
index bceddd5ad..c6d3f4456 100755
--- a/frontend/src/i18n/locales/ru-RU.ts
+++ b/frontend/src/i18n/locales/ru-RU.ts
@@ -37,6 +37,7 @@ export default {
noSessions: 'Пока нет диалогов',
loadMoreSessions: 'Загрузить ещё',
agents: 'Агенты',
+ integrations: 'Публикация и интеграция',
organizations: 'Общие пространства'
},
newUserGuide: {
@@ -4731,6 +4732,7 @@ export default {
deleteConfirm: 'Вы уверены, что хотите удалить этот канал? Это действие не может быть отменено.',
channelName: 'Имя канала',
channelNamePlaceholder: 'Введите имя для легкой идентификации',
+ channelNameDefaultHint: 'По умолчанию используется название платформы; можно изменить. Если оставить пустым, при сохранении подставится название платформы',
platform: 'Платформа',
mode: 'Режим подключения',
outputMode: 'Режим вывода',
@@ -4770,6 +4772,21 @@ export default {
wechatHint: 'Требуется iOS WeChat 8.0.70+, поддерживаются только сообщения 1:1',
wechatQRExpired: 'Срок действия QR-кода истёк, получите новый',
wechatBinding: 'Привязка...',
+ sectionChannel: 'Информация о канале',
+ sectionConnection: 'Подключение',
+ sectionCredentials: 'Учётные данные платформы',
+ selectPlatform: 'Выберите платформу',
+ selectPlatformDesc: 'Выберите платформу обмена сообщениями для подключения',
+ enabled: 'Включить канал',
+ stepBasic: 'Основное',
+ stepConnection: 'Подключение',
+ stepKnowledge: 'Хранение файлов',
+ stepCredentials: 'Учётные данные',
+ sectionAccess: 'Доступ и вывод',
+ sectionSession: 'Сессии',
+ sectionCallback: 'URL обратного вызова',
+ sectionKnowledge: 'Хранение файлов',
+ sectionStatus: 'Статус',
},
agentType: {
label: 'Тип агента',
@@ -5407,6 +5424,37 @@ export default {
syncResultUpdated: '~{n}',
syncResultDeleted: '-{n}',
},
+ integrations: {
+ title: 'Публикация и интеграция',
+ subtitle: 'Публикуйте агентов на IM-платформах и сайтах',
+ tabs: {
+ im: 'IM-интеграция',
+ embed: 'Веб-встраивание',
+ },
+ manageSectionTitle: 'Настройка каналов',
+ manageSectionDesc: 'Выберите агента, чтобы создать или изменить каналы интеграции для него',
+ selectAgent: 'Выберите агента',
+ selectAgentDesc: 'Каждый канал интеграции привязан к одному агенту. Выберите агента для настройки.',
+ selectAgentPlaceholder: 'Выберите агента',
+ selectAgentHint: 'Сначала выберите агента',
+ manageChannel: 'Управлять каналом',
+ goToCenter: 'Открыть интеграции',
+ imOverview: {
+ title: 'Подключённые IM-каналы',
+ subtitle: 'Все IM-каналы агентов в этом пространстве. Быстро включайте/выключайте или настраивайте ниже.',
+ },
+ embedOverview: {
+ title: 'Каналы веб-встраивания',
+ subtitle: 'Все каналы веб-встраивания агентов в этом пространстве. Быстро включайте/выключайте или настраивайте ниже.',
+ empty: 'Каналы веб-встраивания ещё не настроены',
+ loadFailed: 'Не удалось загрузить каналы веб-встраивания',
+ },
+ agentEditor: {
+ label: 'Каналы публикации',
+ desc: 'Публикуйте агента в IM или на сайт. Управление — в разделе «Интеграции».',
+ manage: 'Управлять',
+ },
+ },
imOverview: {
menuTitle: 'Подключённые IM',
pageTitle: 'Подключённые IM',
diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts
index 25799d093..03ebc660c 100755
--- a/frontend/src/i18n/locales/zh-CN.ts
+++ b/frontend/src/i18n/locales/zh-CN.ts
@@ -2,6 +2,7 @@ export default {
menu: {
knowledgeBase: "知识库",
agents: "智能体",
+ integrations: "发布集成",
organizations: "共享空间",
chat: "对话",
newChat: "新对话",
@@ -5168,6 +5169,7 @@ export default {
deleteConfirm: "确定删除该渠道?删除后无法恢复。",
channelName: "渠道名称",
channelNamePlaceholder: "输入渠道名称,方便辨识",
+ channelNameDefaultHint: "默认为平台名称,可自行修改;留空保存时也会使用平台名称",
platform: "平台",
mode: "接入模式",
outputMode: "输出模式",
@@ -5207,6 +5209,21 @@ export default {
wechatHint: "需要 iOS 微信 8.0.70+ 版本,仅支持单聊消息",
wechatQRExpired: "二维码已过期,请重新获取",
wechatBinding: "绑定中...",
+ sectionChannel: "渠道信息",
+ sectionConnection: "连接设置",
+ sectionCredentials: "平台凭证",
+ selectPlatform: "选择平台",
+ selectPlatformDesc: "选择要接入的即时通讯平台",
+ enabled: "启用渠道",
+ stepBasic: "基本信息",
+ stepConnection: "连接设置",
+ stepKnowledge: "文件存储",
+ stepCredentials: "平台凭证",
+ sectionAccess: "接入与输出",
+ sectionSession: "会话设置",
+ sectionCallback: "回调地址",
+ sectionKnowledge: "文件存储",
+ sectionStatus: "运行状态",
},
tools: {
thinking: "思考",
@@ -5592,6 +5609,37 @@ export default {
syncResultDeleted: "-{n}",
moreActions: "更多",
},
+ integrations: {
+ title: "发布集成",
+ subtitle: "将智能体发布到 IM 平台与网站",
+ tabs: {
+ im: "IM 集成",
+ embed: "网页嵌入",
+ },
+ manageSectionTitle: "渠道配置",
+ manageSectionDesc: "选择智能体后,可创建或编辑该智能体下的集成渠道",
+ selectAgent: "选择智能体",
+ selectAgentDesc: "每个集成渠道绑定一个智能体,请先选择要配置的智能体",
+ selectAgentPlaceholder: "请选择智能体",
+ selectAgentHint: "请先选择一个智能体",
+ manageChannel: "管理渠道",
+ goToCenter: "前往集成中心",
+ imOverview: {
+ title: "已接入的 IM",
+ subtitle: "当前空间下所有智能体已接入的 IM 渠道,可快速启停或选择下方进行详细配置",
+ },
+ embedOverview: {
+ title: "网页嵌入渠道",
+ subtitle: "当前空间下所有智能体的网页嵌入渠道,可快速启停或选择下方进行详细配置",
+ empty: "当前空间还没有配置网页嵌入渠道",
+ loadFailed: "加载网页嵌入渠道失败",
+ },
+ agentEditor: {
+ label: "发布渠道",
+ desc: "将智能体发布到 IM 平台或网站,在集成中心统一管理",
+ manage: "管理",
+ },
+ },
imOverview: {
menuTitle: "已接入的 IM",
pageTitle: "已接入的 IM",
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts
index 2983819f6..598afc0b7 100644
--- a/frontend/src/router/index.ts
+++ b/frontend/src/router/index.ts
@@ -128,6 +128,12 @@ const router = createRouter({
component: () => import("../views/agent/AgentList.vue"),
meta: { requiresInit: true, requiresAuth: true }
},
+ {
+ path: "integrations",
+ name: "integrations",
+ component: () => import("../views/platform/RoutePlaceholder.vue"),
+ meta: { requiresInit: true, requiresAuth: true }
+ },
{
path: "creatChat",
name: "globalCreatChat",
diff --git a/frontend/src/stores/menu.ts b/frontend/src/stores/menu.ts
index 960dfe91d..25765f654 100644
--- a/frontend/src/stores/menu.ts
+++ b/frontend/src/stores/menu.ts
@@ -28,6 +28,7 @@ export const useMenuStore = defineStore('menuStore', () => {
},
{ title: '', titleKey: 'menu.knowledgeBase', icon: 'zhishiku', path: 'knowledge-bases' },
{ title: '', titleKey: 'menu.agents', icon: 'agent', path: 'agents' },
+ { title: '', titleKey: 'menu.integrations', icon: 'integration', path: 'integrations' },
{ title: '', titleKey: 'menu.organizations', icon: 'organization', path: 'organizations' },
{ title: '', titleKey: 'menu.settings', icon: 'setting', path: 'settings' },
{ title: '', titleKey: 'menu.logout', icon: 'logout', path: 'logout' }
diff --git a/frontend/src/views/agent/AgentEditorModal.vue b/frontend/src/views/agent/AgentEditorModal.vue
index df0898640..beee701fb 100644
--- a/frontend/src/views/agent/AgentEditorModal.vue
+++ b/frontend/src/views/agent/AgentEditorModal.vue
@@ -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;
diff --git a/frontend/src/views/agent/AgentList.vue b/frontend/src/views/agent/AgentList.vue
index 2c721a65d..4312d1328 100644
--- a/frontend/src/views/agent/AgentList.vue
+++ b/frontend/src/views/agent/AgentList.vue
@@ -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) {
diff --git a/frontend/src/views/integrations/IntegrationsModal.vue b/frontend/src/views/integrations/IntegrationsModal.vue
new file mode 100644
index 000000000..7128dbc4f
--- /dev/null
+++ b/frontend/src/views/integrations/IntegrationsModal.vue
@@ -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>
diff --git a/frontend/src/views/platform/RoutePlaceholder.vue b/frontend/src/views/platform/RoutePlaceholder.vue
new file mode 100644
index 000000000..fb1355c85
--- /dev/null
+++ b/frontend/src/views/platform/RoutePlaceholder.vue
@@ -0,0 +1,7 @@
+<template><div class="route-placeholder" aria-hidden="true" /></template>
+
+<style scoped>
+.route-placeholder {
+ display: none;
+}
+</style>
diff --git a/frontend/src/views/platform/index.vue b/frontend/src/views/platform/index.vue
index 630b1a4a2..3e95d8fa5 100644
--- a/frontend/src/views/platform/index.vue
+++ b/frontend/src/views/platform/index.vue
@@ -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'