diff --git a/src/langbot/pkg/platform/sources/aiocqhttp.yaml b/src/langbot/pkg/platform/sources/aiocqhttp.yaml index b93a25243..18b233750 100644 --- a/src/langbot/pkg/platform/sources/aiocqhttp.yaml +++ b/src/langbot/pkg/platform/sources/aiocqhttp.yaml @@ -12,6 +12,7 @@ metadata: zh_Hant: OneBot v11 適配器,用於接入 QQ 機器人協定端,請查看文件了解使用方式 icon: onebot.png spec: + legacy: true categories: - protocol help_links: diff --git a/src/langbot/pkg/platform/sources/dingtalk.yaml b/src/langbot/pkg/platform/sources/dingtalk.yaml index c7c25e673..32412ef2d 100644 --- a/src/langbot/pkg/platform/sources/dingtalk.yaml +++ b/src/langbot/pkg/platform/sources/dingtalk.yaml @@ -12,6 +12,7 @@ metadata: zh_Hant: 釘釘適配器,請查看文件了解使用方式 icon: dingtalk.svg spec: + legacy: true categories: - china help_links: diff --git a/src/langbot/pkg/platform/sources/discord.yaml b/src/langbot/pkg/platform/sources/discord.yaml index 28149cbda..c781110bd 100644 --- a/src/langbot/pkg/platform/sources/discord.yaml +++ b/src/langbot/pkg/platform/sources/discord.yaml @@ -20,6 +20,7 @@ metadata: es_ES: Adaptador de Discord, requiere un entorno de red con acceso al servidor de Discord icon: discord.svg spec: + legacy: true categories: - popular - global diff --git a/src/langbot/pkg/platform/sources/kook.yaml b/src/langbot/pkg/platform/sources/kook.yaml index c63d35eed..e485190de 100644 --- a/src/langbot/pkg/platform/sources/kook.yaml +++ b/src/langbot/pkg/platform/sources/kook.yaml @@ -12,6 +12,7 @@ metadata: zh_Hant: KOOK 適配器(原開黑啦),支援頻道訊息和私聊訊息 icon: kook.png spec: + legacy: true categories: - china help_links: diff --git a/src/langbot/pkg/platform/sources/lark.yaml b/src/langbot/pkg/platform/sources/lark.yaml index 94509c470..acde1da56 100644 --- a/src/langbot/pkg/platform/sources/lark.yaml +++ b/src/langbot/pkg/platform/sources/lark.yaml @@ -14,6 +14,7 @@ metadata: ja_JP: Lark アダプター、長期接続およびWebhookモードの両方をサポートしています。使用方法の詳細については、ドキュメントを参照してください。 icon: lark.svg spec: + legacy: true categories: - popular - china diff --git a/src/langbot/pkg/platform/sources/officialaccount.yaml b/src/langbot/pkg/platform/sources/officialaccount.yaml index d09538028..19b7c8621 100644 --- a/src/langbot/pkg/platform/sources/officialaccount.yaml +++ b/src/langbot/pkg/platform/sources/officialaccount.yaml @@ -12,6 +12,7 @@ metadata: zh_Hant: 微信公眾號適配器,需要公網地址以接收訊息推送,請查看文件了解使用方式 icon: officialaccount.png spec: + legacy: true categories: - china help_links: diff --git a/src/langbot/pkg/platform/sources/qqofficial.yaml b/src/langbot/pkg/platform/sources/qqofficial.yaml index d66a770bf..1ded7e218 100644 --- a/src/langbot/pkg/platform/sources/qqofficial.yaml +++ b/src/langbot/pkg/platform/sources/qqofficial.yaml @@ -12,6 +12,7 @@ metadata: zh_Hant: QQ 官方 API,支援 Webhook 和 WebSocket 兩種連線模式 icon: qqofficial.svg spec: + legacy: true categories: - china help_links: diff --git a/src/langbot/pkg/platform/sources/slack.yaml b/src/langbot/pkg/platform/sources/slack.yaml index f1a2e740a..2827276a2 100644 --- a/src/langbot/pkg/platform/sources/slack.yaml +++ b/src/langbot/pkg/platform/sources/slack.yaml @@ -20,6 +20,7 @@ metadata: es_ES: Adaptador de Slack, requiere una dirección pública para recibir notificaciones de mensajes de Slack, consulte la documentación para obtener instrucciones de uso icon: slack.png spec: + legacy: true categories: - popular - global diff --git a/src/langbot/pkg/platform/sources/telegram.yaml b/src/langbot/pkg/platform/sources/telegram.yaml index f652ae420..c3f38d7e3 100644 --- a/src/langbot/pkg/platform/sources/telegram.yaml +++ b/src/langbot/pkg/platform/sources/telegram.yaml @@ -20,6 +20,7 @@ metadata: es_ES: Adaptador de Telegram, consulte la documentación para obtener instrucciones de uso icon: telegram.svg spec: + legacy: true categories: - popular - global diff --git a/src/langbot/pkg/platform/sources/wecom.yaml b/src/langbot/pkg/platform/sources/wecom.yaml index 509fa4e0f..64f4c00e4 100644 --- a/src/langbot/pkg/platform/sources/wecom.yaml +++ b/src/langbot/pkg/platform/sources/wecom.yaml @@ -12,6 +12,7 @@ metadata: zh_Hant: 企業微信內部機器人,請查看文件了解使用方式 icon: wecom.png spec: + legacy: true categories: - popular - china diff --git a/src/langbot/pkg/platform/sources/wecombot.yaml b/src/langbot/pkg/platform/sources/wecombot.yaml index 7e95402ee..0dc1f2cd0 100644 --- a/src/langbot/pkg/platform/sources/wecombot.yaml +++ b/src/langbot/pkg/platform/sources/wecombot.yaml @@ -12,6 +12,7 @@ metadata: zh_Hant: 企業微信智慧機器人,支援長連線和 Webhook 兩種接入方式,請查看文件了解使用方式 icon: wecombot.png spec: + legacy: true categories: - china help_links: diff --git a/src/langbot/pkg/platform/sources/wecomcs.yaml b/src/langbot/pkg/platform/sources/wecomcs.yaml index 521e7bb0e..5f6fb26ee 100644 --- a/src/langbot/pkg/platform/sources/wecomcs.yaml +++ b/src/langbot/pkg/platform/sources/wecomcs.yaml @@ -12,6 +12,7 @@ metadata: zh_Hant: 企業微信對外客服機器人,需要公網地址以接收訊息推送,請查看文件了解使用方式 icon: wecom.png spec: + legacy: true categories: - china help_links: diff --git a/web/src/app/home/bots/components/bot-form/BotForm.tsx b/web/src/app/home/bots/components/bot-form/BotForm.tsx index eb7bea89b..cd864bd52 100644 --- a/web/src/app/home/bots/components/bot-form/BotForm.tsx +++ b/web/src/app/home/bots/components/bot-form/BotForm.tsx @@ -13,7 +13,7 @@ import { httpClient } from '@/app/infra/http/HttpClient'; import { systemInfo } from '@/app/infra/http'; import { Agent, Bot } from '@/app/infra/entities/api'; import { getAdapterDocUrl } from '@/app/infra/entities/adapter-docs'; -import { ExternalLink } from 'lucide-react'; +import { ExternalLink, ChevronDown, ChevronRight } from 'lucide-react'; import EventBindingsEditor from './EventBindingsEditor'; import { zodResolver } from '@hookform/resolvers/zod'; @@ -138,11 +138,35 @@ export default function BotForm({ const currentAdapter = form.watch('adapter'); const currentAdapterConfig = form.watch('adapter_config'); - // Group adapters by category for the Select dropdown - const groupedAdapters = useMemo( - () => groupByCategory(adapterNameList), + // Group adapters by category for the Select dropdown. Legacy adapters + // (those superseded by an EBA implementation) are split out and shown in a + // collapsed group at the bottom so they're de-emphasized but still usable. + const activeAdapters = useMemo( + () => adapterNameList.filter((a) => !a.legacy), [adapterNameList], ); + const legacyAdapters = useMemo( + () => adapterNameList.filter((a) => a.legacy), + [adapterNameList], + ); + const groupedAdapters = useMemo( + () => groupByCategory(activeAdapters), + [activeAdapters], + ); + + // Whether the collapsed legacy adapter group is expanded in the Select. + const [showLegacyAdapters, setShowLegacyAdapters] = useState(false); + + // Auto-expand the legacy group when the selected adapter is itself legacy, + // so editing an existing bot on a legacy adapter still reveals the choice. + useEffect(() => { + if ( + currentAdapter && + legacyAdapters.some((a) => a.value === currentAdapter) + ) { + setShowLegacyAdapters(true); + } + }, [currentAdapter, legacyAdapters]); // Notify parent when dirty state changes const { isDirty } = form.formState; @@ -207,6 +231,7 @@ export default function BotForm({ label: extractI18nObject(item.label), value: item.name, categories: item.spec.categories, + legacy: item.spec.legacy, }; }), ); @@ -514,6 +539,62 @@ export default function BotForm({ ))} ))} + {legacyAdapters.length > 0 && ( + <> +
+ {t('bots.legacyAdaptersHint')} +
++ {t('bots.legacyAdaptersHint')} +
+