feat(im): add Yunzhijia integration
This commit is contained in:
@@ -296,7 +296,7 @@ export interface IMChannel {
|
||||
tenant_id?: number;
|
||||
agent_id: string;
|
||||
// 'lark' is Feishu's international edition; it shares Feishu's credentials and modes.
|
||||
platform: 'wecom' | 'feishu' | 'lark' | 'slack' | 'telegram' | 'dingtalk' | 'mattermost' | 'wechat' | 'qqbot';
|
||||
platform: 'wecom' | 'feishu' | 'lark' | 'slack' | 'telegram' | 'dingtalk' | 'mattermost' | 'wechat' | 'qqbot' | 'yunzhijia';
|
||||
name: string;
|
||||
enabled: boolean;
|
||||
mode: 'webhook' | 'websocket' | 'longpoll';
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 10 KiB |
@@ -154,7 +154,8 @@
|
||||
<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'">
|
||||
:disabled="formData.platform === 'mattermost'"
|
||||
@click="formData.mode = 'websocket'">
|
||||
WebSocket
|
||||
</button>
|
||||
<button type="button" class="option-chip" :class="{ 'option-chip--active': formData.mode === 'webhook' }"
|
||||
@@ -164,7 +165,8 @@
|
||||
</div>
|
||||
<p class="form-desc">
|
||||
{{ formData.platform === 'mattermost' ? $t('agentEditor.im.mattermostModeHint') :
|
||||
$t('agentEditor.im.modeHint') }}
|
||||
formData.platform === 'yunzhijia' ? $t('agentEditor.im.yunzhijiaModeHint') :
|
||||
$t('agentEditor.im.modeHint') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -472,6 +474,40 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Yunzhijia credentials -->
|
||||
<template v-if="formData.platform === 'yunzhijia'">
|
||||
<div class="platform-link-hint">
|
||||
<a href="https://open.yunzhijia.com/" target="_blank" rel="noopener noreferrer" class="doc-link">
|
||||
{{ $t('agentEditor.im.yunzhijiaConsole') }}
|
||||
<t-icon name="link" class="link-icon" />
|
||||
</a>
|
||||
<span class="hint-text">{{ $t('agentEditor.im.consoleTip') }}</span>
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<label class="form-label required">{{ $t('agentEditor.im.yunzhijiaSendMsgUrl') }}</label>
|
||||
<t-input v-model="formData.credentials.send_msg_url"
|
||||
placeholder="https://www.yunzhijia.com/gateway/robot/webhook/send?yzjtype=0&yzjtoken=..." />
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<label class="form-label">{{ $t('agentEditor.im.yunzhijiaSecret') }}</label>
|
||||
<t-input v-model="formData.credentials.secret" type="password"
|
||||
:placeholder="$t('agentEditor.im.yunzhijiaSecretPlaceholder')" />
|
||||
<p class="form-desc">{{ $t('agentEditor.im.yunzhijiaSecretHint') }}</p>
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<label class="form-label">{{ $t('agentEditor.im.yunzhijiaTimeout') }}</label>
|
||||
<t-input-number v-model="formData.credentials.timeout_seconds" placeholder="10" :min="1" :max="60"
|
||||
style="width: 100%;" />
|
||||
<p class="form-desc">{{ $t('agentEditor.im.yunzhijiaTimeoutHint') }}</p>
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<label class="form-label required">{{ $t('agentEditor.im.yunzhijiaAllowedHostSuffix') }}</label>
|
||||
<t-input v-model="formData.credentials.allowed_webhook_host_suffix" placeholder="yunzhijia.com" />
|
||||
<p class="form-desc">{{ $t('agentEditor.im.yunzhijiaAllowedHostSuffixHint') }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- WeChat credentials (QR code binding) -->
|
||||
<template v-if="formData.platform === 'wechat'">
|
||||
<p class="form-desc">{{ $t('agentEditor.im.wechatHint') }}</p>
|
||||
@@ -545,6 +581,7 @@ import dingtalkLogo from '@/assets/img/im/dingtalk.svg';
|
||||
import mattermostLogo from '@/assets/img/im/mattermost.svg';
|
||||
import wechatLogo from '@/assets/img/im/wechat.svg';
|
||||
import qqbotLogo from '@/assets/img/im/qqbot.png';
|
||||
import yunzhijiaLogo from '@/assets/img/im/yunzhijia.svg';
|
||||
|
||||
type IMPlatform = IMChannel['platform'];
|
||||
|
||||
@@ -558,6 +595,7 @@ const PLATFORM_LOGO: Record<string, string> = {
|
||||
mattermost: mattermostLogo,
|
||||
wechat: wechatLogo,
|
||||
qqbot: qqbotLogo,
|
||||
yunzhijia: yunzhijiaLogo,
|
||||
};
|
||||
|
||||
const platformLogo = (platform: string): string => (platform ? PLATFORM_LOGO[platform] || '' : '');
|
||||
@@ -609,6 +647,7 @@ const platformOptions = computed(() => ([
|
||||
{ value: 'mattermost' as IMPlatform, label: t('agentEditor.im.mattermost'), logo: mattermostLogo },
|
||||
{ value: 'wechat' as IMPlatform, label: t('agentEditor.im.wechat'), logo: wechatLogo },
|
||||
{ value: 'qqbot' as IMPlatform, label: t('agentEditor.im.qqbot'), logo: qqbotLogo },
|
||||
{ value: 'yunzhijia' as IMPlatform, label: t('agentEditor.im.yunzhijia'), logo: yunzhijiaLogo },
|
||||
]));
|
||||
|
||||
// Feishu and Lark are the same product on separate clouds, so each has its own
|
||||
@@ -756,6 +795,15 @@ function onPlatformChange(val: string | number | boolean) {
|
||||
if (val === 'wechat') {
|
||||
formData.value.mode = 'longpoll';
|
||||
formData.value.output_mode = 'full';
|
||||
} else if (val === 'mattermost' || val === 'yunzhijia') {
|
||||
formData.value.mode = 'webhook';
|
||||
formData.value.output_mode = 'stream';
|
||||
if (val === 'yunzhijia') {
|
||||
formData.value.credentials = {
|
||||
timeout_seconds: 10,
|
||||
allowed_webhook_host_suffix: 'yunzhijia.com',
|
||||
};
|
||||
}
|
||||
} else {
|
||||
formData.value.mode = 'websocket';
|
||||
formData.value.output_mode = 'stream';
|
||||
@@ -957,6 +1005,12 @@ async function handleSave() {
|
||||
MessagePlugin.warning(t('agentEditor.im.wechatScanBind'));
|
||||
return;
|
||||
}
|
||||
if (formData.value.platform === 'yunzhijia' &&
|
||||
(!String(formData.value.credentials.send_msg_url || '').trim() ||
|
||||
!String(formData.value.credentials.allowed_webhook_host_suffix || '').trim())) {
|
||||
MessagePlugin.warning(t('agentEditor.im.yunzhijiaRequiredCredentials'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (editingChannel.value) {
|
||||
await updateIMChannel(editingChannel.value.id, {
|
||||
|
||||
@@ -5883,7 +5883,7 @@ export default {
|
||||
},
|
||||
im: {
|
||||
title: 'IM Integration',
|
||||
description: 'Connect agent to instant messaging platforms like WeCom, Feishu, Lark, Slack, Telegram, DingTalk, Mattermost, WeChat and QQBot',
|
||||
description: 'Connect agent to instant messaging platforms like WeCom, Feishu, Lark, Slack, Telegram, DingTalk, Mattermost, WeChat, QQBot and Yunzhijia',
|
||||
feishu: 'Feishu',
|
||||
lark: 'Lark',
|
||||
slack: 'Slack',
|
||||
@@ -5893,6 +5893,7 @@ export default {
|
||||
wecom: 'WeCom',
|
||||
wechat: 'WeChat',
|
||||
qqbot: 'QQBot',
|
||||
yunzhijia: 'Yunzhijia',
|
||||
addChannel: 'Add Channel',
|
||||
channelsTitle: 'IM Channels',
|
||||
disabled: 'Disabled',
|
||||
@@ -5922,6 +5923,17 @@ export default {
|
||||
qqbotConsole: 'QQ Open Platform',
|
||||
qqbotAPIBaseURLHint: 'Optional. Leave empty to use the default production API endpoint.',
|
||||
qqbotGatewayURLHint: 'Optional. Leave empty to fetch the common WebSocket gateway automatically.',
|
||||
yunzhijiaConsole: 'Yunzhijia Robot Console',
|
||||
yunzhijiaModeHint: 'Supports Webhook and WebSocket; WebSocket mode does not require a public callback URL.',
|
||||
yunzhijiaSendMsgUrl: 'Send Message URL',
|
||||
yunzhijiaSecret: 'Signature Secret (optional)',
|
||||
yunzhijiaSecretPlaceholder: 'HmacSHA1 signature secret from Yunzhijia robot settings',
|
||||
yunzhijiaSecretHint: 'If configured, incoming callbacks will be verified using HmacSHA1 signature',
|
||||
yunzhijiaTimeout: 'HTTP Timeout (seconds)',
|
||||
yunzhijiaTimeoutHint: 'Timeout for sending replies via Send Message URL, default 10 seconds',
|
||||
yunzhijiaAllowedHostSuffix: 'Allowed Host Suffix',
|
||||
yunzhijiaAllowedHostSuffixHint: 'Restrict Send Message URL host to this suffix for security (e.g. yunzhijia.com)',
|
||||
yunzhijiaRequiredCredentials: 'Enter the Send Message URL and allowed host suffix',
|
||||
mattermostModeHint: 'Mattermost only supports Webhook mode (outgoing webhook + bot token).',
|
||||
mattermostPostToMain: 'Post replies in channel timeline',
|
||||
mattermostPostToMainHint:
|
||||
|
||||
@@ -5817,7 +5817,7 @@ export default {
|
||||
},
|
||||
im: {
|
||||
title: "IM 통합",
|
||||
description: "에이전트를 Feishu, Slack, Telegram, DingTalk, Mattermost, QQBot 등 인스턴트 메시징 플랫폼에 연결",
|
||||
description: "에이전트를 Feishu, Slack, Telegram, DingTalk, Mattermost, QQBot, Yunzhijia 등 인스턴트 메시징 플랫폼에 연결",
|
||||
wecom: "WeCom",
|
||||
feishu: "Feishu",
|
||||
lark: "Lark",
|
||||
@@ -5827,6 +5827,7 @@ export default {
|
||||
mattermost: "Mattermost",
|
||||
wechat: "WeChat",
|
||||
qqbot: "QQBot",
|
||||
yunzhijia: "Yunzhijia",
|
||||
addChannel: "채널 추가",
|
||||
channelsTitle: "IM 채널",
|
||||
disabled: "비활성",
|
||||
@@ -5856,6 +5857,17 @@ export default {
|
||||
qqbotConsole: "QQ Open Platform",
|
||||
qqbotAPIBaseURLHint: "선택 사항. 비워두면 기본 프로덕션 API 엔드포인트를 사용합니다.",
|
||||
qqbotGatewayURLHint: "선택 사항. 비워두면 공용 WebSocket gateway를 자동으로 가져옵니다.",
|
||||
yunzhijiaConsole: "Yunzhijia 로봇 콘솔",
|
||||
yunzhijiaModeHint: "Webhook과 WebSocket을 지원하며 WebSocket 모드에는 공개 콜백 URL이 필요하지 않습니다.",
|
||||
yunzhijiaSendMsgUrl: "메시지 전송 URL",
|
||||
yunzhijiaSecret: "서명 시크릿 (선택 사항)",
|
||||
yunzhijiaSecretPlaceholder: "Yunzhijia 로봇 설정의 HmacSHA1 서명 시크릿",
|
||||
yunzhijiaSecretHint: "설정하면 들어오는 콜백 요청이 HmacSHA1 서명으로 검증됩니다",
|
||||
yunzhijiaTimeout: "HTTP 타임아웃 (초)",
|
||||
yunzhijiaTimeoutHint: "메시지 전송 URL을 통한 응답 전송 타임아웃, 기본 10초",
|
||||
yunzhijiaAllowedHostSuffix: "허용 호스트 접미사",
|
||||
yunzhijiaAllowedHostSuffixHint: "보안을 위해 메시지 전송 URL 호스트를 이 접미사로 제한 (예: yunzhijia.com)",
|
||||
yunzhijiaRequiredCredentials: "메시지 전송 URL과 허용 호스트 접미사를 입력하세요",
|
||||
mattermostModeHint: "Mattermost는 Webhook(아웃고잉 웹훅 + 봇 토큰)만 지원합니다.",
|
||||
mattermostPostToMain: "답변을 채널 메인 타임라인에 표시",
|
||||
mattermostPostToMainHint:
|
||||
|
||||
@@ -5387,7 +5387,7 @@ export default {
|
||||
},
|
||||
im: {
|
||||
title: 'Интеграция IM',
|
||||
description: 'Подключите агента к платформам мгновенных сообщений, таким как Feishu, Slack, Telegram, DingTalk, Mattermost и QQBot',
|
||||
description: 'Подключите агента к платформам мгновенных сообщений, таким как Feishu, Slack, Telegram, DingTalk, Mattermost, QQBot и Yunzhijia',
|
||||
wecom: 'WeCom',
|
||||
feishu: 'Feishu',
|
||||
lark: 'Lark',
|
||||
@@ -5397,6 +5397,7 @@ export default {
|
||||
mattermost: 'Mattermost',
|
||||
wechat: 'WeChat',
|
||||
qqbot: 'QQBot',
|
||||
yunzhijia: 'Yunzhijia',
|
||||
addChannel: 'Добавить канал',
|
||||
channelsTitle: 'IM-каналы',
|
||||
disabled: 'Отключено',
|
||||
@@ -5426,6 +5427,17 @@ export default {
|
||||
qqbotConsole: 'QQ Open Platform',
|
||||
qqbotAPIBaseURLHint: 'Необязательно. Оставьте пустым, чтобы использовать стандартный production API endpoint.',
|
||||
qqbotGatewayURLHint: 'Необязательно. Оставьте пустым, чтобы автоматически получить общий WebSocket gateway.',
|
||||
yunzhijiaConsole: 'Консоль роботов Yunzhijia',
|
||||
yunzhijiaModeHint: 'Поддерживаются Webhook и WebSocket; для режима WebSocket не требуется публичный URL обратного вызова.',
|
||||
yunzhijiaSendMsgUrl: 'URL отправки сообщений',
|
||||
yunzhijiaSecret: 'Секрет подписи (необязательно)',
|
||||
yunzhijiaSecretPlaceholder: 'Секрет подписи HmacSHA1 из настроек робота Yunzhijia',
|
||||
yunzhijiaSecretHint: 'Если указано, входящие обратные вызовы будут проверяться с помощью подписи HmacSHA1',
|
||||
yunzhijiaTimeout: 'Таймаут HTTP (секунды)',
|
||||
yunzhijiaTimeoutHint: 'Таймаут отправки ответов через URL отправки сообщений, по умолчанию 10 секунд',
|
||||
yunzhijiaAllowedHostSuffix: 'Допустимый суффикс хоста',
|
||||
yunzhijiaAllowedHostSuffixHint: 'Ограничить хост URL отправки сообщений этим суффиксом для безопасности (напр. yunzhijia.com)',
|
||||
yunzhijiaRequiredCredentials: 'Укажите URL отправки сообщений и допустимый суффикс хоста',
|
||||
mattermostModeHint: 'Mattermost поддерживает только режим Webhook (исходящий вебхук + токен бота).',
|
||||
mattermostPostToMain: 'Ответы в основной ленте канала',
|
||||
mattermostPostToMainHint:
|
||||
|
||||
@@ -5838,7 +5838,7 @@ export default {
|
||||
},
|
||||
im: {
|
||||
title: "IM 集成",
|
||||
description: "将智能体接入即时通讯平台,支持企业微信、飞书、Slack、Telegram、钉钉、Mattermost、微信和 QQBot",
|
||||
description: "将智能体接入即时通讯平台,支持企业微信、飞书、Slack、Telegram、钉钉、Mattermost、微信、QQBot 和云之家",
|
||||
wecom: "企业微信",
|
||||
feishu: "飞书",
|
||||
lark: "Lark(飞书国际版)",
|
||||
@@ -5848,6 +5848,7 @@ export default {
|
||||
mattermost: "Mattermost",
|
||||
wechat: "微信",
|
||||
qqbot: "QQBot",
|
||||
yunzhijia: "云之家",
|
||||
addChannel: "添加渠道",
|
||||
channelsTitle: "IM 渠道",
|
||||
disabled: "已停用",
|
||||
@@ -5877,6 +5878,17 @@ export default {
|
||||
qqbotConsole: "QQ 开放平台",
|
||||
qqbotAPIBaseURLHint: "可选,留空则使用默认正式环境 API 地址。",
|
||||
qqbotGatewayURLHint: "可选,留空则自动获取通用 WebSocket 接入点。",
|
||||
yunzhijiaConsole: "云之家机器人后台",
|
||||
yunzhijiaModeHint: "支持 Webhook 和 WebSocket;WebSocket 模式无需配置公网回调地址。",
|
||||
yunzhijiaSendMsgUrl: "发送消息地址",
|
||||
yunzhijiaSecret: "签名密钥(可选)",
|
||||
yunzhijiaSecretPlaceholder: "云之家机器人设置中的 HmacSHA1 签名密钥",
|
||||
yunzhijiaSecretHint: "配置后,将对传入的回调请求进行 HmacSHA1 签名验证",
|
||||
yunzhijiaTimeout: "HTTP 超时时间(秒)",
|
||||
yunzhijiaTimeoutHint: "通过发送消息地址回复的超时时间,默认 10 秒",
|
||||
yunzhijiaAllowedHostSuffix: "允许的主机后缀",
|
||||
yunzhijiaAllowedHostSuffixHint: "限制发送消息地址的目标域名后缀,提升安全性(如 yunzhijia.com)",
|
||||
yunzhijiaRequiredCredentials: "请填写发送消息地址和允许的主机后缀",
|
||||
mattermostModeHint: "Mattermost 仅支持 Webhook(出站 Webhook + Bot Token)。",
|
||||
mattermostPostToMain: "回复显示在频道主时间线",
|
||||
mattermostPostToMainHint:
|
||||
|
||||
Reference in New Issue
Block a user