mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-27 16:04:21 +00:00
feat: add adapter documentation link button
Add 'View Docs' button that links to the corresponding adapter's documentation page via link.langbot.app short links. Appears in: - Wizard adapter selection cards (Step 0) - Wizard bot config card header (Step 1) - Bot create/edit form (adapter config section) Supports all 7 languages (en/zh-Hans/zh-Hant/ja/th/vi/es). Doc links auto-resolve to the correct language based on UI locale.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Returns the documentation URL for a given adapter name,
|
||||
* using link.langbot.app short links.
|
||||
*/
|
||||
export function getAdapterDocUrl(
|
||||
adapterName: string,
|
||||
locale: string,
|
||||
): string | null {
|
||||
// Map locale to doc language prefix
|
||||
let lang: string;
|
||||
if (locale.startsWith('zh')) {
|
||||
lang = 'zh';
|
||||
} else if (locale.startsWith('ja')) {
|
||||
lang = 'ja';
|
||||
} else {
|
||||
lang = 'en';
|
||||
}
|
||||
|
||||
// Only adapters with dedicated doc pages
|
||||
const ADAPTER_DOC_SLUGS: Record<string, string> = {
|
||||
telegram: 'telegram',
|
||||
discord: 'discord',
|
||||
slack: 'slack',
|
||||
line: 'line',
|
||||
kook: 'kook',
|
||||
lark: 'lark',
|
||||
dingtalk: 'dingtalk',
|
||||
aiocqhttp: 'aiocqhttp',
|
||||
qqofficial: 'qqofficial',
|
||||
wecom: 'wecom',
|
||||
wecomcs: 'wecomcs',
|
||||
wecombot: 'wecombot',
|
||||
officialaccount: 'officialaccount',
|
||||
wechatpad: 'wechatpad',
|
||||
openclaw_weixin: 'openclaw_weixin',
|
||||
satori: 'satori',
|
||||
};
|
||||
|
||||
const slug = ADAPTER_DOC_SLUGS[adapterName];
|
||||
if (!slug) return null;
|
||||
|
||||
return `https://link.langbot.app/${lang}/platforms/${slug}`;
|
||||
}
|
||||
Reference in New Issue
Block a user