You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailchat/client/web/src/utils/plugin-helper.ts

20 lines
564 B
TypeScript

import { pluginGroupPanel, PluginGroupPanel } from '@/plugin/common';
/**
* 查找注册插件提供的群组面板的信息
* @param pluginPanelName 插件面板名
*/
export function findPluginPanelInfoByName(
pluginPanelName: string
): PluginGroupPanel | undefined {
return pluginGroupPanel.find((p) => p.name === pluginPanelName);
}
export function ensurePluginNamePrefix(name: string): string {
if (typeof name !== 'string') {
throw new Error('Plugin Name must be string');
}
return name.startsWith('plugin:') ? name : `plugin:${name}`;
}