Download dashboard/src/utils/platformUtils.js from qa1145/astrbbbb: direct link, hf CLI and curl.
- Browser
- Download file 4.65 kB
-
https://huggingface.co/spaces/qa1145/astrbbbb/resolve/main/dashboard/src/utils/platformUtils.js
- Command line
-
hf download hf://spaces/qa1145/astrbbbb/dashboard/src/utils/platformUtils.js
-
curl -L -o platformUtils.js https://huggingface.co/spaces/qa1145/astrbbbb/resolve/main/dashboard/src/utils/platformUtils.js
4.65 kB
| /** | |
| * 平台相关工具函数 | |
| */ | |
| /** | |
| * 获取平台图标 | |
| * @param {string} name - 平台名称或类型 | |
| * @returns {string|undefined} 图标URL | |
| */ | |
| export function getPlatformIcon(name) { | |
| if (name === 'aiocqhttp') { | |
| return new URL('@/assets/images/platform_logos/onebot.png', import.meta.url).href | |
| } else if (name === 'qq_official' || name === 'qq_official_webhook') { | |
| return new URL('@/assets/images/platform_logos/qq.png', import.meta.url).href | |
| } else if (name === 'wecom' || name === 'wecom_ai_bot') { | |
| return new URL('@/assets/images/platform_logos/wecom.png', import.meta.url).href | |
| } else if (name === 'weixin_official_account') { | |
| return new URL('@/assets/images/platform_logos/wechat.png', import.meta.url).href | |
| } else if (name === 'lark') { | |
| return new URL('@/assets/images/platform_logos/lark.png', import.meta.url).href | |
| } else if (name === 'dingtalk') { | |
| return new URL('@/assets/images/platform_logos/dingtalk.svg', import.meta.url).href | |
| } else if (name === 'telegram') { | |
| return new URL('@/assets/images/platform_logos/telegram.svg', import.meta.url).href | |
| } else if (name === 'discord') { | |
| return new URL('@/assets/images/platform_logos/discord.svg', import.meta.url).href | |
| } else if (name === 'slack') { | |
| return new URL('@/assets/images/platform_logos/slack.svg', import.meta.url).href | |
| } else if (name === 'kook') { | |
| return new URL('@/assets/images/platform_logos/kook.png', import.meta.url).href | |
| } else if (name === 'vocechat') { | |
| return new URL('@/assets/images/platform_logos/vocechat.png', import.meta.url).href | |
| } else if (name === 'satori' || name === 'Satori') { | |
| return new URL('@/assets/images/platform_logos/satori.png', import.meta.url).href | |
| } else if (name === 'misskey') { | |
| return new URL('@/assets/images/platform_logos/misskey.png', import.meta.url).href | |
| } else if (name === 'line') { | |
| return new URL('@/assets/images/platform_logos/line.png', import.meta.url).href | |
| } | |
| } | |
| /** | |
| * 获取平台教程链接 | |
| * @param {string} platformType - 平台类型 | |
| * @returns {string} 教程链接 | |
| */ | |
| export function getTutorialLink(platformType) { | |
| const tutorialMap = { | |
| "qq_official_webhook": "https://docs.astrbot.app/platform/qqofficial/webhook.html", | |
| "qq_official": "https://docs.astrbot.app/platform/qqofficial/websockets.html", | |
| "aiocqhttp": "https://docs.astrbot.app/platform/aiocqhttp/napcat.html", | |
| "wecom": "https://docs.astrbot.app/platform/wecom.html", | |
| "wecom_ai_bot": "https://docs.astrbot.app/platform/wecom_ai_bot.html", | |
| "lark": "https://docs.astrbot.app/platform/lark.html", | |
| "telegram": "https://docs.astrbot.app/platform/telegram.html", | |
| "dingtalk": "https://docs.astrbot.app/platform/dingtalk.html", | |
| "weixin_official_account": "https://docs.astrbot.app/platform/weixin-official-account.html", | |
| "discord": "https://docs.astrbot.app/platform/discord.html", | |
| "slack": "https://docs.astrbot.app/platform/slack.html", | |
| "kook": "https://docs.astrbot.app/platform/kook.html", | |
| "vocechat": "https://docs.astrbot.app/platform/vocechat.html", | |
| "satori": "https://docs.astrbot.app/platform/satori/llonebot.html", | |
| "misskey": "https://docs.astrbot.app/platform/misskey.html", | |
| "line": "https://docs.astrbot.app/platform/line.html", | |
| } | |
| return tutorialMap[platformType] || "https://docs.astrbot.app"; | |
| } | |
| /** | |
| * 获取平台描述 | |
| * @param {Object} template - 平台模板 | |
| * @param {string} name - 平台名称 | |
| * @returns {string} 平台描述 | |
| */ | |
| export function getPlatformDescription(template, name) { | |
| // special judge for community platforms | |
| if (name.includes('vocechat')) { | |
| return "由 @HikariFroya 提供。"; | |
| } else if (name.includes('kook')) { | |
| return "由 @wuyan1003 提供。" | |
| } | |
| return ''; | |
| } | |
| /** | |
| * 获取平台展示名(用于插件支持平台显示) | |
| * @param {string} platformId - 平台适配器 ID | |
| * @returns {string} | |
| */ | |
| export function getPlatformDisplayName(platformId) { | |
| const displayNameMap = { | |
| aiocqhttp: 'aiocqhttp (OneBot v11)', | |
| qq_official: 'qq_official (QQ 官方机器人平台)', | |
| weixin_official_account: 'weixin_official_account (微信公众号)', | |
| wecom: 'wecom (企业微信应用)', | |
| wecom_ai_bot: 'wecom_ai_bot (企业微信智能机器人)', | |
| lark: 'lark (飞书)', | |
| dingtalk: 'dingtalk (钉钉)', | |
| telegram: 'telegram (Telegram)', | |
| discord: 'discord (Discord)', | |
| misskey: 'misskey (Misskey)', | |
| slack: 'slack (Slack)', | |
| kook: 'kook (KOOK)', | |
| vocechat: 'vocechat (VoceChat)', | |
| satori: 'satori (Satori)', | |
| line: 'line (LINE)', | |
| }; | |
| return displayNameMap[platformId] || platformId; | |
| } | |