Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

♻️ refactor(channel): move channel platform components into features/AgentChannel (#20970)

Rdmclin2f30d46a5d2a0
diff --git a/.agents/skills/agent-testing-bot/imessage/index.md b/.agents/skills/agent-testing-bot/imessage/index.md
index 088835de9c6..c758915bb2a 100644
--- a/.agents/skills/agent-testing-bot/imessage/index.md
+++ b/.agents/skills/agent-testing-bot/imessage/index.md
@@ -83,7 +83,7 @@ registers the BlueBubbles webhook. `removeConfig` + `stop` reverse it.
The bridge settings only render in Desktop (`isDesktop` guard) under the agent's
**Channel → iMessage** screen. The platform tile only appears as a real (non
"Coming Soon") entry once the server registers `imessage` **and** the frontend
-drops it from `COMING_SOON_PLATFORMS` (`src/routes/(main)/agent/channel/const.ts`).
+drops it from `COMING_SOON_PLATFORMS` (`src/features/AgentChannel/const.ts`).
```bash
agent-browser --cdp 9222 open "http://localhost:5173/agent/<aid>/channel"
diff --git a/docs/development/basic/add-new-bot-platform.mdx b/docs/development/basic/add-new-bot-platform.mdx
index 6da02d6064d..9302da4f38a 100644
--- a/docs/development/basic/add-new-bot-platform.mdx
+++ b/docs/development/basic/add-new-bot-platform.mdx
@@ -398,7 +398,7 @@ Follow the structure of existing docs (e.g., `discord.mdx`): Prerequisites → C
The frontend automatically generates the configuration form from the schema. No frontend code changes are needed unless your platform requires a custom icon. The icon resolution works by matching the platform `name` against known icons in `@lobehub/ui/icons`:
```
-// src/routes/(main)/agent/channel/const.ts
+// src/features/AgentChannel/const.ts
const ICON_NAMES = ['Discord', 'GoogleChat', 'Lark', 'Slack', 'Telegram', ...];
```
diff --git a/docs/development/basic/add-new-bot-platform.zh-CN.mdx b/docs/development/basic/add-new-bot-platform.zh-CN.mdx
index f2996123532..3cfbfba30ea 100644
--- a/docs/development/basic/add-new-bot-platform.zh-CN.mdx
+++ b/docs/development/basic/add-new-bot-platform.zh-CN.mdx
@@ -395,7 +395,7 @@ platformRegistry.register(myPlatform);
前端会根据 Schema 自动生成配置表单,无需修改前端代码(除非你的平台需要自定义图标)。图标解析通过将平台 `name` 与 `@lobehub/ui/icons` 中的已知图标匹配来实现:
```
-// src/routes/(main)/agent/channel/const.ts
+// src/features/AgentChannel/const.ts
const ICON_NAMES = ['Discord', 'GoogleChat', 'Lark', 'Slack', 'Telegram', ...];
```
diff --git a/locales/ar/setting.json b/locales/ar/setting.json
index ae1a831f43b..977e882712b 100644
--- a/locales/ar/setting.json
+++ b/locales/ar/setting.json
@@ -3122,11 +3122,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "كتابة ملف تعريف الفريق وأفكار المهام الأولى",
"workspace.onboarding.flow.learnYourTeam.progress.review": "قراءة بيانات الفريق من التطبيقات المتصلة",
"workspace.onboarding.flow.learnYourTeam.title": "تعرف على فريقك",
- "workspace.onboarding.flow.messenger.description": "بمجرد تثبيته للفريق، يمكن للأعضاء الإشارة إلى @{{name}} في المجموعة لتسليم العمل — لا يحتاج أحد إلى ربطه بشكل فردي.",
- "workspace.onboarding.flow.messenger.highlight": "وأستطيع المساعدة حيثما كان الجميع بالفعل.",
- "workspace.onboarding.flow.messenger.more": "هل تستخدم روبوتك الخاص على Feishu أو QQ أو LINE أو غيرها؟ قم بإعداده لاحقًا في Ajan → القنوات.",
- "workspace.onboarding.flow.messenger.quote": "أضفني إلى مجموعة فريقك،",
- "workspace.onboarding.flow.messenger.title": "أدخل المساعد في دردشة فريقك",
"workspace.onboarding.flow.starterTasks.addFailed": "تعذر إضافة المهام. يرجى المحاولة مرة أخرى.",
"workspace.onboarding.flow.starterTasks.description": "سلم هذه المهام إلى مساعد الفريق وشاهد كيف يعمل عليها في مساحة العمل.",
"workspace.onboarding.flow.starterTasks.empty": "لا توجد مهام مقترحة حتى الآن. يمكنك إنهاء الإعداد الآن.",
diff --git a/locales/bg-BG/setting.json b/locales/bg-BG/setting.json
index 156a14c15ad..25e5dd1ff6a 100644
--- a/locales/bg-BG/setting.json
+++ b/locales/bg-BG/setting.json
@@ -3122,11 +3122,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "Създаване на профила на екипа и първите идеи за задачи",
"workspace.onboarding.flow.learnYourTeam.progress.review": "Четене на данни за екипа от свързаните приложения",
"workspace.onboarding.flow.learnYourTeam.title": "Опознайте вашия екип",
- "workspace.onboarding.flow.messenger.description": "След като бъде инсталиран за екипа, членовете могат да споменават @{{name}} в групата, за да предават задачи — никой не трябва да го свързва индивидуално.",
- "workspace.onboarding.flow.messenger.highlight": "и аз мога да помагам там, където вече са всички.",
- "workspace.onboarding.flow.messenger.more": "Използвате собствен бот на Feishu, QQ, LINE или другаде? Настройте го по-късно в Agent → Channels.",
- "workspace.onboarding.flow.messenger.quote": "Добавете ме към групата на вашия екип,",
- "workspace.onboarding.flow.messenger.title": "Включете асистента в чата на вашия екип",
"workspace.onboarding.flow.starterTasks.addFailed": "Не успяхме да добавим задачите. Моля, опитайте отново.",
"workspace.onboarding.flow.starterTasks.description": "Предайте тези задачи на екипния асистент и наблюдавайте как той ги изпълнява в работното пространство.",
"workspace.onboarding.flow.starterTasks.empty": "Все още няма предложени задачи. Можете да завършите настройката сега.",
diff --git a/locales/de-DE/setting.json b/locales/de-DE/setting.json
index f20cdb449d2..c61996994de 100644
--- a/locales/de-DE/setting.json
+++ b/locales/de-DE/setting.json
@@ -3122,11 +3122,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "Erstellen des Teamprofils und erster Aufgabenideen",
"workspace.onboarding.flow.learnYourTeam.progress.review": "Lesen von Teamdaten aus verbundenen Apps",
"workspace.onboarding.flow.learnYourTeam.title": "Lernen Sie Ihr Team kennen",
- "workspace.onboarding.flow.messenger.description": "Sobald es für das Team installiert ist, können Mitglieder @{{name}} in der Gruppe verwenden, um Aufgaben zu übergeben – niemand muss es individuell verknüpfen.",
- "workspace.onboarding.flow.messenger.highlight": "und ich kann dort helfen, wo alle bereits sind.",
- "workspace.onboarding.flow.messenger.more": "Verwenden Sie Ihren eigenen Bot auf Feishu, QQ, LINE oder anderswo? Richten Sie ihn später unter Agent → Kanäle ein.",
- "workspace.onboarding.flow.messenger.quote": "Fügen Sie mich Ihrer Teamgruppe hinzu,",
- "workspace.onboarding.flow.messenger.title": "Bringen Sie den Assistenten in den Teamchat",
"workspace.onboarding.flow.starterTasks.addFailed": "Die Aufgaben konnten nicht hinzugefügt werden. Bitte versuchen Sie es erneut.",
"workspace.onboarding.flow.starterTasks.description": "Übergeben Sie diese Aufgaben dem Teamassistenten und sehen Sie zu, wie er sie im Arbeitsbereich bearbeitet.",
"workspace.onboarding.flow.starterTasks.empty": "Noch keine vorgeschlagenen Aufgaben. Sie können die Einrichtung jetzt abschließen.",
diff --git a/locales/en-US/agent.json b/locales/en-US/agent.json
index f45704d5529..9d069679e3a 100644
--- a/locales/en-US/agent.json
+++ b/locales/en-US/agent.json
@@ -35,6 +35,7 @@
"channel.concurrencyQueue": "Queue",
"channel.concurrencyQueueHint": "Process messages one at a time",
"channel.connectFailed": "Bot connection failed",
+ "channel.connectFailedHint": "Check the credentials and platform settings, then save again to reconnect.",
"channel.connectQueued": "Bot connection queued. It will start shortly.",
"channel.connectStarting": "Bot is starting. Please wait a moment.",
"channel.connectSuccess": "Bot connected successfully",
@@ -237,9 +238,12 @@
"channel.removeChannel": "Remove Channel",
"channel.removeFailed": "Failed to remove channel",
"channel.removed": "Channel removed",
+ "channel.resultDetail.hide": "Hide details",
+ "channel.resultDetail.show": "Show details",
"channel.runtimeDisconnected": "Bot disconnected",
"channel.save": "Save Configuration",
"channel.saveFailed": "Failed to save configuration",
+ "channel.saveFailedHint": "Check the fields above and try again.",
"channel.saveFirstWarning": "Please save configuration first",
"channel.saved": "Configuration saved successfully",
"channel.secretToken": "Webhook Secret Token",
@@ -272,6 +276,7 @@
"channel.telegram.description": "Connect this agent to Telegram for private and group chats.",
"channel.testConnection": "Test Connection",
"channel.testFailed": "Connection test failed",
+ "channel.testFailedHint": "Check the credentials and try again.",
"channel.testSuccess": "Connection test passed",
"channel.updateFailed": "Failed to update status",
"channel.userId": "Your Platform User ID",
diff --git a/locales/en-US/setting.json b/locales/en-US/setting.json
index ba0e84ca95a..8f4c8515d66 100644
--- a/locales/en-US/setting.json
+++ b/locales/en-US/setting.json
@@ -3111,10 +3111,21 @@
"workspace.newWorkspace": "New Workspace",
"workspace.onboarding.finish": "Finish",
"workspace.onboarding.flow.assistant.hint": "💡 This assistant is shared by the whole team. Members can @ it in chats and group chats.",
+ "workspace.onboarding.flow.channels.configTitle": "Connect {{platform}}",
+ "workspace.onboarding.flow.channels.description": "Connect a bot your team owns to {{name}}. Everyone in the group can @{{name}} to hand off work — nobody has to link an account.",
+ "workspace.onboarding.flow.channels.highlight": "and anyone can hand me work.",
+ "workspace.onboarding.flow.channels.more": "You can change channels anytime in Agent → Channels.",
+ "workspace.onboarding.flow.channels.quote": "Add me to your team's group chats,",
+ "workspace.onboarding.flow.channels.title": "Bring the assistant into your team's chats",
"workspace.onboarding.flow.connectApps.description": "Connect the apps your team uses so the assistant can learn its projects and who does what. Authorization applies to the whole workspace.",
"workspace.onboarding.flow.connectApps.more": "You can connect more apps anytime in Settings → Connectors.",
"workspace.onboarding.flow.connectApps.skip": "Skip for now, connect later",
"workspace.onboarding.flow.connectApps.title": "Connect your team's work apps",
+ "workspace.onboarding.flow.devices.connect": "Connect device",
+ "workspace.onboarding.flow.devices.count": "{{online}} of {{count}} online",
+ "workspace.onboarding.flow.devices.empty": "No team devices yet. Install the desktop app or run lh connect on a team computer to add one.",
+ "workspace.onboarding.flow.devices.subtitle": "Enroll the team’s computers so the assistant can use Claude Code, Codex and other local agents on them.",
+ "workspace.onboarding.flow.devices.title": "Connect team devices",
"workspace.onboarding.flow.invite.highlight": "and I can start helping everyone.",
"workspace.onboarding.flow.invite.invalidEmails": "Invalid email address: {{emails}}",
"workspace.onboarding.flow.invite.quote": "Bring your teammates in,",
@@ -3128,11 +3139,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "Writing the team profile and first task ideas",
"workspace.onboarding.flow.learnYourTeam.progress.review": "Reading team data from connected apps",
"workspace.onboarding.flow.learnYourTeam.title": "Get to know your team",
- "workspace.onboarding.flow.messenger.description": "Once installed for the team, members can @{{name}} in the group to hand off work — nobody has to link it individually.",
- "workspace.onboarding.flow.messenger.highlight": "and I can help where everyone already is.",
- "workspace.onboarding.flow.messenger.more": "Using your own bot on Feishu, QQ, LINE or elsewhere? Set it up later in Agent → Channels.",
- "workspace.onboarding.flow.messenger.quote": "Add me to your team group,",
- "workspace.onboarding.flow.messenger.title": "Bring the assistant into your team's chat",
"workspace.onboarding.flow.starterTasks.addFailed": "Couldn't add the tasks. Please try again.",
"workspace.onboarding.flow.starterTasks.description": "Hand these tasks to the team assistant and watch it work through them in the workspace.",
"workspace.onboarding.flow.starterTasks.empty": "No suggested tasks yet. You can finish setup now.",
diff --git a/locales/es-ES/setting.json b/locales/es-ES/setting.json
index b98bf829997..e202c5f9f26 100644
--- a/locales/es-ES/setting.json
+++ b/locales/es-ES/setting.json
@@ -3122,11 +3122,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "Escribiendo el perfil del equipo e ideas para las primeras tareas",
"workspace.onboarding.flow.learnYourTeam.progress.review": "Leyendo datos del equipo desde las aplicaciones conectadas",
"workspace.onboarding.flow.learnYourTeam.title": "Conoce a tu equipo",
- "workspace.onboarding.flow.messenger.description": "Una vez instalado para el equipo, los miembros pueden mencionar a @{{name}} en el grupo para delegar trabajo — nadie tiene que vincularlo individualmente.",
- "workspace.onboarding.flow.messenger.highlight": "y puedo ayudar donde ya están todos.",
- "workspace.onboarding.flow.messenger.more": "¿Usas tu propio bot en Feishu, QQ, LINE u otro lugar? Configúralo más tarde en Ajan → Canales.",
- "workspace.onboarding.flow.messenger.quote": "Agrégame al grupo de tu equipo,",
- "workspace.onboarding.flow.messenger.title": "Lleva al asistente al chat de tu equipo",
"workspace.onboarding.flow.starterTasks.addFailed": "No se pudieron agregar las tareas. Por favor, inténtalo de nuevo.",
"workspace.onboarding.flow.starterTasks.description": "Asigna estas tareas al asistente del equipo y observa cómo las realiza en el espacio de trabajo.",
"workspace.onboarding.flow.starterTasks.empty": "Aún no hay tareas sugeridas. Puedes finalizar la configuración ahora.",
diff --git a/locales/fa-IR/setting.json b/locales/fa-IR/setting.json
index 5cb06e85362..be7ee944e67 100644
--- a/locales/fa-IR/setting.json
+++ b/locales/fa-IR/setting.json
@@ -3122,11 +3122,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "نوشتن پروفایل تیم و ایده‌های اولین وظایف",
"workspace.onboarding.flow.learnYourTeam.progress.review": "خواندن داده‌های تیم از برنامه‌های متصل",
"workspace.onboarding.flow.learnYourTeam.title": "تیم خود را بشناسید",
- "workspace.onboarding.flow.messenger.description": "پس از نصب برای تیم، اعضا می‌توانند در گروه به @{{name}} اشاره کنند تا کارها را به آن واگذار کنند — هیچ‌کس نیازی به اتصال جداگانه ندارد.",
- "workspace.onboarding.flow.messenger.highlight": "و من می‌توانم در جایی که همه هستند کمک کنم.",
- "workspace.onboarding.flow.messenger.more": "از ربات خود در Feishu، QQ، LINE یا جاهای دیگر استفاده می‌کنید؟ بعداً در Ajan → کانال‌ها تنظیم کنید.",
- "workspace.onboarding.flow.messenger.quote": "من را به گروه تیم خود اضافه کنید،",
- "workspace.onboarding.flow.messenger.title": "دستیار را به چت تیم خود بیاورید",
"workspace.onboarding.flow.starterTasks.addFailed": "وظایف اضافه نشدند. لطفاً دوباره تلاش کنید.",
"workspace.onboarding.flow.starterTasks.description": "این وظایف را به دستیار تیم بسپارید و ببینید که چگونه آنها را در فضای کاری انجام می‌دهد.",
"workspace.onboarding.flow.starterTasks.empty": "هنوز وظایف پیشنهادی وجود ندارد. می‌توانید اکنون تنظیمات را کامل کنید.",
diff --git a/locales/fr-FR/setting.json b/locales/fr-FR/setting.json
index 4c291442890..6f55761cf1e 100644
--- a/locales/fr-FR/setting.json
+++ b/locales/fr-FR/setting.json
@@ -3122,11 +3122,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "Rédaction du profil de l'équipe et des premières idées de tâches",
"workspace.onboarding.flow.learnYourTeam.progress.review": "Lecture des données de l'équipe à partir des applications connectées",
"workspace.onboarding.flow.learnYourTeam.title": "Apprenez à connaître votre équipe",
- "workspace.onboarding.flow.messenger.description": "Une fois installé pour l'équipe, les membres peuvent mentionner @{{name}} dans le groupe pour déléguer du travail — personne n'a besoin de le lier individuellement.",
- "workspace.onboarding.flow.messenger.highlight": "et je peux aider là où tout le monde est déjà.",
- "workspace.onboarding.flow.messenger.more": "Vous utilisez votre propre bot sur Feishu, QQ, LINE ou ailleurs ? Configurez-le plus tard dans Ajan → Canaux.",
- "workspace.onboarding.flow.messenger.quote": "Ajoutez-moi à votre groupe d'équipe,",
- "workspace.onboarding.flow.messenger.title": "Amenez l'assistant dans le chat de votre équipe",
"workspace.onboarding.flow.starterTasks.addFailed": "Impossible d'ajouter les tâches. Veuillez réessayer.",
"workspace.onboarding.flow.starterTasks.description": "Confiez ces tâches à l'assistant d'équipe et regardez-le les exécuter dans l'espace de travail.",
"workspace.onboarding.flow.starterTasks.empty": "Aucune tâche suggérée pour l'instant. Vous pouvez terminer la configuration maintenant.",
diff --git a/locales/it-IT/setting.json b/locales/it-IT/setting.json
index a5e92a167bc..921c77b2575 100644
--- a/locales/it-IT/setting.json
+++ b/locales/it-IT/setting.json
@@ -3122,11 +3122,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "Scrittura del profilo del team e delle prime idee per le attività",
"workspace.onboarding.flow.learnYourTeam.progress.review": "Lettura dei dati del team dalle app collegate",
"workspace.onboarding.flow.learnYourTeam.title": "Conosci il tuo team",
- "workspace.onboarding.flow.messenger.description": "Una volta installato per il team, i membri possono menzionare @{{name}} nel gruppo per delegare il lavoro — nessuno deve collegarlo individualmente.",
- "workspace.onboarding.flow.messenger.highlight": "e posso aiutare dove tutti già si trovano.",
- "workspace.onboarding.flow.messenger.more": "Usi un tuo bot su Feishu, QQ, LINE o altrove? Configuralo più tardi in Ajan → Canali.",
- "workspace.onboarding.flow.messenger.quote": "Aggiungimi al gruppo del tuo team,",
- "workspace.onboarding.flow.messenger.title": "Porta l'assistente nella chat del tuo team",
"workspace.onboarding.flow.starterTasks.addFailed": "Impossibile aggiungere le attività. Riprova.",
"workspace.onboarding.flow.starterTasks.description": "Assegna queste attività all'assistente del team e osserva come le completa nello spazio di lavoro.",
"workspace.onboarding.flow.starterTasks.empty": "Nessuna attività suggerita al momento. Puoi completare la configurazione ora.",
diff --git a/locales/ja-JP/setting.json b/locales/ja-JP/setting.json
index cc055ab85d0..8cb42fbfe56 100644
--- a/locales/ja-JP/setting.json
+++ b/locales/ja-JP/setting.json
@@ -3122,11 +3122,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "チームプロファイルと最初のタスクアイデアを作成中",
"workspace.onboarding.flow.learnYourTeam.progress.review": "接続されたアプリからチームデータを読み取り中",
"workspace.onboarding.flow.learnYourTeam.title": "チームを知る",
- "workspace.onboarding.flow.messenger.description": "チーム全体にインストールされると、メンバーはグループ内で@{{name}}を使って作業を引き継ぐことができます。個別にリンクする必要はありません。",
- "workspace.onboarding.flow.messenger.highlight": "そうすれば、みんながいる場所でサポートできます。",
- "workspace.onboarding.flow.messenger.more": "Feishu、QQ、LINEなどで独自のボットを使用していますか?後でエージェント → チャンネルで設定できます。",
- "workspace.onboarding.flow.messenger.quote": "チームのグループに私を追加してください、",
- "workspace.onboarding.flow.messenger.title": "アシスタントをチームのチャットに追加する",
"workspace.onboarding.flow.starterTasks.addFailed": "タスクを追加できませんでした。もう一度お試しください。",
"workspace.onboarding.flow.starterTasks.description": "これらのタスクをチームアシスタントに任せ、ワークスペースでの作業を見守りましょう。",
"workspace.onboarding.flow.starterTasks.empty": "まだ提案されたタスクはありません。今すぐセットアップを完了できます。",
diff --git a/locales/ko-KR/setting.json b/locales/ko-KR/setting.json
index e2f36e962f0..49f1684736a 100644
--- a/locales/ko-KR/setting.json
+++ b/locales/ko-KR/setting.json
@@ -3122,11 +3122,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "팀 프로필 및 첫 번째 작업 아이디어 작성 중",
"workspace.onboarding.flow.learnYourTeam.progress.review": "연결된 앱에서 팀 데이터를 읽는 중",
"workspace.onboarding.flow.learnYourTeam.title": "팀을 알아가기",
- "workspace.onboarding.flow.messenger.description": "팀에 설치되면 멤버들은 그룹에서 @{{name}}으로 작업을 넘길 수 있습니다. 개별적으로 연결할 필요가 없습니다.",
- "workspace.onboarding.flow.messenger.highlight": "그리고 제가 모두가 있는 곳에서 도울 수 있습니다.",
- "workspace.onboarding.flow.messenger.more": "Feishu, QQ, LINE 또는 다른 곳에서 자체 봇을 사용 중인가요? 나중에 에이전트 → 채널에서 설정하세요.",
- "workspace.onboarding.flow.messenger.quote": "저를 팀 그룹에 추가하세요,",
- "workspace.onboarding.flow.messenger.title": "어시스턴트를 팀 채팅에 추가",
"workspace.onboarding.flow.starterTasks.addFailed": "작업을 추가할 수 없습니다. 다시 시도하세요.",
"workspace.onboarding.flow.starterTasks.description": "이 작업들을 팀 어시스턴트에게 맡기고 작업 공간에서 처리 과정을 지켜보세요.",
"workspace.onboarding.flow.starterTasks.empty": "아직 제안된 작업이 없습니다. 지금 설정을 완료할 수 있습니다.",
diff --git a/locales/nl-NL/setting.json b/locales/nl-NL/setting.json
index f59fd12f7ce..840f8059eea 100644
--- a/locales/nl-NL/setting.json
+++ b/locales/nl-NL/setting.json
@@ -3122,11 +3122,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "Het teamprofiel en eerste taakideeën schrijven",
"workspace.onboarding.flow.learnYourTeam.progress.review": "Teamgegevens lezen uit verbonden apps",
"workspace.onboarding.flow.learnYourTeam.title": "Leer je team kennen",
- "workspace.onboarding.flow.messenger.description": "Zodra geïnstalleerd voor het team, kunnen leden @{{name}} in de groep noemen om werk over te dragen — niemand hoeft het individueel te koppelen.",
- "workspace.onboarding.flow.messenger.highlight": "en ik kan helpen waar iedereen al is.",
- "workspace.onboarding.flow.messenger.more": "Gebruik je eigen bot op Feishu, QQ, LINE of elders? Stel het later in via Agent → Kanalen.",
- "workspace.onboarding.flow.messenger.quote": "Voeg me toe aan je teamgroep,",
- "workspace.onboarding.flow.messenger.title": "Breng de assistent in de chat van je team",
"workspace.onboarding.flow.starterTasks.addFailed": "Kon de taken niet toevoegen. Probeer opnieuw.",
"workspace.onboarding.flow.starterTasks.description": "Geef deze taken aan de teamassistent en kijk hoe het ze afhandelt in de werkruimte.",
"workspace.onboarding.flow.starterTasks.empty": "Nog geen voorgestelde taken. Je kunt de setup nu voltooien.",
diff --git a/locales/pl-PL/setting.json b/locales/pl-PL/setting.json
index e4ede8893a0..acea2e560c3 100644
--- a/locales/pl-PL/setting.json
+++ b/locales/pl-PL/setting.json
@@ -3122,11 +3122,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "Tworzenie profilu zespołu i pierwszych pomysłów na zadania",
"workspace.onboarding.flow.learnYourTeam.progress.review": "Odczytywanie danych zespołu z połączonych aplikacji",
"workspace.onboarding.flow.learnYourTeam.title": "Poznaj swój zespół",
- "workspace.onboarding.flow.messenger.description": "Po zainstalowaniu dla zespołu, członkowie mogą oznaczać @{{name}} w grupie, aby przekazać zadania — nikt nie musi łączyć go indywidualnie.",
- "workspace.onboarding.flow.messenger.highlight": "i mogę pomóc tam, gdzie wszyscy już są.",
- "workspace.onboarding.flow.messenger.more": "Używasz własnego bota na Feishu, QQ, LINE lub gdzie indziej? Skonfiguruj go później w Ajan → Kanały.",
- "workspace.onboarding.flow.messenger.quote": "Dodaj mnie do grupy zespołowej,",
- "workspace.onboarding.flow.messenger.title": "Wprowadź asystenta do czatu zespołu",
"workspace.onboarding.flow.starterTasks.addFailed": "Nie udało się dodać zadań. Spróbuj ponownie.",
"workspace.onboarding.flow.starterTasks.description": "Przekaż te zadania asystentowi zespołu i obserwuj, jak wykonuje je w obszarze roboczym.",
"workspace.onboarding.flow.starterTasks.empty": "Brak sugerowanych zadań. Możesz zakończyć konfigurację teraz.",
diff --git a/locales/pt-BR/setting.json b/locales/pt-BR/setting.json
index 4d60ba2c6ee..e0977d0054f 100644
--- a/locales/pt-BR/setting.json
+++ b/locales/pt-BR/setting.json
@@ -3122,11 +3122,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "Escrevendo o perfil da equipe e ideias para as primeiras tarefas",
"workspace.onboarding.flow.learnYourTeam.progress.review": "Lendo dados da equipe a partir dos aplicativos conectados",
"workspace.onboarding.flow.learnYourTeam.title": "Conheça sua equipe",
- "workspace.onboarding.flow.messenger.description": "Uma vez instalado para a equipe, os membros podem mencionar @{{name}} no grupo para delegar tarefas — ninguém precisa vinculá-lo individualmente.",
- "workspace.onboarding.flow.messenger.highlight": "e eu posso ajudar onde todos já estão.",
- "workspace.onboarding.flow.messenger.more": "Usando seu próprio bot no Feishu, QQ, LINE ou outro? Configure-o mais tarde em Ajan → Canais.",
- "workspace.onboarding.flow.messenger.quote": "Adicione-me ao grupo da sua equipe,",
- "workspace.onboarding.flow.messenger.title": "Traga o assistente para o chat da sua equipe",
"workspace.onboarding.flow.starterTasks.addFailed": "Não foi possível adicionar as tarefas. Por favor, tente novamente.",
"workspace.onboarding.flow.starterTasks.description": "Delegue essas tarefas ao assistente da equipe e veja-o trabalhar nelas no espaço de trabalho.",
"workspace.onboarding.flow.starterTasks.empty": "Ainda não há tarefas sugeridas. Você pode concluir a configuração agora.",
diff --git a/locales/ru-RU/setting.json b/locales/ru-RU/setting.json
index 2b712ef5b5f..e239d98157d 100644
--- a/locales/ru-RU/setting.json
+++ b/locales/ru-RU/setting.json
@@ -3122,11 +3122,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "Создание профиля команды и идей для первых задач",
"workspace.onboarding.flow.learnYourTeam.progress.review": "Чтение данных команды из подключенных приложений",
"workspace.onboarding.flow.learnYourTeam.title": "Узнайте свою команду",
- "workspace.onboarding.flow.messenger.description": "После установки для команды участники могут упоминать @{{name}} в группе, чтобы передать задачи — никому не нужно подключать его индивидуально.",
- "workspace.onboarding.flow.messenger.highlight": "и я могу помочь там, где уже находятся все.",
- "workspace.onboarding.flow.messenger.more": "Используете собственного бота на Feishu, QQ, LINE или другом сервисе? Настройте его позже в Агенты → Каналы.",
- "workspace.onboarding.flow.messenger.quote": "Добавьте меня в групповой чат вашей команды,",
- "workspace.onboarding.flow.messenger.title": "Добавьте ассистента в чат вашей команды",
"workspace.onboarding.flow.starterTasks.addFailed": "Не удалось добавить задачи. Пожалуйста, попробуйте снова.",
"workspace.onboarding.flow.starterTasks.description": "Передайте эти задачи командному ассистенту и наблюдайте, как он выполняет их в рабочем пространстве.",
"workspace.onboarding.flow.starterTasks.empty": "Пока нет предложенных задач. Вы можете завершить настройку сейчас.",
diff --git a/locales/tr-TR/setting.json b/locales/tr-TR/setting.json
index 0b06867f483..c93432de968 100644
--- a/locales/tr-TR/setting.json
+++ b/locales/tr-TR/setting.json
@@ -3122,11 +3122,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "Ekip profili ve ilk görev fikirlerini yazıyor",
"workspace.onboarding.flow.learnYourTeam.progress.review": "Bağlı uygulamalardan ekip verilerini okuyor",
"workspace.onboarding.flow.learnYourTeam.title": "Ekibinizi tanıyın",
- "workspace.onboarding.flow.messenger.description": "Ekip için kurulduktan sonra, üyeler grupta @{{name}} ile işleri devredebilir — kimsenin bunu bireysel olarak bağlamasına gerek yok.",
- "workspace.onboarding.flow.messenger.highlight": "ve herkesin zaten olduğu yerde yardımcı olabilirim.",
- "workspace.onboarding.flow.messenger.more": "Feishu, QQ, LINE veya başka bir yerde kendi botunuzu mu kullanıyorsunuz? Daha sonra Ajan → Kanallar bölümünden ayarlayın.",
- "workspace.onboarding.flow.messenger.quote": "Beni ekip grubunuza ekleyin,",
- "workspace.onboarding.flow.messenger.title": "Asistanı ekibinizin sohbetine getirin",
"workspace.onboarding.flow.starterTasks.addFailed": "Görevler eklenemedi. Lütfen tekrar deneyin.",
"workspace.onboarding.flow.starterTasks.description": "Bu görevleri ekip asistanına devredin ve çalışma alanında nasıl ilerlediğini izleyin.",
"workspace.onboarding.flow.starterTasks.empty": "Henüz önerilen görev yok. Şimdi kurulumu tamamlayabilirsiniz.",
diff --git a/locales/vi-VN/setting.json b/locales/vi-VN/setting.json
index cccf96a3451..8ae2527892d 100644
--- a/locales/vi-VN/setting.json
+++ b/locales/vi-VN/setting.json
@@ -3122,11 +3122,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "Viết hồ sơ nhóm và ý tưởng nhiệm vụ đầu tiên",
"workspace.onboarding.flow.learnYourTeam.progress.review": "Đọc dữ liệu nhóm từ các ứng dụng đã kết nối",
"workspace.onboarding.flow.learnYourTeam.title": "Tìm hiểu nhóm của bạn",
- "workspace.onboarding.flow.messenger.description": "Khi được cài đặt cho nhóm, các thành viên có thể @{{name}} trong nhóm để giao việc — không ai phải liên kết nó riêng lẻ.",
- "workspace.onboarding.flow.messenger.highlight": "và tôi có thể giúp ở nơi mọi người đã có mặt.",
- "workspace.onboarding.flow.messenger.more": "Sử dụng bot riêng của bạn trên Feishu, QQ, LINE hoặc nơi khác? Thiết lập sau trong Ajan → Kênh.",
- "workspace.onboarding.flow.messenger.quote": "Thêm tôi vào nhóm của bạn,",
- "workspace.onboarding.flow.messenger.title": "Đưa trợ lý vào cuộc trò chuyện nhóm của bạn",
"workspace.onboarding.flow.starterTasks.addFailed": "Không thể thêm các nhiệm vụ. Vui lòng thử lại.",
"workspace.onboarding.flow.starterTasks.description": "Giao các nhiệm vụ này cho trợ lý nhóm và xem nó làm việc qua chúng trong không gian làm việc.",
"workspace.onboarding.flow.starterTasks.empty": "Chưa có nhiệm vụ được đề xuất. Bạn có thể hoàn thành thiết lập ngay bây giờ.",
diff --git a/locales/zh-CN/agent.json b/locales/zh-CN/agent.json
index f96bf501220..a0875e62999 100644
--- a/locales/zh-CN/agent.json
+++ b/locales/zh-CN/agent.json
@@ -35,6 +35,7 @@
"channel.concurrencyQueue": "队列",
"channel.concurrencyQueueHint": "逐条处理消息",
"channel.connectFailed": "Bot 连接失败",
+ "channel.connectFailedHint": "请检查凭证和平台设置,然后重新保存以重连。",
"channel.connectQueued": "机器人连接已排队。即将启动。",
"channel.connectStarting": "机器人正在启动。请稍候。",
"channel.connectSuccess": "Bot 连接成功",
@@ -237,9 +238,12 @@
"channel.removeChannel": "移除频道",
"channel.removeFailed": "移除频道失败",
"channel.removed": "频道已移除",
+ "channel.resultDetail.hide": "收起详情",
+ "channel.resultDetail.show": "查看详情",
"channel.runtimeDisconnected": "机器人已断开连接",
"channel.save": "保存配置",
"channel.saveFailed": "保存配置失败",
+ "channel.saveFailedHint": "请检查上面的配置项后重试。",
"channel.saveFirstWarning": "请先保存配置",
"channel.saved": "配置保存成功",
"channel.secretToken": "Webhook 密钥",
@@ -272,6 +276,7 @@
"channel.telegram.description": "将助手连接到 Telegram,支持私聊和群聊。",
"channel.testConnection": "测试连接",
"channel.testFailed": "连接测试失败",
+ "channel.testFailedHint": "请检查凭证后重试。",
"channel.testSuccess": "连接测试通过",
"channel.updateFailed": "更新状态失败",
"channel.userId": "你的平台用户 ID",
diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.json
index fad72da3f48..913a01e2e5e 100644
--- a/locales/zh-CN/setting.json
+++ b/locales/zh-CN/setting.json
@@ -3111,10 +3111,21 @@
"workspace.newWorkspace": "新工作区",
"workspace.onboarding.finish": "完成",
"workspace.onboarding.flow.assistant.hint": "💡 这是全队共用的助手,成员在对话和群聊里都能 @ 它",
+ "workspace.onboarding.flow.channels.configTitle": "接入 {{platform}}",
+ "workspace.onboarding.flow.channels.description": "给 {{name}} 接入一个团队自己的机器人,群里的成员 @{{name}} 就能派活,不需要每人单独绑定。",
+ "workspace.onboarding.flow.channels.highlight": "大家 @ 我就能派活。",
+ "workspace.onboarding.flow.channels.more": "之后可以随时在「Agent → 渠道」里修改。",
+ "workspace.onboarding.flow.channels.quote": "把我接进团队的群聊,",
+ "workspace.onboarding.flow.channels.title": "把助手接入团队的聊天群",
"workspace.onboarding.flow.connectApps.description": "连接团队在用的应用,助手会据此了解团队的项目和分工。授权对整个 Workspace 生效。",
"workspace.onboarding.flow.connectApps.more": "更多应用可以随时在「设置 → 连接器」中接入。",
"workspace.onboarding.flow.connectApps.skip": "先跳过,稍后连接",
"workspace.onboarding.flow.connectApps.title": "接入团队的工作应用",
+ "workspace.onboarding.flow.devices.connect": "接入设备",
+ "workspace.onboarding.flow.devices.count": "{{count}} 台设备,{{online}} 台在线",
+ "workspace.onboarding.flow.devices.empty": "还没有团队设备。在团队的电脑上安装桌面端或运行 lh connect 即可接入。",
+ "workspace.onboarding.flow.devices.subtitle": "把团队的电脑接入 Workspace,助手就能在上面使用 Claude Code、Codex 等本地 Agent。",
+ "workspace.onboarding.flow.devices.title": "接入团队设备",
"workspace.onboarding.flow.invite.highlight": "我就能开始帮大家干活。",
"workspace.onboarding.flow.invite.invalidEmails": "邮箱格式不正确:{{emails}}",
"workspace.onboarding.flow.invite.quote": "把队友拉进来,",
@@ -3128,11 +3139,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "生成团队画像和第一批任务建议",
"workspace.onboarding.flow.learnYourTeam.progress.review": "读取已连接应用里的团队数据",
"workspace.onboarding.flow.learnYourTeam.title": "了解你的团队",
- "workspace.onboarding.flow.messenger.description": "安装到团队后,成员在群里 @{{name}} 就能派活,不需要每人单独绑定。",
- "workspace.onboarding.flow.messenger.highlight": "在大家已经在的地方帮忙。",
- "workspace.onboarding.flow.messenger.more": "团队用飞书、QQ、LINE 等自建 Bot?可以稍后在「Agent → 渠道」里配置。",
- "workspace.onboarding.flow.messenger.quote": "把我加到团队群里,我就能",
- "workspace.onboarding.flow.messenger.title": "把助手带进团队的聊天工具",
"workspace.onboarding.flow.starterTasks.addFailed": "添加任务失败,请重试",
"workspace.onboarding.flow.starterTasks.description": "把这些任务交给团队助手,在 Workspace 里就能看到它逐项推进。",
"workspace.onboarding.flow.starterTasks.empty": "暂时没有推荐的任务,可以直接完成设置。",
diff --git a/locales/zh-TW/setting.json b/locales/zh-TW/setting.json
index e1785aab714..c16c0a0dd06 100644
--- a/locales/zh-TW/setting.json
+++ b/locales/zh-TW/setting.json
@@ -3122,11 +3122,6 @@
"workspace.onboarding.flow.learnYourTeam.progress.explore": "撰寫團隊檔案和第一批任務建議",
"workspace.onboarding.flow.learnYourTeam.progress.review": "從已連接的應用程式中讀取團隊數據",
"workspace.onboarding.flow.learnYourTeam.title": "了解您的團隊",
- "workspace.onboarding.flow.messenger.description": "一旦為團隊安裝,成員可以在群組中 @{{name}} 來交接工作——無需個別連接。",
- "workspace.onboarding.flow.messenger.highlight": "然後我可以在每個人所在的位置提供幫助。",
- "workspace.onboarding.flow.messenger.more": "使用您自己的 Feishu、QQ、LINE 或其他平台的機器人?稍後在 Ajan → 頻道 中設置。",
- "workspace.onboarding.flow.messenger.quote": "將我添加到您的團隊群組,",
- "workspace.onboarding.flow.messenger.title": "將助理帶入您的團隊聊天",
"workspace.onboarding.flow.starterTasks.addFailed": "無法添加任務。請再試一次。",
"workspace.onboarding.flow.starterTasks.description": "將這些任務交給團隊助理,並在工作區中觀察其完成。",
"workspace.onboarding.flow.starterTasks.empty": "尚無建議的任務。您可以現在完成設置。",
diff --git a/packages/locales/src/default/agent.ts b/packages/locales/src/default/agent.ts
index 0c8a00160c6..8fb8360faae 100644
--- a/packages/locales/src/default/agent.ts
+++ b/packages/locales/src/default/agent.ts
@@ -232,6 +232,12 @@ export default {
'channel.save': 'Save Configuration',
'channel.setupGuide': 'Setup Guide',
'channel.saveFailed': 'Failed to save configuration',
+ 'channel.saveFailedHint': 'Check the fields above and try again.',
+ 'channel.connectFailedHint':
+ 'Check the credentials and platform settings, then save again to reconnect.',
+ 'channel.testFailedHint': 'Check the credentials and try again.',
+ 'channel.resultDetail.show': 'Show details',
+ 'channel.resultDetail.hide': 'Hide details',
'channel.saveFirstWarning': 'Please save configuration first',
'channel.saved': 'Configuration saved successfully',
'channel.secretToken': 'Webhook Secret Token',
diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.ts
index 96b473f285e..dffd6aabe12 100644
--- a/packages/locales/src/default/setting.ts
+++ b/packages/locales/src/default/setting.ts
@@ -3581,13 +3581,6 @@ When I am ___, I need ___
'workspace.onboarding.flow.invite.send_other': 'Invite {{count}} members',
'workspace.onboarding.flow.invite.skip': 'Skip for now, invite later',
'workspace.onboarding.flow.invite.invalidEmails': 'Invalid email address: {{emails}}',
- 'workspace.onboarding.flow.messenger.title': "Bring the assistant into your team's chat",
- 'workspace.onboarding.flow.messenger.quote': 'Add me to your team group,',
- 'workspace.onboarding.flow.messenger.highlight': 'and I can help where everyone already is.',
- 'workspace.onboarding.flow.messenger.description':
- 'Once installed for the team, members can @{{name}} in the group to hand off work — nobody has to link it individually.',
- 'workspace.onboarding.flow.messenger.more':
- 'Using your own bot on Feishu, QQ, LINE or elsewhere? Set it up later in Agent → Channels.',
'workspace.onboarding.flow.starterTasks.title': "Your team's first tasks",
'workspace.onboarding.flow.starterTasks.description':
'Hand these tasks to the team assistant and watch it work through them in the workspace.',
@@ -3596,6 +3589,20 @@ When I am ___, I need ___
'workspace.onboarding.flow.starterTasks.empty':
'No suggested tasks yet. You can finish setup now.',
'workspace.onboarding.flow.starterTasks.addFailed': "Couldn't add the tasks. Please try again.",
+ 'workspace.onboarding.flow.channels.title': "Bring the assistant into your team's chats",
+ 'workspace.onboarding.flow.channels.description':
+ 'Connect a bot your team owns to {{name}}. Everyone in the group can @{{name}} to hand off work — nobody has to link an account.',
+ 'workspace.onboarding.flow.channels.quote': "Add me to your team's group chats,",
+ 'workspace.onboarding.flow.channels.highlight': 'and anyone can hand me work.',
+ 'workspace.onboarding.flow.channels.more': 'You can change channels anytime in Agent → Channels.',
+ 'workspace.onboarding.flow.channels.configTitle': 'Connect {{platform}}',
+ 'workspace.onboarding.flow.devices.title': 'Connect team devices',
+ 'workspace.onboarding.flow.devices.subtitle':
+ 'Enroll the team’s computers so the assistant can use Claude Code, Codex and other local agents on them.',
+ 'workspace.onboarding.flow.devices.connect': 'Connect device',
+ 'workspace.onboarding.flow.devices.count': '{{online}} of {{count}} online',
+ 'workspace.onboarding.flow.devices.empty':
+ 'No team devices yet. Install the desktop app or run lh connect on a team computer to add one.',
'workspace.onboarding.step4.heading': '{{name}} is ready!',
'workspace.onboarding.step4.subtitle':
'Your workspace is set up. Jump in and start collaborating with your team.',
diff --git a/src/components/Skeleton/AgentChannel.tsx b/src/components/Skeleton/AgentChannel.tsx
index a94c2f54417..132d2f036b6 100644
--- a/src/components/Skeleton/AgentChannel.tsx
+++ b/src/components/Skeleton/AgentChannel.tsx
@@ -60,7 +60,7 @@ const styles = createStaticStyles(({ css }) => ({
}));
/**
- * Body of the agent channel list (`routes/(main)/agent/channel/list.tsx`):
+ * Body of the agent channel list (`features/AgentChannel/PlatformGrid.tsx`):
* 24px section padding around a 1024px column, the 24px/600 h1 with its inline
* 28px agent avatar, then the 3/2/1-column grid of outlined platform cards
* (24px icon + bold name, two 12px description lines). Also the page's own
@@ -95,7 +95,7 @@ export const AgentChannelListBodySkeleton = () => (
);
/**
- * Body of a platform detail (`routes/(main)/agent/channel/detail`): the 1024px
+ * Body of a platform detail (`features/AgentChannel/PlatformDetail`): the 1024px
* outlined credential block — field rows with a 20px icon + label on the left
* and a half-width input on the right, then the collapsed advanced-settings
* group — followed by the right-aligned save button of the footer.
diff --git a/src/features/AgentChannel/PlatformCard.tsx b/src/features/AgentChannel/PlatformCard.tsx
new file mode 100644
index 00000000000..50ba8668326
--- /dev/null
+++ b/src/features/AgentChannel/PlatformCard.tsx
@@ -0,0 +1,212 @@
+'use client';
+
+import { Block, Flexbox } from '@lobehub/ui';
+import { Tag, Text } from '@lobehub/ui/base-ui';
+import { createStaticStyles, useTheme } from 'antd-style';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { BOT_RUNTIME_STATUSES, type BotRuntimeStatus } from '@/types/botRuntimeStatus';
+
+import { type ChannelPlatformDefinition, getPlatformIcon } from './const';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ card: css`
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ align-items: stretch;
+
+ min-height: 104px;
+ padding-block: 12px;
+ padding-inline: 12px;
+
+ transition:
+ transform 0.18s,
+ box-shadow 0.18s,
+ border-color 0.18s;
+
+ &:hover {
+ transform: translateY(-1px);
+ box-shadow: 0 4px 12px rgb(0 0 0 / 6%);
+ }
+ `,
+ description: css`
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 2;
+
+ line-height: 1.5;
+ `,
+ statusDot: css`
+ flex-shrink: 0;
+
+ width: 8px;
+ height: 8px;
+ border-radius: 50%;
+
+ background: ${cssVar.colorSuccess};
+ box-shadow: 0 0 0 1px ${cssVar.colorBgContainer};
+ `,
+ titleRow: css`
+ width: 100%;
+ min-width: 0;
+ `,
+ trailing: css`
+ flex-shrink: 0;
+ `,
+}));
+
+interface PlatformCardProps {
+ onSelect: (id: string) => void;
+ platform: ChannelPlatformDefinition;
+ /** Live runtime status of this platform's bot, when one is configured. */
+ status?: BotRuntimeStatus;
+}
+
+/** One channel platform: icon, name, plan / coming-soon badges, runtime status and description. */
+const PlatformCard = memo<PlatformCardProps>(({ onSelect, platform, status }) => {
+ const { t } = useTranslation(['agent', 'common']);
+ const theme = useTheme();
+
+ const getPlatformDescription = (id: string, name: string) => {
+ switch (id) {
+ case 'discord': {
+ return t('channel.platform.discord.description');
+ }
+ case 'feishu': {
+ return t('channel.platform.feishu.description');
+ }
+ case 'imessage': {
+ return t('channel.platform.imessage.description');
+ }
+ case 'lark': {
+ return t('channel.platform.lark.description');
+ }
+ case 'line': {
+ return t('channel.platform.line.description');
+ }
+ case 'qq': {
+ return t('channel.platform.qq.description');
+ }
+ case 'slack': {
+ return t('channel.platform.slack.description');
+ }
+ case 'telegram': {
+ return t('channel.platform.telegram.description');
+ }
+ case 'wechat': {
+ return t('channel.platform.wechat.description');
+ }
+ case 'whatsapp': {
+ return t('channel.platform.whatsapp.description');
+ }
+ default: {
+ return t('channel.platform.default.description', { name });
+ }
+ }
+ };
+
+ const getStatusColor = (status?: BotRuntimeStatus) => {
+ switch (status) {
+ case BOT_RUNTIME_STATUSES.connected: {
+ return theme.colorSuccess;
+ }
+ case BOT_RUNTIME_STATUSES.failed: {
+ return theme.colorError;
+ }
+ case BOT_RUNTIME_STATUSES.queued:
+ case BOT_RUNTIME_STATUSES.starting: {
+ return theme.colorInfo;
+ }
+ case BOT_RUNTIME_STATUSES.dormant: {
+ return theme.colorWarning;
+ }
+ case BOT_RUNTIME_STATUSES.disconnected: {
+ return theme.colorTextQuaternary;
+ }
+ default: {
+ return undefined;
+ }
+ }
+ };
+
+ const getStatusTitle = (status?: BotRuntimeStatus) => {
+ switch (status) {
+ case BOT_RUNTIME_STATUSES.connected: {
+ return t('channel.connectSuccess');
+ }
+ case BOT_RUNTIME_STATUSES.failed: {
+ return t('channel.connectFailed');
+ }
+ case BOT_RUNTIME_STATUSES.queued: {
+ return t('channel.connectQueued');
+ }
+ case BOT_RUNTIME_STATUSES.starting: {
+ return t('channel.connectStarting');
+ }
+ case BOT_RUNTIME_STATUSES.dormant: {
+ return t('channel.statusDormant');
+ }
+ case BOT_RUNTIME_STATUSES.disconnected: {
+ return t('channel.runtimeDisconnected');
+ }
+ default: {
+ return undefined;
+ }
+ }
+ };
+
+ const PlatformIcon = getPlatformIcon(platform.name);
+ const ColorIcon =
+ PlatformIcon && 'Color' in PlatformIcon ? (PlatformIcon as any).Color : PlatformIcon;
+ const runtimeStatus = platform.comingSoon ? undefined : status;
+ const statusColor = getStatusColor(runtimeStatus);
+ const statusTitle = getStatusTitle(runtimeStatus);
+ const description = getPlatformDescription(platform.id, platform.name);
+
+ return (
+ <Block
+ clickable
+ className={styles.card}
+ variant={'outlined'}
+ onClick={() => onSelect(platform.id)}
+ >
+ <Flexbox horizontal align={'center'} className={styles.titleRow} gap={8}>
+ {ColorIcon && <ColorIcon size={24} />}
+ <Text ellipsis style={{ flex: 1, minWidth: 0 }} weight={600}>
+ {platform.name}
+ </Text>
+ <Flexbox horizontal align={'center'} className={styles.trailing} gap={4}>
+ {platform.comingSoon && (
+ <Tag size={'small'} style={{ marginInlineEnd: 0 }}>
+ {t('channel.comingSoon')}
+ </Tag>
+ )}
+ {platform.access?.requiredPlan === 'paid' && (
+ <Tag color="gold" size={'small'} style={{ marginInlineEnd: 0 }}>
+ {platform.access.rolloutMode === 'notice'
+ ? t('channel.paidFeature.noticeBadge')
+ : t('channel.paidFeature.badge')}
+ </Tag>
+ )}
+ {runtimeStatus && (
+ <div
+ className={styles.statusDot}
+ style={{ background: statusColor }}
+ title={statusTitle}
+ />
+ )}
+ </Flexbox>
+ </Flexbox>
+ <Text className={styles.description} fontSize={12} type={'secondary'}>
+ {description}
+ </Text>
+ </Block>
+ );
+});
+
+PlatformCard.displayName = 'PlatformCard';
+
+export default PlatformCard;
diff --git a/src/routes/(main)/agent/channel/detail/Body.tsx b/src/features/AgentChannel/PlatformDetail/Body.tsx
similarity index 100%
rename from src/routes/(main)/agent/channel/detail/Body.tsx
rename to src/features/AgentChannel/PlatformDetail/Body.tsx
diff --git a/src/routes/(main)/agent/channel/detail/ComingSoon.tsx b/src/features/AgentChannel/PlatformDetail/ComingSoon.tsx
similarity index 100%
rename from src/routes/(main)/agent/channel/detail/ComingSoon.tsx
rename to src/features/AgentChannel/PlatformDetail/ComingSoon.tsx
diff --git a/src/routes/(main)/agent/channel/detail/Footer.tsx b/src/features/AgentChannel/PlatformDetail/Footer.tsx
similarity index 86%
rename from src/routes/(main)/agent/channel/detail/Footer.tsx
rename to src/features/AgentChannel/PlatformDetail/Footer.tsx
index 469c3929dda..969ba68f04e 100644
--- a/src/routes/(main)/agent/channel/detail/Footer.tsx
+++ b/src/features/AgentChannel/PlatformDetail/Footer.tsx
@@ -55,15 +55,21 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
}));
/**
- * Error body of a result banner: the readable hint first, the raw platform
- * message below it in a muted tone so it stays available for diagnosis.
+ * Error body of a result banner: one readable sentence, with the raw platform
+ * message folded behind a "show details" toggle so it stays available for
+ * diagnosis without being dumped into the banner.
*/
-const ResultDetail = memo<{ detail?: string; hint?: string }>(({ detail, hint }) => {
- if (!hint) return <>{detail}</>;
+const ResultDetail = memo<{ detail?: string; hint: string }>(({ detail, hint }) => {
+ const { t } = useTranslation('agent');
+ const [open, setOpen] = useState(false);
+ if (!detail || detail === hint) return <>{hint}</>;
return (
- <Flexbox gap={4}>
+ <Flexbox align={'flex-start'} gap={4}>
<span>{hint}</span>
- {detail && <span className={styles.resultDetail}>{detail}</span>}
+ <Button size={'small'} type={'text'} onClick={() => setOpen((value) => !value)}>
+ {open ? t('channel.resultDetail.hide') : t('channel.resultDetail.show')}
+ </Button>
+ {open && <span className={styles.resultDetail}>{detail}</span>}
</Flexbox>
);
});
@@ -198,9 +204,16 @@ const Footer = memo<FooterProps>(
<Alert
closable
showIcon
- description={saveResult.type === 'error' ? saveResult.errorDetail : undefined}
title={saveResult.type === 'success' ? t('channel.saved') : t('channel.saveFailed')}
type={saveResult.type}
+ description={
+ saveResult.type === 'error' ? (
+ <ResultDetail
+ detail={saveResult.errorDetail}
+ hint={saveResult.hint || t('channel.saveFailedHint')}
+ />
+ ) : undefined
+ }
/>
)}
@@ -208,8 +221,15 @@ const Footer = memo<FooterProps>(
<Alert
closable
showIcon
- description={connectResult.type === 'error' ? connectResult.errorDetail : undefined}
type={connectResult.type}
+ description={
+ connectResult.type === 'error' ? (
+ <ResultDetail
+ detail={connectResult.errorDetail}
+ hint={connectResult.hint || t('channel.connectFailedHint')}
+ />
+ ) : undefined
+ }
title={
connectResult.title ||
(connectResult.type === 'success'
@@ -226,7 +246,10 @@ const Footer = memo<FooterProps>(
type={testResult.type}
description={
testResult.type === 'error' ? (
- <ResultDetail detail={testResult.errorDetail} hint={testResult.hint} />
+ <ResultDetail
+ detail={testResult.errorDetail}
+ hint={testResult.hint || t('channel.testFailedHint')}
+ />
) : undefined
}
title={
diff --git a/src/routes/(main)/agent/channel/detail/actionResults.test.ts b/src/features/AgentChannel/PlatformDetail/actionResults.test.ts
similarity index 100%
rename from src/routes/(main)/agent/channel/detail/actionResults.test.ts
rename to src/features/AgentChannel/PlatformDetail/actionResults.test.ts
diff --git a/src/routes/(main)/agent/channel/detail/actionResults.ts b/src/features/AgentChannel/PlatformDetail/actionResults.ts
similarity index 100%
rename from src/routes/(main)/agent/channel/detail/actionResults.ts
rename to src/features/AgentChannel/PlatformDetail/actionResults.ts
diff --git a/src/routes/(main)/agent/channel/detail/buildRules.test.ts b/src/features/AgentChannel/PlatformDetail/buildRules.test.ts
similarity index 100%
rename from src/routes/(main)/agent/channel/detail/buildRules.test.ts
rename to src/features/AgentChannel/PlatformDetail/buildRules.test.ts
diff --git a/src/routes/(main)/agent/channel/detail/formState.test.ts b/src/features/AgentChannel/PlatformDetail/formState.test.ts
similarity index 100%
rename from src/routes/(main)/agent/channel/detail/formState.test.ts
rename to src/features/AgentChannel/PlatformDetail/formState.test.ts
diff --git a/src/routes/(main)/agent/channel/detail/formState.ts b/src/features/AgentChannel/PlatformDetail/formState.ts
similarity index 100%
rename from src/routes/(main)/agent/channel/detail/formState.ts
rename to src/features/AgentChannel/PlatformDetail/formState.ts
diff --git a/src/routes/(main)/agent/channel/detail/index.tsx b/src/features/AgentChannel/PlatformDetail/index.tsx
similarity index 85%
rename from src/routes/(main)/agent/channel/detail/index.tsx
rename to src/features/AgentChannel/PlatformDetail/index.tsx
index e3e275477e0..6c2780a69dc 100644
--- a/src/routes/(main)/agent/channel/detail/index.tsx
+++ b/src/features/AgentChannel/PlatformDetail/index.tsx
@@ -11,14 +11,12 @@ import { useTranslation } from 'react-i18next';
import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { usePermission } from '@/hooks/usePermission';
+import { useClientDataSWR } from '@/libs/swr';
import type { SerializedPlatformDefinition } from '@/server/services/bot/platforms/types';
import { agentBotProviderService } from '@/services/agentBotProvider';
import { useAgentStore } from '@/store/agent';
+import { BOT_RUNTIME_STATUSES, type BotRuntimeStatusSnapshot } from '@/types/botRuntimeStatus';
-import {
- BOT_RUNTIME_STATUSES,
- type BotRuntimeStatusSnapshot,
-} from '../../../../../types/botRuntimeStatus';
import { keepPendingConnectResult, toTestResult } from './actionResults';
import Body from './Body';
import Footer from './Footer';
@@ -132,10 +130,14 @@ const PlatformDetail = memo<PlatformDetailProps>(
const [saving, setSaving] = useState(false);
const [connecting, setConnecting] = useState(false);
const [saveResult, setSaveResult] = useState<TestResult>();
- const [connectResult, setConnectResult] = useState<TestResult>();
+ // Connect banner: a notice from an explicit connect action wins; otherwise
+ // the banner is derived from the bot's live runtime status. Saving or testing
+ // hides a settled runtime banner until the next connect.
+ const [connectNotice, setConnectNotice] = useState<TestResult>();
+ const [runtimeHidden, setRuntimeHidden] = useState(false);
+ const [showConnected, setShowConnected] = useState(false);
const [testing, setTesting] = useState(false);
const [testResult, setTestResult] = useState<TestResult>();
- const connectPollingTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
// Platform-specific extras (e.g. iMessage's BlueBubbles bridge) register a
// side-effect here so it runs as part of the single "Save Configuration"
@@ -150,12 +152,6 @@ const PlatformDetail = memo<PlatformDetailProps>(
[],
);
- const stopConnectPolling = useCallback(() => {
- if (!connectPollingTimerRef.current) return;
- clearTimeout(connectPollingTimerRef.current);
- connectPollingTimerRef.current = null;
- }, []);
-
const mapRuntimeStatusToResult = useCallback(
(
runtimeStatus: BotRuntimeStatusSnapshot,
@@ -168,11 +164,11 @@ const PlatformDetail = memo<PlatformDetailProps>(
}
case BOT_RUNTIME_STATUSES.failed: {
return {
- errorDetail: runtimeStatus.errorCode
- ? t(`channel.connectionError.${runtimeStatus.errorCode}`, {
- defaultValue: runtimeStatus.errorMessage || t('channel.connectFailed'),
- })
- : runtimeStatus.errorMessage,
+ errorDetail: runtimeStatus.errorMessage,
+ hint: runtimeStatus.errorCode
+ ? t(`channel.connectionError.${runtimeStatus.errorCode}`, { defaultValue: '' }) ||
+ undefined
+ : undefined,
title: t('channel.connectFailed'),
type: 'error',
};
@@ -191,60 +187,57 @@ const PlatformDetail = memo<PlatformDetailProps>(
[t],
);
- const syncRuntimeStatus = useCallback(
- async (
- params: {
- applicationId: string;
- platform: string;
+ // Live runtime status of the saved bot, polled while it is still starting.
+ const { data: runtimeSnapshot, mutate: refreshRuntimeStatus } =
+ useClientDataSWR<BotRuntimeStatusSnapshot>(
+ currentConfig?.enabled
+ ? ['agentChannel/runtimeStatus', currentConfig.platform, currentConfig.applicationId]
+ : null,
+ () =>
+ agentBotProviderService.getRuntimeStatus({
+ applicationId: currentConfig!.applicationId,
+ platform: currentConfig!.platform,
+ }),
+ {
+ refreshInterval: (snapshot) =>
+ snapshot?.status === BOT_RUNTIME_STATUSES.queued ||
+ snapshot?.status === BOT_RUNTIME_STATUSES.starting
+ ? 2000
+ : 0,
+ revalidateOnFocus: false,
},
- options?: { poll?: boolean; showConnected?: boolean },
- ) => {
- stopConnectPolling();
-
- const snapshot = await agentBotProviderService.getRuntimeStatus(params);
- const nextResult = mapRuntimeStatusToResult(snapshot, {
- showConnected: options?.showConnected,
- });
-
- if (nextResult) {
- setConnectResult(nextResult);
- } else if (snapshot.status === BOT_RUNTIME_STATUSES.disconnected) {
- setConnectResult(undefined);
- }
+ );
- if (
- options?.poll &&
- (snapshot.status === BOT_RUNTIME_STATUSES.queued ||
- snapshot.status === BOT_RUNTIME_STATUSES.starting)
- ) {
- connectPollingTimerRef.current = setTimeout(() => {
- void syncRuntimeStatus(params, options);
- }, 2000);
- }
- },
- [mapRuntimeStatusToResult, stopConnectPolling],
+ const runtimeResult = useMemo(
+ () =>
+ currentConfig?.enabled && runtimeSnapshot
+ ? mapRuntimeStatusToResult(runtimeSnapshot, { showConnected })
+ : undefined,
+ [currentConfig?.enabled, mapRuntimeStatusToResult, runtimeSnapshot, showConnected],
);
+ const connectResult = connectNotice ?? (runtimeHidden ? undefined : runtimeResult);
const connectCurrentBot = useCallback(
async (applicationId: string) => {
setConnecting(true);
try {
const { status } = await connectBot({ agentId, applicationId, platform: platformDef.id });
- setConnectResult({
+ setConnectNotice({
title: status === 'queued' ? t('channel.connectQueued') : t('channel.connectStarting'),
type: 'info',
});
- await syncRuntimeStatus(
- { applicationId, platform: platformDef.id },
- { poll: true, showConnected: true },
- );
+ setShowConnected(true);
+ setRuntimeHidden(false);
+ await refreshRuntimeStatus();
+ // The live status takes over from here (and keeps polling while starting).
+ setConnectNotice(undefined);
} catch (e: any) {
- setConnectResult({ errorDetail: e?.message || String(e), type: 'error' });
+ setConnectNotice({ errorDetail: e?.message || String(e), type: 'error' });
} finally {
setConnecting(false);
}
},
- [agentId, connectBot, platformDef.id, syncRuntimeStatus, t],
+ [agentId, connectBot, platformDef.id, refreshRuntimeStatus, t],
);
// Reset form and status when switching platforms. Must NOT depend on
@@ -252,10 +245,11 @@ const PlatformDetail = memo<PlatformDetailProps>(
// in-progress form edits and cancel the connect-status polling loop.
useEffect(() => {
setSaveResult(undefined);
- setConnectResult(undefined);
+ setConnectNotice(undefined);
+ setRuntimeHidden(false);
+ setShowConnected(false);
setTestResult(undefined);
- stopConnectPolling();
- }, [platformDef.id, stopConnectPolling]);
+ }, [platformDef.id]);
// Sync form with saved config. The provider list is replica-backed, so on a
// revisit the form paints the persisted config first and the live fetch
@@ -274,26 +268,6 @@ const PlatformDetail = memo<PlatformDetailProps>(
setIsDirty(false);
}, [currentConfig, form, platformDef.schema, isDirty]);
- useEffect(() => {
- if (!currentConfig?.enabled) {
- stopConnectPolling();
- setConnectResult(undefined);
- return;
- }
-
- void syncRuntimeStatus(
- {
- applicationId: currentConfig.applicationId,
- platform: currentConfig.platform,
- },
- { poll: true, showConnected: false },
- );
-
- return () => {
- stopConnectPolling();
- };
- }, [currentConfig, stopConnectPolling, syncRuntimeStatus]);
-
const handleSave = useCallback(async () => {
if (writeDisabled) return;
@@ -304,7 +278,8 @@ const PlatformDetail = memo<PlatformDetailProps>(
setSaving(true);
setSaveResult(undefined);
- setConnectResult(undefined);
+ setConnectNotice(undefined);
+ setRuntimeHidden(true);
setTestResult(undefined);
const {
@@ -380,7 +355,8 @@ const PlatformDetail = memo<PlatformDetailProps>(
setSaving(true);
setSaveResult(undefined);
- setConnectResult(undefined);
+ setConnectNotice(undefined);
+ setRuntimeHidden(true);
setTestResult(undefined);
try {
@@ -462,7 +438,9 @@ const PlatformDetail = memo<PlatformDetailProps>(
setTesting(true);
setSaveResult(undefined);
setTestResult(undefined);
- setConnectResult(keepPendingConnectResult);
+ // An in-progress connect notice stays; a settled banner gives way to the test result.
+ setConnectNotice(keepPendingConnectResult);
+ if (connectResult?.type !== 'info') setRuntimeHidden(true);
try {
const result = await testConnection({
applicationId: currentConfig.applicationId,
@@ -481,7 +459,7 @@ const PlatformDetail = memo<PlatformDetailProps>(
} finally {
setTesting(false);
}
- }, [writeDisabled, currentConfig, platformDef.id, testConnection, t]);
+ }, [writeDisabled, currentConfig, connectResult, platformDef.id, testConnection, t]);
const handleDiscard = useCallback(() => {
form.reset(getFormValues(platformDef.schema, currentConfig));
diff --git a/src/routes/(main)/agent/channel/detail/postSaveContext.ts b/src/features/AgentChannel/PlatformDetail/postSaveContext.ts
similarity index 100%
rename from src/routes/(main)/agent/channel/detail/postSaveContext.ts
rename to src/features/AgentChannel/PlatformDetail/postSaveContext.ts
diff --git a/src/features/AgentChannel/PlatformGrid.tsx b/src/features/AgentChannel/PlatformGrid.tsx
new file mode 100644
index 00000000000..b8c91f64b0f
--- /dev/null
+++ b/src/features/AgentChannel/PlatformGrid.tsx
@@ -0,0 +1,121 @@
+'use client';
+
+import { agentDisplayName } from '@lobechat/types';
+import { Avatar } from '@lobehub/ui/base-ui';
+import { createStaticStyles, responsive } from 'antd-style';
+import isEqual from 'fast-deep-equal';
+import { memo } from 'react';
+import { Trans, useTranslation } from 'react-i18next';
+
+import { DEFAULT_AVATAR } from '@/const/meta';
+import { useAgentStore } from '@/store/agent';
+import { agentSelectors } from '@/store/agent/selectors';
+import { type BotRuntimeStatus } from '@/types/botRuntimeStatus';
+
+import { type ChannelPlatformDefinition } from './const';
+import PlatformCard from './PlatformCard';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ grid: css`
+ display: grid;
+ grid-template-columns: repeat(3, minmax(0, 1fr));
+ gap: 12px;
+
+ width: 100%;
+ min-width: 0;
+
+ ${responsive.md} {
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ }
+
+ ${responsive.sm} {
+ grid-template-columns: minmax(0, 1fr);
+ }
+ `,
+ root: css`
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+
+ width: 100%;
+ padding-block: 24px;
+ padding-inline: 24px;
+ `,
+ title: css`
+ width: 100%;
+ margin-block: 0 20px;
+
+ font-size: 24px;
+ font-weight: 600;
+ line-height: 1.4;
+ color: ${cssVar.colorText};
+
+ ${responsive.sm} {
+ font-size: 20px;
+ }
+ `,
+ titleAvatar: css`
+ display: inline-flex;
+ margin-inline: 6px;
+ vertical-align: -6px;
+ `,
+ widthLimiter: css`
+ width: 100%;
+ max-width: 1024px;
+ `,
+}));
+
+interface PlatformGridProps {
+ agentId: string;
+ onSelect: (id: string) => void;
+ platforms: ChannelPlatformDefinition[];
+ runtimeStatuses: Map<string, BotRuntimeStatus>;
+}
+
+const PlatformGrid = memo<PlatformGridProps>(
+ ({ agentId, platforms, onSelect, runtimeStatuses }) => {
+ const { t } = useTranslation(['agent', 'common']);
+ const meta = useAgentStore(agentSelectors.getAgentMetaById(agentId), isEqual);
+ const agentName = agentDisplayName(meta, t('defaultSession', { ns: 'common' }));
+
+ return (
+ <section className={styles.root}>
+ <div className={styles.widthLimiter}>
+ <h1 className={styles.title}>
+ <Trans<'channel.home.title', 'agent'>
+ i18nKey={'channel.home.title'}
+ ns={'agent'}
+ values={{ name: agentName }}
+ components={{
+ avatar: (
+ <span className={styles.titleAvatar}>
+ <Avatar
+ avatar={meta.avatar || DEFAULT_AVATAR}
+ background={meta.backgroundColor}
+ shape={'square'}
+ size={28}
+ />
+ </span>
+ ),
+ }}
+ />
+ </h1>
+ <div className={styles.grid}>
+ {platforms.map((platform) => (
+ <PlatformCard
+ key={platform.id}
+ platform={platform}
+ status={runtimeStatuses.get(platform.id)}
+ onSelect={onSelect}
+ />
+ ))}
+ </div>
+ </div>
+ </section>
+ );
+ },
+);
+
+PlatformGrid.displayName = 'PlatformGrid';
+
+export default PlatformGrid;
diff --git a/src/routes/(main)/agent/channel/const.ts b/src/features/AgentChannel/const.ts
similarity index 100%
rename from src/routes/(main)/agent/channel/const.ts
rename to src/features/AgentChannel/const.ts
diff --git a/src/routes/(main)/agent/channel/platform/imessage/CredentialExtras.tsx b/src/features/AgentChannel/platform/imessage/CredentialExtras.tsx
similarity index 99%
rename from src/routes/(main)/agent/channel/platform/imessage/CredentialExtras.tsx
rename to src/features/AgentChannel/platform/imessage/CredentialExtras.tsx
index 75e751d707c..bbea7fd3336 100644
--- a/src/routes/(main)/agent/channel/platform/imessage/CredentialExtras.tsx
+++ b/src/features/AgentChannel/platform/imessage/CredentialExtras.tsx
@@ -17,7 +17,7 @@ import { imessageKeys } from '@/libs/swr/keys';
import { gatewayConnectionService } from '@/services/electron/gatewayConnection';
import { imessageBridgeService } from '@/services/electron/imessageBridge';
-import { ChannelPostSaveContext } from '../../detail/postSaveContext';
+import { ChannelPostSaveContext } from '../../PlatformDetail/postSaveContext';
const styles = createStaticStyles(({ css, cssVar }) => ({
card: css`
diff --git a/src/routes/(main)/agent/channel/platform/line/CredentialExtras.tsx b/src/features/AgentChannel/platform/line/CredentialExtras.tsx
similarity index 100%
rename from src/routes/(main)/agent/channel/platform/line/CredentialExtras.tsx
rename to src/features/AgentChannel/platform/line/CredentialExtras.tsx
diff --git a/src/routes/(main)/agent/channel/platform/registry.ts b/src/features/AgentChannel/platform/registry.ts
similarity index 100%
rename from src/routes/(main)/agent/channel/platform/registry.ts
rename to src/features/AgentChannel/platform/registry.ts
diff --git a/src/routes/(main)/agent/channel/platform/types.ts b/src/features/AgentChannel/platform/types.ts
similarity index 100%
rename from src/routes/(main)/agent/channel/platform/types.ts
rename to src/features/AgentChannel/platform/types.ts
diff --git a/src/routes/(main)/agent/channel/platform/wechat/ConnectedInfo.tsx b/src/features/AgentChannel/platform/wechat/ConnectedInfo.tsx
similarity index 100%
rename from src/routes/(main)/agent/channel/platform/wechat/ConnectedInfo.tsx
rename to src/features/AgentChannel/platform/wechat/ConnectedInfo.tsx
diff --git a/src/routes/(main)/agent/channel/platform/wechat/CredentialBody.tsx b/src/features/AgentChannel/platform/wechat/CredentialBody.tsx
similarity index 100%
rename from src/routes/(main)/agent/channel/platform/wechat/CredentialBody.tsx
rename to src/features/AgentChannel/platform/wechat/CredentialBody.tsx
diff --git a/src/routes/(main)/agent/channel/platform/wechat/QrCodeAuth.tsx b/src/features/AgentChannel/platform/wechat/QrCodeAuth.tsx
similarity index 100%
rename from src/routes/(main)/agent/channel/platform/wechat/QrCodeAuth.tsx
rename to src/features/AgentChannel/platform/wechat/QrCodeAuth.tsx
diff --git a/src/features/AgentChannel/useAgentChannels.ts b/src/features/AgentChannel/useAgentChannels.ts
new file mode 100644
index 00000000000..e1f9d35bf9f
--- /dev/null
+++ b/src/features/AgentChannel/useAgentChannels.ts
@@ -0,0 +1,102 @@
+import { useEffect, useMemo } from 'react';
+
+import { useAgentStore } from '@/store/agent';
+import { useUserStore } from '@/store/user';
+import { labPreferSelectors } from '@/store/user/selectors';
+import { BOT_RUNTIME_STATUSES, type BotRuntimeStatus } from '@/types/botRuntimeStatus';
+
+import { type ChannelPlatformDefinition, COMING_SOON_PLATFORMS } from './const';
+
+/**
+ * Channel platforms and an agent's bot providers, shared by every surface that
+ * lists an agent's channels: the platform catalog (server platforms merged with
+ * the frontend-only coming-soon entries), the agent's providers and their live
+ * runtime statuses, plus the loading / error state of both fetches.
+ */
+export const useAgentChannels = (agentId: string | undefined, canEdit: boolean) => {
+ const {
+ isLoading: platformsLoading,
+ error: platformsError,
+ mutate: mutatePlatforms,
+ } = useAgentStore((s) => s.useFetchPlatformDefinitions());
+ const {
+ isLoading: providersLoading,
+ error: providersError,
+ mutate: mutateProviders,
+ } = useAgentStore((s) => s.useFetchBotProviders(agentId));
+ // The data lives in the replica views; the hooks above only orchestrate the
+ // fetch (hydrate the persisted copy, then revalidate in the background).
+ const platforms = useAgentStore((s) => s.botPlatformDefinitions);
+ const providers = useAgentStore((s) => (agentId ? s.botProvidersMap[agentId] : undefined));
+ const triggerRefreshAllBotStatuses = useAgentStore((s) => s.triggerRefreshAllBotStatuses);
+ const enableImessage = useUserStore(labPreferSelectors.enableImessage);
+
+ // Fire-and-forget a live gateway status refresh on entry. The list renders
+ // from cached statuses immediately; SWR revalidates once Redis is updated.
+ useEffect(() => {
+ if (!agentId) return;
+ if (!canEdit) return;
+ triggerRefreshAllBotStatuses(agentId);
+ }, [agentId, canEdit, triggerRefreshAllBotStatuses]);
+
+ const isLoading = platformsLoading || providersLoading;
+ const error = platformsError ?? providersError;
+
+ // A *failed* or still-empty platform fetch leaves `platforms` undefined, so
+ // `allPlatforms` collapses to just the frontend-only `COMING_SOON_PLATFORMS`
+ // — and the surface would render a plausible coming-soon-only catalog (every
+ // real / connected channel silently dropped). So "has data" is *not* the merged
+ // length: it's whether the real fetch actually yielded platforms. Gate on the
+ // raw synced `platforms` (never the static merge).
+ //
+ // The providers fetch, though, is a replica: a *background* revalidate that
+ // fails must not blank a hydrated first frame. Once the providers have a
+ // settled value (local copy or network), a providers error is not fatal — the
+ // grid renders from that value and reconciles behind it. It only falls through
+ // to the error state when there is nothing settled for this agent either.
+ const providersSettled = providers !== undefined;
+ const hasData = (platforms?.length ?? 0) > 0 && (!providersError || providersSettled);
+
+ // Merge server-side platforms with frontend-only coming-soon entries.
+ // Coming-soon entries shadow a server-registered platform of the same id, so a
+ // platform can be registered server-side first and stay a placeholder until
+ // the frontend reveals it. iMessage additionally honors the Labs
+ // `enableImessage` preference: off keeps the placeholder, on drops it so the
+ // real platform shows.
+ const allPlatforms = useMemo<ChannelPlatformDefinition[]>(() => {
+ const comingSoon = enableImessage
+ ? COMING_SOON_PLATFORMS.filter((p) => p.id !== 'imessage')
+ : COMING_SOON_PLATFORMS;
+ const comingSoonIds = new Set(comingSoon.map((p) => p.id));
+ return [...(platforms ?? []).filter((p) => !comingSoonIds.has(p.id)), ...comingSoon];
+ }, [platforms, enableImessage]);
+
+ const platformRuntimeStatuses = useMemo(
+ () =>
+ new Map<string, BotRuntimeStatus>(
+ (providers ?? [])
+ .filter((provider) => provider.enabled)
+ .map((provider) => [
+ provider.platform,
+ ((provider as any).runtimeStatus as BotRuntimeStatus) ??
+ BOT_RUNTIME_STATUSES.disconnected,
+ ]),
+ ),
+ [providers],
+ );
+
+ return {
+ allPlatforms,
+ error,
+ hasData,
+ isLoading,
+ platformRuntimeStatuses,
+ platforms,
+ platformsLoading,
+ providers,
+ retry: () => {
+ mutatePlatforms();
+ mutateProviders();
+ },
+ };
+};
diff --git a/src/features/AgentSidebar/Topic/List/Item/index.test.tsx b/src/features/AgentSidebar/Topic/List/Item/index.test.tsx
index 8d7186b3770..83cd5d9a184 100644
--- a/src/features/AgentSidebar/Topic/List/Item/index.test.tsx
+++ b/src/features/AgentSidebar/Topic/List/Item/index.test.tsx
@@ -81,7 +81,7 @@ vi.mock('@/features/ChatInput/ControlBar/DirIcon', () => ({
vi.mock('@/business/client/hooks/useActiveWorkspaceSlug', () => ({
useActiveWorkspaceSlug: () => 'team',
}));
-vi.mock('@/routes/(main)/agent/channel/const', () => ({
+vi.mock('@/features/AgentChannel/const', () => ({
getPlatformIcon: () => null,
}));
vi.mock('@/store/agent', () => ({
diff --git a/src/features/AgentSidebar/Topic/List/Item/index.tsx b/src/features/AgentSidebar/Topic/List/Item/index.tsx
index 0130911ecb4..fe0ae2cd190 100644
--- a/src/features/AgentSidebar/Topic/List/Item/index.tsx
+++ b/src/features/AgentSidebar/Topic/List/Item/index.tsx
@@ -22,6 +22,7 @@ import { TOPIC_STATUS_VISUALS } from '@/components/ExecutionStatus';
import RingLoadingIcon from '@/components/RingLoading';
import UnreadDot from '@/components/UnreadDot';
import { isDesktop } from '@/const/version';
+import { getPlatformIcon } from '@/features/AgentChannel/const';
import { TopicMigrationIndicator } from '@/features/AgentTransferMigration';
import DirIcon from '@/features/ChatInput/ControlBar/DirIcon';
import { useHasDraft } from '@/features/ChatInput/draftStorage';
@@ -31,7 +32,6 @@ import { getProjectConversationPath } from '@/features/Projects/Layout/navigatio
import TopicCreatorAvatar, { useTopicCreator } from '@/features/TopicCreatorAvatar';
import { buildWorkspaceAwarePath } from '@/features/Workspace/workspaceAwarePath';
import { getWorkingDirectoryName } from '@/helpers/workingDirectoryPath';
-import { getPlatformIcon } from '@/routes/(main)/agent/channel/const';
import { useAgentStore } from '@/store/agent';
import { agentSelectors, builtinAgentSelectors } from '@/store/agent/selectors';
import { useChatStore } from '@/store/chat';
diff --git a/src/features/AgentTopicManager/Toolbar.tsx b/src/features/AgentTopicManager/Toolbar.tsx
index 2043c297986..c57a87c6ee4 100644
--- a/src/features/AgentTopicManager/Toolbar.tsx
+++ b/src/features/AgentTopicManager/Toolbar.tsx
@@ -24,7 +24,7 @@ import {
import { memo, type ReactNode, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
-import { getPlatformIcon } from '@/routes/(main)/agent/channel/const';
+import { getPlatformIcon } from '@/features/AgentChannel/const';
import { useChatStore } from '@/store/chat';
import { topicSelectors } from '@/store/chat/selectors';
diff --git a/src/features/AgentTopicManager/TopicCard.tsx b/src/features/AgentTopicManager/TopicCard.tsx
index 20f1b19d3d5..80d284fc719 100644
--- a/src/features/AgentTopicManager/TopicCard.tsx
+++ b/src/features/AgentTopicManager/TopicCard.tsx
@@ -9,9 +9,9 @@ import { CircleDollarSign, FolderIcon, MessageSquare, Star, Zap } from 'lucide-r
import { memo, type MouseEvent, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
+import { getPlatformIcon } from '@/features/AgentChannel/const';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { useActivityTime } from '@/hooks/useActivityTime';
-import { getPlatformIcon } from '@/routes/(main)/agent/channel/const';
import type { ChatTopic } from '@/types/topic';
import StatusDot from './StatusDot';
diff --git a/src/features/AgentTopicManager/TopicListView.tsx b/src/features/AgentTopicManager/TopicListView.tsx
index 5d660c42fec..7c246a7aa1f 100644
--- a/src/features/AgentTopicManager/TopicListView.tsx
+++ b/src/features/AgentTopicManager/TopicListView.tsx
@@ -9,10 +9,10 @@ import { FolderIcon, MoreHorizontal, Star } from 'lucide-react';
import { Fragment, memo, type MouseEvent, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
+import { getPlatformIcon } from '@/features/AgentChannel/const';
import { useTopicItemDropdownMenu } from '@/features/AgentSidebar/Topic/List/Item/useDropdownMenu';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { useActivityTime } from '@/hooks/useActivityTime';
-import { getPlatformIcon } from '@/routes/(main)/agent/channel/const';
import type { ChatTopic } from '@/types/topic';
import StatusDot from './StatusDot';
diff --git a/src/features/AgentViewAll/AgentCard.tsx b/src/features/AgentViewAll/AgentCard.tsx
index d827e1cf4ca..1db9e0abfd4 100644
--- a/src/features/AgentViewAll/AgentCard.tsx
+++ b/src/features/AgentViewAll/AgentCard.tsx
@@ -17,7 +17,7 @@ import ItemActions from './ItemActions';
import LabelTags from './LabelTags';
// Card layout mirrors the agent channel platform cards
-// (src/routes/(main)/agent/channel/list.tsx): icon + title + trailing state on
+// (src/features/AgentChannel/PlatformGrid.tsx): icon + title + trailing state on
// one row, a two-line description below, hover lift on the whole card.
export const cardStyles = createStaticStyles(({ css, cssVar }) => ({
card: css`
diff --git a/src/features/Home/InputArea/MessengerBanner.tsx b/src/features/Home/InputArea/MessengerBanner.tsx
index 8eda2b3b856..3beb2ab8411 100644
--- a/src/features/Home/InputArea/MessengerBanner.tsx
+++ b/src/features/Home/InputArea/MessengerBanner.tsx
@@ -7,8 +7,8 @@ import type { FC } from 'react';
import { memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
+import { getPlatformIcon } from '@/features/AgentChannel/const';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import { getPlatformIcon } from '@/routes/(main)/agent/channel/const';
import { InputBanner } from './InputBanner';
diff --git a/src/features/Home/Recents/Item.tsx b/src/features/Home/Recents/Item.tsx
index 7812917e830..87b84a45259 100644
--- a/src/features/Home/Recents/Item.tsx
+++ b/src/features/Home/Recents/Item.tsx
@@ -5,12 +5,12 @@ import { cssVar } from 'antd-style';
import { FileTextIcon, HashIcon, MoreHorizontalIcon } from 'lucide-react';
import { memo, useCallback } from 'react';
+import { getPlatformIcon } from '@/features/AgentChannel/const';
import TaskStatusIcon from '@/features/AgentTasks/features/TaskStatusIcon';
import RunningGlyph from '@/features/Home/components/RunningGlyph';
import NavItem from '@/features/NavPanel/components/NavItem';
import { usePrefetchAgent } from '@/hooks/usePrefetchAgent';
import { usePrefetchPage } from '@/hooks/usePrefetchPage';
-import { getPlatformIcon } from '@/routes/(main)/agent/channel/const';
import { useRecentItemDropdownMenu } from './useDropdownMenu';
diff --git a/src/routes/(main)/agent/channel/Header.tsx b/src/routes/(main)/agent/channel/Header.tsx
index d814a866452..3a1a8cbfc22 100644
--- a/src/routes/(main)/agent/channel/Header.tsx
+++ b/src/routes/(main)/agent/channel/Header.tsx
@@ -24,8 +24,8 @@ import NavHeader from '@/features/NavHeader';
import type { SerializedPlatformDefinition } from '@/server/services/bot/platforms/types';
import { useAgentStore } from '@/store/agent';
import type { BotProviderItem } from '@/store/agent/slices/bot/action';
+import { BOT_RUNTIME_STATUSES, type BotRuntimeStatus } from '@/types/botRuntimeStatus';
-import { BOT_RUNTIME_STATUSES, type BotRuntimeStatus } from '../../../../types/botRuntimeStatus';
import { resolveChannelHeaderView } from './headerView';
import { isImportableChannel, planChannelImport } from './importPlan';
diff --git a/src/routes/(main)/agent/channel/index.tsx b/src/routes/(main)/agent/channel/index.tsx
index d6663862598..8075954e32a 100644
--- a/src/routes/(main)/agent/channel/index.tsx
+++ b/src/routes/(main)/agent/channel/index.tsx
@@ -2,7 +2,7 @@
import { Flexbox } from '@lobehub/ui';
import { createStaticStyles } from 'antd-style';
-import { memo, useCallback, useEffect, useMemo } from 'react';
+import { memo, useCallback, useMemo } from 'react';
import { useNavigate, useParams } from 'react-router';
import NotFound from '@/components/404';
@@ -11,18 +11,14 @@ import {
AgentChannelDetailBodySkeleton,
AgentChannelListBodySkeleton,
} from '@/components/Skeleton/AgentChannel';
+import PlatformDetail from '@/features/AgentChannel/PlatformDetail';
+import ComingSoonDetail from '@/features/AgentChannel/PlatformDetail/ComingSoon';
+import PlatformGrid from '@/features/AgentChannel/PlatformGrid';
+import { useAgentChannels } from '@/features/AgentChannel/useAgentChannels';
import ResourceConfigAccessGate from '@/features/ResourcePermission/ResourceConfigAccessGate';
import { usePermission } from '@/hooks/usePermission';
-import { useAgentStore } from '@/store/agent';
-import { useUserStore } from '@/store/user';
-import { labPreferSelectors } from '@/store/user/selectors';
-import { BOT_RUNTIME_STATUSES, type BotRuntimeStatus } from '../../../../types/botRuntimeStatus';
-import { type ChannelPlatformDefinition, COMING_SOON_PLATFORMS } from './const';
-import PlatformDetail from './detail';
-import ComingSoonDetail from './detail/ComingSoon';
import Header from './Header';
-import PlatformGrid from './list';
const styles = createStaticStyles(({ css }) => ({
container: css`
@@ -43,75 +39,16 @@ const ChannelContent = memo(() => {
const { allowed: canEdit } = usePermission('edit_own_content');
const {
- isLoading: platformsLoading,
- error: platformsError,
- mutate: mutatePlatforms,
- } = useAgentStore((s) => s.useFetchPlatformDefinitions());
- const {
- isLoading: providersLoading,
- error: providersError,
- mutate: mutateProviders,
- } = useAgentStore((s) => s.useFetchBotProviders(aid));
- // The data lives in the replica views; the hooks above only orchestrate the
- // fetch (hydrate the persisted copy, then revalidate in the background).
- const platforms = useAgentStore((s) => s.botPlatformDefinitions);
- const providers = useAgentStore((s) => (aid ? s.botProvidersMap[aid] : undefined));
- const triggerRefreshAllBotStatuses = useAgentStore((s) => s.triggerRefreshAllBotStatuses);
- const enableImessage = useUserStore(labPreferSelectors.enableImessage);
-
- // Fire-and-forget a live gateway status refresh on entry. The list renders
- // from cached statuses immediately; SWR revalidates once Redis is updated.
- useEffect(() => {
- if (!aid) return;
- if (!canEdit) return;
- triggerRefreshAllBotStatuses(aid);
- }, [aid, canEdit, triggerRefreshAllBotStatuses]);
-
- const isLoading = platformsLoading || providersLoading;
- const error = platformsError ?? providersError;
-
- // A *failed* or still-empty platform fetch leaves `platforms` undefined, so
- // `allPlatforms` collapses to just the frontend-only `COMING_SOON_PLATFORMS`
- // — and the surface would render a plausible coming-soon-only catalog (every
- // real / connected channel silently dropped). So "has data" is *not* the merged
- // length: it's whether the real fetch actually yielded platforms. Gate on the
- // raw synced `platforms` (never the static merge).
- //
- // The providers fetch, though, is a replica: a *background* revalidate that
- // fails must not blank a hydrated first frame. Once the providers have a
- // settled value (local copy or network), a providers error is not fatal — the
- // grid renders from that value and reconciles behind it. It only falls through
- // to the error state when there is nothing settled for this agent either.
- const providersSettled = providers !== undefined;
- const hasData = (platforms?.length ?? 0) > 0 && (!providersError || providersSettled);
-
- // Merge server-side platforms with frontend-only coming-soon entries.
- // Coming-soon entries shadow a server-registered platform of the same id, so a
- // platform can be registered server-side first and stay a placeholder until
- // the frontend reveals it. iMessage additionally honors the Labs
- // `enableImessage` preference: off keeps the placeholder, on drops it so the
- // real platform shows.
- const allPlatforms = useMemo<ChannelPlatformDefinition[]>(() => {
- const comingSoon = enableImessage
- ? COMING_SOON_PLATFORMS.filter((p) => p.id !== 'imessage')
- : COMING_SOON_PLATFORMS;
- const comingSoonIds = new Set(comingSoon.map((p) => p.id));
- return [...(platforms ?? []).filter((p) => !comingSoonIds.has(p.id)), ...comingSoon];
- }, [platforms, enableImessage]);
-
- const platformRuntimeStatuses = useMemo(
- () =>
- new Map<string, BotRuntimeStatus>(
- (providers ?? [])
- .filter((provider) => provider.enabled)
- .map((provider) => [
- provider.platform,
- ((provider as any).runtimeStatus as BotRuntimeStatus) ??
- BOT_RUNTIME_STATUSES.disconnected,
- ]),
- ),
- [providers],
- );
+ allPlatforms,
+ error,
+ hasData,
+ isLoading,
+ platformRuntimeStatuses,
+ platforms,
+ platformsLoading,
+ providers,
+ retry,
+ } = useAgentChannels(aid, canEdit);
const activePlatformDef = useMemo(
() => (platform ? allPlatforms.find((item) => item.id === platform) : undefined),
@@ -153,10 +90,7 @@ const ChannelContent = memo(() => {
// Body half of the route skeleton (the real header is already mounted),
// so the chunk wait and the platform fetch share one shape.
loading={platform ? <AgentChannelDetailBodySkeleton /> : <AgentChannelListBodySkeleton />}
- onRetry={() => {
- mutatePlatforms();
- mutateProviders();
- }}
+ onRetry={retry}
>
{!platform ? (
<div className={styles.container}>
diff --git a/src/routes/(main)/agent/channel/list.tsx b/src/routes/(main)/agent/channel/list.tsx
deleted file mode 100644
index 839061db119..00000000000
--- a/src/routes/(main)/agent/channel/list.tsx
+++ /dev/null
@@ -1,300 +0,0 @@
-'use client';
-
-import { agentDisplayName } from '@lobechat/types';
-import { Block, Flexbox } from '@lobehub/ui';
-import { Avatar, Tag, Text } from '@lobehub/ui/base-ui';
-import { createStaticStyles, responsive, useTheme } from 'antd-style';
-import isEqual from 'fast-deep-equal';
-import { memo } from 'react';
-import { Trans, useTranslation } from 'react-i18next';
-
-import { DEFAULT_AVATAR } from '@/const/meta';
-import { useAgentStore } from '@/store/agent';
-import { agentSelectors } from '@/store/agent/selectors';
-
-import { BOT_RUNTIME_STATUSES, type BotRuntimeStatus } from '../../../../types/botRuntimeStatus';
-import { type ChannelPlatformDefinition, getPlatformIcon } from './const';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- card: css`
- display: flex;
- flex-direction: column;
- gap: 8px;
- align-items: stretch;
-
- min-height: 104px;
- padding-block: 12px;
- padding-inline: 12px;
-
- transition:
- transform 0.18s,
- box-shadow 0.18s,
- border-color 0.18s;
-
- &:hover {
- transform: translateY(-1px);
- box-shadow: 0 4px 12px rgb(0 0 0 / 6%);
- }
- `,
- description: css`
- overflow: hidden;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
-
- line-height: 1.5;
- `,
- grid: css`
- display: grid;
- grid-template-columns: repeat(3, minmax(0, 1fr));
- gap: 12px;
-
- width: 100%;
- min-width: 0;
-
- ${responsive.md} {
- grid-template-columns: repeat(2, minmax(0, 1fr));
- }
-
- ${responsive.sm} {
- grid-template-columns: minmax(0, 1fr);
- }
- `,
- root: css`
- display: flex;
- flex-direction: column;
- align-items: center;
-
- width: 100%;
- padding-block: 24px;
- padding-inline: 24px;
- `,
- statusDot: css`
- flex-shrink: 0;
-
- width: 8px;
- height: 8px;
- border-radius: 50%;
-
- background: ${cssVar.colorSuccess};
- box-shadow: 0 0 0 1px ${cssVar.colorBgContainer};
- `,
- title: css`
- width: 100%;
- margin-block: 0 20px;
-
- font-size: 24px;
- font-weight: 600;
- line-height: 1.4;
- color: ${cssVar.colorText};
-
- ${responsive.sm} {
- font-size: 20px;
- }
- `,
- titleAvatar: css`
- display: inline-flex;
- margin-inline: 6px;
- vertical-align: -6px;
- `,
- widthLimiter: css`
- width: 100%;
- max-width: 1024px;
- `,
- titleRow: css`
- width: 100%;
- min-width: 0;
- `,
- trailing: css`
- flex-shrink: 0;
- `,
-}));
-
-interface PlatformGridProps {
- agentId: string;
- onSelect: (id: string) => void;
- platforms: ChannelPlatformDefinition[];
- runtimeStatuses: Map<string, BotRuntimeStatus>;
-}
-
-const PlatformGrid = memo<PlatformGridProps>(
- ({ agentId, platforms, onSelect, runtimeStatuses }) => {
- const { t } = useTranslation(['agent', 'common']);
- const theme = useTheme();
- const meta = useAgentStore(agentSelectors.getAgentMetaById(agentId), isEqual);
- const agentName = agentDisplayName(meta, t('defaultSession', { ns: 'common' }));
-
- const getPlatformDescription = (id: string, name: string) => {
- switch (id) {
- case 'discord': {
- return t('channel.platform.discord.description');
- }
- case 'feishu': {
- return t('channel.platform.feishu.description');
- }
- case 'imessage': {
- return t('channel.platform.imessage.description');
- }
- case 'lark': {
- return t('channel.platform.lark.description');
- }
- case 'line': {
- return t('channel.platform.line.description');
- }
- case 'qq': {
- return t('channel.platform.qq.description');
- }
- case 'slack': {
- return t('channel.platform.slack.description');
- }
- case 'telegram': {
- return t('channel.platform.telegram.description');
- }
- case 'wechat': {
- return t('channel.platform.wechat.description');
- }
- case 'whatsapp': {
- return t('channel.platform.whatsapp.description');
- }
- default: {
- return t('channel.platform.default.description', { name });
- }
- }
- };
-
- const getStatusColor = (status?: BotRuntimeStatus) => {
- switch (status) {
- case BOT_RUNTIME_STATUSES.connected: {
- return theme.colorSuccess;
- }
- case BOT_RUNTIME_STATUSES.failed: {
- return theme.colorError;
- }
- case BOT_RUNTIME_STATUSES.queued:
- case BOT_RUNTIME_STATUSES.starting: {
- return theme.colorInfo;
- }
- case BOT_RUNTIME_STATUSES.dormant: {
- return theme.colorWarning;
- }
- case BOT_RUNTIME_STATUSES.disconnected: {
- return theme.colorTextQuaternary;
- }
- default: {
- return undefined;
- }
- }
- };
-
- const getStatusTitle = (status?: BotRuntimeStatus) => {
- switch (status) {
- case BOT_RUNTIME_STATUSES.connected: {
- return t('channel.connectSuccess');
- }
- case BOT_RUNTIME_STATUSES.failed: {
- return t('channel.connectFailed');
- }
- case BOT_RUNTIME_STATUSES.queued: {
- return t('channel.connectQueued');
- }
- case BOT_RUNTIME_STATUSES.starting: {
- return t('channel.connectStarting');
- }
- case BOT_RUNTIME_STATUSES.dormant: {
- return t('channel.statusDormant');
- }
- case BOT_RUNTIME_STATUSES.disconnected: {
- return t('channel.runtimeDisconnected');
- }
- default: {
- return undefined;
- }
- }
- };
-
- return (
- <section className={styles.root}>
- <div className={styles.widthLimiter}>
- <h1 className={styles.title}>
- <Trans<'channel.home.title', 'agent'>
- i18nKey={'channel.home.title'}
- ns={'agent'}
- values={{ name: agentName }}
- components={{
- avatar: (
- <span className={styles.titleAvatar}>
- <Avatar
- avatar={meta.avatar || DEFAULT_AVATAR}
- background={meta.backgroundColor}
- shape={'square'}
- size={28}
- />
- </span>
- ),
- }}
- />
- </h1>
- <div className={styles.grid}>
- {platforms.map((platform) => {
- const PlatformIcon = getPlatformIcon(platform.name);
- const ColorIcon =
- PlatformIcon && 'Color' in PlatformIcon
- ? (PlatformIcon as any).Color
- : PlatformIcon;
- const runtimeStatus = platform.comingSoon
- ? undefined
- : runtimeStatuses.get(platform.id);
- const statusColor = getStatusColor(runtimeStatus);
- const statusTitle = getStatusTitle(runtimeStatus);
- const description = getPlatformDescription(platform.id, platform.name);
- return (
- <Block
- clickable
- className={styles.card}
- key={platform.id}
- variant={'outlined'}
- onClick={() => onSelect(platform.id)}
- >
- <Flexbox horizontal align={'center'} className={styles.titleRow} gap={8}>
- {ColorIcon && <ColorIcon size={24} />}
- <Text ellipsis style={{ flex: 1, minWidth: 0 }} weight={600}>
- {platform.name}
- </Text>
- <Flexbox horizontal align={'center'} className={styles.trailing} gap={4}>
- {platform.comingSoon && (
- <Tag size={'small'} style={{ marginInlineEnd: 0 }}>
- {t('channel.comingSoon')}
- </Tag>
- )}
- {platform.access?.requiredPlan === 'paid' && (
- <Tag color="gold" size={'small'} style={{ marginInlineEnd: 0 }}>
- {platform.access.rolloutMode === 'notice'
- ? t('channel.paidFeature.noticeBadge')
- : t('channel.paidFeature.badge')}
- </Tag>
- )}
- {runtimeStatus && (
- <div
- className={styles.statusDot}
- style={{ background: statusColor }}
- title={statusTitle}
- />
- )}
- </Flexbox>
- </Flexbox>
- <Text className={styles.description} fontSize={12} type={'secondary'}>
- {description}
- </Text>
- </Block>
- );
- })}
- </div>
- </div>
- </section>
- );
- },
-);
-
-PlatformGrid.displayName = 'PlatformGrid';
-
-export default PlatformGrid;
diff --git a/src/routes/(main)/agent/channel/detail/permission.test.tsx b/src/routes/(main)/agent/channel/permission.test.tsx
similarity index 97%
rename from src/routes/(main)/agent/channel/detail/permission.test.tsx
rename to src/routes/(main)/agent/channel/permission.test.tsx
index d4220c57f8a..592ae4d970c 100644
--- a/src/routes/(main)/agent/channel/detail/permission.test.tsx
+++ b/src/routes/(main)/agent/channel/permission.test.tsx
@@ -6,12 +6,12 @@ import { fireEvent, render, screen, waitFor, within } from '@testing-library/rea
import type { ReactNode } from 'react';
import { describe, expect, it, vi } from 'vitest';
+import PlatformDetail, { type ChannelFormValues } from '@/features/AgentChannel/PlatformDetail';
+import Body from '@/features/AgentChannel/PlatformDetail/Body';
+import Footer from '@/features/AgentChannel/PlatformDetail/Footer';
import type { SerializedPlatformDefinition } from '@/server/services/bot/platforms/types';
-import Header from '../Header';
-import Body from './Body';
-import Footer from './Footer';
-import PlatformDetail, { type ChannelFormValues } from './index';
+import Header from './Header';
const mocks = vi.hoisted(() => ({
activeWorkspaceId: null as string | null,
@@ -172,7 +172,7 @@ vi.mock('@/components/InfoTooltip', () => ({
),
}));
-vi.mock('../const', () => ({
+vi.mock('@/features/AgentChannel/const', () => ({
getPlatformIcon: () => null,
}));