feat(im): support Yunzhijia image messages
This commit is contained in:
@@ -477,17 +477,17 @@
|
||||
|
||||
<!-- 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=..." />
|
||||
<p class="form-desc">
|
||||
{{ $t('agentEditor.im.yunzhijiaSendMsgUrlHint') }}
|
||||
<a href="https://www.yunzhijia.com/opendocs/docs.html#/guide/im/robot" target="_blank"
|
||||
rel="noopener noreferrer" class="doc-link">
|
||||
{{ $t('agentEditor.im.yunzhijiaRobotDoc') }}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<label class="form-label">{{ $t('agentEditor.im.yunzhijiaSecret') }}</label>
|
||||
@@ -495,6 +495,23 @@
|
||||
: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.yunzhijiaAppId') }}</label>
|
||||
<t-input v-model="formData.credentials.app_id"
|
||||
:placeholder="$t('agentEditor.im.yunzhijiaAppIdPlaceholder')" />
|
||||
<p class="form-desc">
|
||||
{{ $t('agentEditor.im.yunzhijiaAppCredentialHint') }}
|
||||
<a href="https://www.yunzhijia.com/developers/" target="_blank" rel="noopener noreferrer"
|
||||
class="doc-link">
|
||||
{{ $t('agentEditor.im.yunzhijiaImageDoc') }}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<label class="form-label">{{ $t('agentEditor.im.yunzhijiaAppSecret') }}</label>
|
||||
<t-input v-model="formData.credentials.app_secret" type="password"
|
||||
:placeholder="$t('agentEditor.im.yunzhijiaAppSecretPlaceholder')" />
|
||||
</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"
|
||||
@@ -813,6 +830,16 @@ function onPlatformChange(val: string | number | boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeYunzhijiaCredentials() {
|
||||
if (formData.value.platform !== 'yunzhijia') return;
|
||||
if (!formData.value.credentials.allowed_webhook_host_suffix) {
|
||||
formData.value.credentials.allowed_webhook_host_suffix = 'yunzhijia.com';
|
||||
}
|
||||
if (!formData.value.credentials.timeout_seconds) {
|
||||
formData.value.credentials.timeout_seconds = 10;
|
||||
}
|
||||
}
|
||||
|
||||
async function startWeChatBinding() {
|
||||
stopWeChatPolling();
|
||||
wechatLoading.value = true;
|
||||
@@ -972,6 +999,7 @@ async function editChannel(channel: IMChannel | IMChannelOverview) {
|
||||
knowledge_base_id: fullChannel.knowledge_base_id || '',
|
||||
credentials: { ...fullChannel.credentials },
|
||||
};
|
||||
normalizeYunzhijiaCredentials();
|
||||
showCreateDialog.value = true;
|
||||
}
|
||||
|
||||
@@ -1005,11 +1033,16 @@ 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 (formData.value.platform === 'yunzhijia') {
|
||||
normalizeYunzhijiaCredentials();
|
||||
if (!String(formData.value.credentials.send_msg_url || '').trim()) {
|
||||
MessagePlugin.warning(t('agentEditor.im.yunzhijiaSendMsgUrlRequired'));
|
||||
return;
|
||||
}
|
||||
if (!String(formData.value.credentials.allowed_webhook_host_suffix || '').trim()) {
|
||||
MessagePlugin.warning(t('agentEditor.im.yunzhijiaAllowedHostSuffixRequired'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (editingChannel.value) {
|
||||
@@ -1246,6 +1279,11 @@ onUnmounted(() => {
|
||||
font-size: 12px;
|
||||
line-height: 1.45;
|
||||
color: var(--td-text-color-placeholder);
|
||||
|
||||
.doc-link {
|
||||
margin-left: 4px;
|
||||
color: var(--td-brand-color);
|
||||
}
|
||||
}
|
||||
|
||||
.option-chips {
|
||||
@@ -1338,6 +1376,7 @@ onUnmounted(() => {
|
||||
.platform-link-hint {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
|
||||
@@ -5967,17 +5967,27 @@ 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',
|
||||
yunzhijiaConsole: 'Yunzhijia Open Platform',
|
||||
yunzhijiaRobotDoc: 'Robot messaging docs',
|
||||
yunzhijiaImageDoc: 'Developer platform (images)',
|
||||
yunzhijiaModeHint: 'Supports Webhook and WebSocket; WebSocket mode does not require a public callback URL.',
|
||||
yunzhijiaSendMsgUrl: 'Send Message URL',
|
||||
yunzhijiaSendMsgUrlHint: 'Used for robot replies.',
|
||||
yunzhijiaSecret: 'Signature Secret (optional)',
|
||||
yunzhijiaSecretPlaceholder: 'HmacSHA1 signature secret from Yunzhijia robot settings',
|
||||
yunzhijiaSecretHint: 'If configured, incoming callbacks will be verified using HmacSHA1 signature',
|
||||
yunzhijiaAppId: 'App ID (image download)',
|
||||
yunzhijiaAppIdPlaceholder: 'Yunzhijia Open Platform App ID',
|
||||
yunzhijiaAppSecret: 'App Secret (image download)',
|
||||
yunzhijiaAppSecretPlaceholder: 'Yunzhijia Open Platform App Secret',
|
||||
yunzhijiaAppCredentialHint: 'Used to obtain appAccessToken and download images sent by users.',
|
||||
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',
|
||||
yunzhijiaSendMsgUrlRequired: 'Enter the Send Message URL from Yunzhijia robot settings',
|
||||
yunzhijiaAllowedHostSuffixRequired: 'Enter the allowed host suffix',
|
||||
mattermostModeHint: 'Mattermost only supports Webhook mode (outgoing webhook + bot token).',
|
||||
mattermostPostToMain: 'Post replies in channel timeline',
|
||||
mattermostPostToMainHint:
|
||||
|
||||
@@ -5898,17 +5898,27 @@ export default {
|
||||
qqbotConsole: "QQ Open Platform",
|
||||
qqbotAPIBaseURLHint: "선택 사항. 비워두면 기본 프로덕션 API 엔드포인트를 사용합니다.",
|
||||
qqbotGatewayURLHint: "선택 사항. 비워두면 공용 WebSocket gateway를 자동으로 가져옵니다.",
|
||||
yunzhijiaConsole: "Yunzhijia 로봇 콘솔",
|
||||
yunzhijiaConsole: "Yunzhijia Open Platform",
|
||||
yunzhijiaRobotDoc: "로봇 메시지 문서",
|
||||
yunzhijiaImageDoc: "개발자 플랫폼 (이미지)",
|
||||
yunzhijiaModeHint: "Webhook과 WebSocket을 지원하며 WebSocket 모드에는 공개 콜백 URL이 필요하지 않습니다.",
|
||||
yunzhijiaSendMsgUrl: "메시지 전송 URL",
|
||||
yunzhijiaSendMsgUrlHint: "로봇 응답 전송에 사용됩니다.",
|
||||
yunzhijiaSecret: "서명 시크릿 (선택 사항)",
|
||||
yunzhijiaSecretPlaceholder: "Yunzhijia 로봇 설정의 HmacSHA1 서명 시크릿",
|
||||
yunzhijiaSecretHint: "설정하면 들어오는 콜백 요청이 HmacSHA1 서명으로 검증됩니다",
|
||||
yunzhijiaAppId: "App ID (이미지 다운로드)",
|
||||
yunzhijiaAppIdPlaceholder: "Yunzhijia Open Platform App ID",
|
||||
yunzhijiaAppSecret: "App Secret (이미지 다운로드)",
|
||||
yunzhijiaAppSecretPlaceholder: "Yunzhijia Open Platform App Secret",
|
||||
yunzhijiaAppCredentialHint: "사용자가 보낸 이미지를 다운로드하기 위한 appAccessToken 발급에 사용됩니다.",
|
||||
yunzhijiaTimeout: "HTTP 타임아웃 (초)",
|
||||
yunzhijiaTimeoutHint: "메시지 전송 URL을 통한 응답 전송 타임아웃, 기본 10초",
|
||||
yunzhijiaAllowedHostSuffix: "허용 호스트 접미사",
|
||||
yunzhijiaAllowedHostSuffixHint: "보안을 위해 메시지 전송 URL 호스트를 이 접미사로 제한 (예: yunzhijia.com)",
|
||||
yunzhijiaRequiredCredentials: "메시지 전송 URL과 허용 호스트 접미사를 입력하세요",
|
||||
yunzhijiaSendMsgUrlRequired: "Yunzhijia 로봇 설정의 메시지 전송 URL을 입력하세요",
|
||||
yunzhijiaAllowedHostSuffixRequired: "허용 호스트 접미사를 입력하세요",
|
||||
mattermostModeHint: "Mattermost는 Webhook(아웃고잉 웹훅 + 봇 토큰)만 지원합니다.",
|
||||
mattermostPostToMain: "답변을 채널 메인 타임라인에 표시",
|
||||
mattermostPostToMainHint:
|
||||
|
||||
@@ -5470,17 +5470,27 @@ export default {
|
||||
qqbotConsole: 'QQ Open Platform',
|
||||
qqbotAPIBaseURLHint: 'Необязательно. Оставьте пустым, чтобы использовать стандартный production API endpoint.',
|
||||
qqbotGatewayURLHint: 'Необязательно. Оставьте пустым, чтобы автоматически получить общий WebSocket gateway.',
|
||||
yunzhijiaConsole: 'Консоль роботов Yunzhijia',
|
||||
yunzhijiaConsole: 'Yunzhijia Open Platform',
|
||||
yunzhijiaRobotDoc: 'Документация робота',
|
||||
yunzhijiaImageDoc: 'Платформа разработчика (изображения)',
|
||||
yunzhijiaModeHint: 'Поддерживаются Webhook и WebSocket; для режима WebSocket не требуется публичный URL обратного вызова.',
|
||||
yunzhijiaSendMsgUrl: 'URL отправки сообщений',
|
||||
yunzhijiaSendMsgUrlHint: 'Используется для ответов робота.',
|
||||
yunzhijiaSecret: 'Секрет подписи (необязательно)',
|
||||
yunzhijiaSecretPlaceholder: 'Секрет подписи HmacSHA1 из настроек робота Yunzhijia',
|
||||
yunzhijiaSecretHint: 'Если указано, входящие обратные вызовы будут проверяться с помощью подписи HmacSHA1',
|
||||
yunzhijiaAppId: 'App ID (загрузка изображений)',
|
||||
yunzhijiaAppIdPlaceholder: 'App ID открытой платформы Yunzhijia',
|
||||
yunzhijiaAppSecret: 'App Secret (загрузка изображений)',
|
||||
yunzhijiaAppSecretPlaceholder: 'App Secret открытой платформы Yunzhijia',
|
||||
yunzhijiaAppCredentialHint: 'Используется для получения appAccessToken и загрузки изображений от пользователей.',
|
||||
yunzhijiaTimeout: 'Таймаут HTTP (секунды)',
|
||||
yunzhijiaTimeoutHint: 'Таймаут отправки ответов через URL отправки сообщений, по умолчанию 10 секунд',
|
||||
yunzhijiaAllowedHostSuffix: 'Допустимый суффикс хоста',
|
||||
yunzhijiaAllowedHostSuffixHint: 'Ограничить хост URL отправки сообщений этим суффиксом для безопасности (напр. yunzhijia.com)',
|
||||
yunzhijiaRequiredCredentials: 'Укажите URL отправки сообщений и допустимый суффикс хоста',
|
||||
yunzhijiaSendMsgUrlRequired: 'Укажите URL отправки сообщений из настроек робота Yunzhijia',
|
||||
yunzhijiaAllowedHostSuffixRequired: 'Укажите допустимый суффикс хоста',
|
||||
mattermostModeHint: 'Mattermost поддерживает только режим Webhook (исходящий вебхук + токен бота).',
|
||||
mattermostPostToMain: 'Ответы в основной ленте канала',
|
||||
mattermostPostToMainHint:
|
||||
|
||||
@@ -5951,17 +5951,27 @@ export default {
|
||||
qqbotConsole: "QQ 开放平台",
|
||||
qqbotAPIBaseURLHint: "可选,留空则使用默认正式环境 API 地址。",
|
||||
qqbotGatewayURLHint: "可选,留空则自动获取通用 WebSocket 接入点。",
|
||||
yunzhijiaConsole: "云之家机器人后台",
|
||||
yunzhijiaConsole: "云之家开放平台",
|
||||
yunzhijiaRobotDoc: "机器人消息文档",
|
||||
yunzhijiaImageDoc: "开发者平台(图片功能)",
|
||||
yunzhijiaModeHint: "支持 Webhook 和 WebSocket;WebSocket 模式无需配置公网回调地址。",
|
||||
yunzhijiaSendMsgUrl: "发送消息地址",
|
||||
yunzhijiaSendMsgUrlHint: "用于机器人回复消息。",
|
||||
yunzhijiaSecret: "签名密钥(可选)",
|
||||
yunzhijiaSecretPlaceholder: "云之家机器人设置中的 HmacSHA1 签名密钥",
|
||||
yunzhijiaSecretHint: "配置后,将对传入的回调请求进行 HmacSHA1 签名验证",
|
||||
yunzhijiaAppId: "应用 App ID(图片下载)",
|
||||
yunzhijiaAppIdPlaceholder: "云之家开放平台应用 App ID",
|
||||
yunzhijiaAppSecret: "应用 App Secret(图片下载)",
|
||||
yunzhijiaAppSecretPlaceholder: "云之家开放平台应用 Secret",
|
||||
yunzhijiaAppCredentialHint: "用于获取 appAccessToken 并下载用户发送的图片文件。",
|
||||
yunzhijiaTimeout: "HTTP 超时时间(秒)",
|
||||
yunzhijiaTimeoutHint: "通过发送消息地址回复的超时时间,默认 10 秒",
|
||||
yunzhijiaAllowedHostSuffix: "允许的主机后缀",
|
||||
yunzhijiaAllowedHostSuffixHint: "限制发送消息地址的目标域名后缀,提升安全性(如 yunzhijia.com)",
|
||||
yunzhijiaRequiredCredentials: "请填写发送消息地址和允许的主机后缀",
|
||||
yunzhijiaSendMsgUrlRequired: "请填写云之家机器人设置中的发送消息地址",
|
||||
yunzhijiaAllowedHostSuffixRequired: "请填写允许的主机后缀",
|
||||
mattermostModeHint: "Mattermost 仅支持 Webhook(出站 Webhook + Bot Token)。",
|
||||
mattermostPostToMain: "回复显示在频道主时间线",
|
||||
mattermostPostToMainHint:
|
||||
|
||||
Reference in New Issue
Block a user