mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-12 08:46:02 +00:00
feat: add help links for message platform adapters in YAML and update documentation retrieval logic
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
/**
|
||||
* Returns the documentation URL for a given adapter name,
|
||||
* using link.langbot.app short links.
|
||||
* Resolves the documentation URL for a given adapter from its
|
||||
* spec.help_links map, selecting the best match for the current locale
|
||||
* with a fallback to English.
|
||||
*/
|
||||
export function getAdapterDocUrl(
|
||||
adapterName: string,
|
||||
helpLinks: Record<string, string> | undefined,
|
||||
locale: string,
|
||||
): string | null {
|
||||
// Map locale to doc language prefix
|
||||
if (!helpLinks) return null;
|
||||
|
||||
// Map locale to simplified language key
|
||||
let lang: string;
|
||||
if (locale.startsWith('zh')) {
|
||||
lang = 'zh';
|
||||
@@ -16,28 +19,5 @@ export function getAdapterDocUrl(
|
||||
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}`;
|
||||
return helpLinks[lang] ?? helpLinks['en'] ?? null;
|
||||
}
|
||||
|
||||
@@ -118,6 +118,7 @@ export interface Adapter {
|
||||
icon?: string;
|
||||
spec: {
|
||||
categories?: string[];
|
||||
help_links?: Record<string, string>;
|
||||
config: IDynamicFormItemSchema[];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user