From 87e8f97c1f364f93720f41fd09284b33c466dfba Mon Sep 17 00:00:00 2001 From: AskaEth Date: Tue, 23 Jun 2026 19:28:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20ethend=20OBv11=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=AD=97=E6=AE=B5=E4=B8=A2=E5=A4=B1=20?= =?UTF-8?q?=E2=80=94=20PLATFORM=5FFIELDS=20key=20qq=E2=86=92obv11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 配置platform迁移后 PLATFORM_FIELDS['obv11'] 查不到返回空 - 新增 getPlatformFields() 归一化查找,兼容旧qq key - PLATFORM_ICONS/LABELS/REAL 同步增加 obv11 key Co-Authored-By: Claude --- ethend/public/index.html | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/ethend/public/index.html b/ethend/public/index.html index 42cb285..4b44185 100644 --- a/ethend/public/index.html +++ b/ethend/public/index.html @@ -4227,8 +4227,7 @@ function toggleTimelineAutoRefresh(on) { // ========== 面板: 第三方聊天配置 ========== -var PLATFORM_FIELDS = { - qq: [ +var PLATFORM_FIELDS = { obv11: [ { key: 'mode', label: '连接模式', type: 'select', options: [ { value: 'client', label: '客户端模式 (主动连接 NapCat)' }, { value: 'server', label: '服务端模式 (等待 NapCat 连接)' } @@ -4269,15 +4268,23 @@ var PLATFORM_FIELDS = { { key: 'admin_uids', label: '管理员账号ID (多个用逗号分隔)', placeholder: '如: 123456789,987654321' } ] }; +// Resolve platform fields with obv11→qq fallback +function getPlatformFields(platformType) { + var f = PLATFORM_FIELDS[platformType]; + if (f) return f; + f = PLATFORM_FIELDS["qq"]; + if (f) return f; + return []; +} -var PLATFORM_ICONS = { qq: '🔷', telegram: '✈️', webhook: '🪝', wechat: '💚', feishu: '🕊️', discord: '🎮' }; -var PLATFORM_LABELS = { qq: 'QQ', telegram: 'Telegram', webhook: 'Webhook', wechat: 'WeChat', feishu: 'Feishu', discord: 'Discord' }; +var PLATFORM_ICONS = { obv11: '🔷', qq: '🔷', telegram: '✈️', webhook: '🪝', wechat: '💚', feishu: '🕊️', discord: '🎮' }; +var PLATFORM_LABELS = { obv11: 'OBv11', qq: 'QQ', telegram: 'Telegram', webhook: 'Webhook', wechat: 'WeChat', feishu: 'Feishu', discord: 'Discord' }; // 已完整实现的平台 (非桩代码) -var PLATFORM_REAL = { qq: true, telegram: true, webhook: true }; +var PLATFORM_REAL = { obv11: true, qq: true, telegram: true, webhook: true }; // 静态能力声明 (来自各适配器 Capabilities() 返回值,桥接离线时展示) var PLATFORM_STATIC_CAPS = { - qq: { max_message_length: 4500, supports_markdown: false, supports_image: true, supports_voice: false, supports_emoji: true, supports_reaction: false, supports_typing_hint: false, recommend_burst_max: 3 }, + obv11: { max_message_length: 4500, supports_markdown: false, supports_image: true, supports_voice: false, supports_emoji: true, supports_reaction: false, supports_typing_hint: false, recommend_burst_max: 3 }, telegram: { max_message_length: 4096, supports_markdown: true, supports_image: true, supports_voice: true, supports_emoji: true, supports_reaction: false, supports_typing_hint: true, recommend_burst_max: 5 }, webhook: { max_message_length: 4000, supports_markdown: true, supports_image: true, supports_voice: true, supports_emoji: true, supports_reaction: false, supports_typing_hint: false, recommend_burst_max: 3 }, wechat: { max_message_length: 2048, supports_markdown: false, supports_image: true, supports_voice: true, supports_emoji: false, supports_reaction: false, supports_typing_hint: false, recommend_burst_max: 3 }, @@ -4574,7 +4581,7 @@ function renderChatPlatformDetail(name) { function renderChatConfigForm(name, cfg) { var platformType = (cfg && cfg.platform) || name; - var fields = PLATFORM_FIELDS[platformType] || []; + var fields = getPlatformFields(platformType); var container = document.getElementById('chat-config-form'); if (!container) return; var currentFields = (cfg && cfg.fields) || {}; @@ -4608,7 +4615,7 @@ function renderChatConfigForm(name, cfg) { function onCfgFieldChange(name) { var cfg = (STATE.chatConfigs || []).find(function(c) { return c.name === name; }) || null; var platformType = (cfg && cfg.platform) || name; - var fieldDefs = PLATFORM_FIELDS[platformType] || []; + var fieldDefs = getPlatformFields(platformType); var tempFields = {}; fieldDefs.forEach(function(f) { var el = document.getElementById('cfg-field-' + f.key); @@ -4624,7 +4631,7 @@ async function saveChatConfig(name) { var cfg = (STATE.chatConfigs || []).find(function(c) { return c.name === name; }) || null; var platformType = (cfg && cfg.platform) || name; var fields = {}; - var fieldDefs = PLATFORM_FIELDS[platformType] || []; + var fieldDefs = getPlatformFields(platformType); fieldDefs.forEach(function(f) { var el = document.getElementById('cfg-field-' + f.key); if (el) fields[f.key] = el.value;