feat(IM): support both websocket/webhook mode im channel for slack

Signed-off-by: joeyczheng <joeyczheng@tencent.com>
This commit is contained in:
joeyczheng
2026-03-18 17:25:06 +08:00
committed by lyingbug
parent 5c6b710bae
commit 49b5f1a739
13 changed files with 592 additions and 15 deletions
+1 -1
View File
@@ -182,7 +182,7 @@ export interface IMChannel {
id: string;
tenant_id?: number;
agent_id: string;
platform: 'wecom' | 'feishu';
platform: 'wecom' | 'feishu' | 'slack';
name: string;
enabled: boolean;
mode: 'webhook' | 'websocket';
+40 -6
View File
@@ -23,7 +23,7 @@
<div class="channel-info-top">
<div class="channel-main">
<span class="platform-badge" :class="channel.platform">
{{ channel.platform === 'wecom' ? $t('agentEditor.im.wecom') : $t('agentEditor.im.feishu') }}
{{ channel.platform === 'wecom' ? $t('agentEditor.im.wecom') : channel.platform === 'feishu' ? $t('agentEditor.im.feishu') : $t('agentEditor.im.slack') }}
</span>
<span class="channel-name">{{ channel.name || $t('agentEditor.im.unnamed') }}</span>
</div>
@@ -88,6 +88,7 @@
<t-radio-group v-model="formData.platform" :disabled="!!editingChannel">
<t-radio-button value="wecom">{{ $t('agentEditor.im.wecom') }}</t-radio-button>
<t-radio-button value="feishu">{{ $t('agentEditor.im.feishu') }}</t-radio-button>
<t-radio-button value="slack">{{ $t('agentEditor.im.slack') }}</t-radio-button>
</t-radio-group>
</div>
@@ -204,6 +205,37 @@
</div>
</template>
</template>
<!-- Slack credentials -->
<template v-if="formData.platform === 'slack'">
<div class="platform-link-hint">
<t-icon name="jump" class="hint-link-icon" />
<a href="https://api.slack.com/apps" target="_blank" rel="noopener noreferrer" class="hint-link">
{{ $t('agentEditor.im.slackConsole') }}
</a>
<span class="hint-text">{{ $t('agentEditor.im.consoleTip') }}</span>
</div>
<template v-if="formData.mode === 'websocket'">
<div class="form-item">
<label class="form-label">App Token</label>
<t-input v-model="formData.credentials.app_token" type="password" placeholder="xapp-..." />
</div>
<div class="form-item">
<label class="form-label">Bot Token</label>
<t-input v-model="formData.credentials.bot_token" type="password" placeholder="xoxb-..." />
</div>
</template>
<template v-else>
<div class="form-item">
<label class="form-label">Bot Token</label>
<t-input v-model="formData.credentials.bot_token" type="password" placeholder="xoxb-..." />
</div>
<div class="form-item">
<label class="form-label">Signing Secret</label>
<t-input v-model="formData.credentials.signing_secret" type="password" placeholder="Signing Secret" />
</div>
</template>
</template>
</div>
</t-dialog>
</div>
@@ -234,7 +266,7 @@ const knowledgeBases = ref<{ id: string; name: string }[]>([]);
const defaultCredentials = (): Record<string, any> => ({});
const formData = ref({
platform: 'wecom' as 'wecom' | 'feishu',
platform: 'wecom' as 'wecom' | 'feishu' | 'slack',
name: '',
mode: 'websocket' as 'webhook' | 'websocket',
output_mode: 'stream' as 'stream' | 'full',
@@ -420,7 +452,6 @@ onMounted(() => {
overflow-y: auto;
}
// --- Channel card (matches share-item pattern) ---
.channel-item {
display: flex;
justify-content: space-between;
@@ -474,6 +505,11 @@ onMounted(() => {
background: rgba(51, 112, 255, 0.08);
color: #3370ff;
}
&.slack {
background: rgba(224, 30, 90, 0.08);
color: #e01e5a;
}
}
.channel-name {
@@ -537,7 +573,6 @@ onMounted(() => {
flex-shrink: 0;
}
// --- Add button ---
.add-btn {
margin-top: 4px;
@@ -548,7 +583,6 @@ onMounted(() => {
}
}
// --- Dialog form (matches share form pattern) ---
.dialog-form {
display: flex;
flex-direction: column;
@@ -607,4 +641,4 @@ onMounted(() => {
color: var(--td-text-color-placeholder);
}
}
</style>
</style>
+3 -1
View File
@@ -3174,9 +3174,10 @@ export default {
},
im: {
title: 'IM Integration',
description: 'Connect agent to instant messaging platforms like WeCom and Feishu',
description: 'Connect agent to instant messaging platforms like WeCom, Feishu and Slack',
wecom: 'WeCom',
feishu: 'Feishu',
slack: 'Slack',
addChannel: 'Add Channel',
editChannel: 'Edit Channel',
deleteConfirm: 'Are you sure you want to delete this channel? This action cannot be undone.',
@@ -3193,6 +3194,7 @@ export default {
docLink: 'Integration Guide',
wecomConsole: 'WeCom Admin',
feishuConsole: 'Feishu Open Platform',
slackConsole: 'Slack API Console',
modeHint: 'WebSocket is recommended for easier setup',
consoleTip: 'to get credentials',
fileKnowledgeBase: 'File Storage Knowledge Base',
+3 -1
View File
@@ -3204,9 +3204,10 @@ export default {
},
im: {
title: "IM 통합",
description: "에이전트를 WeCom, Feishu 등 인스턴트 메시징 플랫폼에 연결",
description: "에이전트를 WeCom, Feishu, Slack 등 인스턴트 메시징 플랫폼에 연결",
wecom: "WeCom",
feishu: "Feishu",
slack: "Slack",
addChannel: "채널 추가",
editChannel: "채널 편집",
deleteConfirm: "이 채널을 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다.",
@@ -3223,6 +3224,7 @@ export default {
docLink: "통합 가이드 보기",
wecomConsole: "WeCom 관리 콘솔",
feishuConsole: "Feishu 개발 플랫폼",
slackConsole: "Slack API 콘솔",
modeHint: "WebSocket 방식이 설정이 더 간편하여 권장됩니다",
consoleTip: "자격 증명 정보를 가져오세요",
fileKnowledgeBase: "파일 저장 지식 베이스",
+3 -1
View File
@@ -2837,9 +2837,10 @@ export default {
},
im: {
title: 'Интеграция IM',
description: 'Подключите агента к платформам мгновенных сообщений, таким как WeCom и Feishu',
description: 'Подключите агента к платформам мгновенных сообщений, таким как WeCom, Feishu и Slack',
wecom: 'WeCom',
feishu: 'Feishu',
slack: 'Slack',
addChannel: 'Добавить канал',
editChannel: 'Редактировать канал',
deleteConfirm: 'Вы уверены, что хотите удалить этот канал? Это действие не может быть отменено.',
@@ -2856,6 +2857,7 @@ export default {
docLink: 'Руководство по интеграции',
wecomConsole: 'Консоль WeCom',
feishuConsole: 'Платформа Feishu',
slackConsole: 'Консоль Slack API',
modeHint: 'Рекомендуется WebSocket — проще настроить',
consoleTip: 'для получения учётных данных',
fileKnowledgeBase: 'База знаний для файлов',
+3 -1
View File
@@ -3149,9 +3149,10 @@ export default {
},
im: {
title: "IM 集成",
description: "将智能体接入即时通讯平台,支持企业微信和飞书",
description: "将智能体接入即时通讯平台,支持企业微信、飞书和Slack",
wecom: "企业微信",
feishu: "飞书",
slack: "Slack",
addChannel: "添加渠道",
editChannel: "编辑渠道",
deleteConfirm: "确定删除该渠道?删除后无法恢复。",
@@ -3168,6 +3169,7 @@ export default {
docLink: "查看接入文档",
wecomConsole: "企业微信管理后台",
feishuConsole: "飞书开放平台",
slackConsole: "Slack API 控制台",
modeHint: "推荐使用 WebSocket 方式接入,配置更简单",
consoleTip: "前往获取凭证信息",
fileKnowledgeBase: "文件保存知识库",