UNPKG

@lobehub/chat

Version:

Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.

29 lines (21 loc) 925 B
import { PluginSchema } from '@lobehub/chat-plugin-sdk'; import { MetaData } from '@/types/meta'; import { LobeTool } from '@/types/tool'; const getPluginFormList = (list: LobeTool[], id: string) => list?.find((p) => p.identifier === id); const getPluginTitle = (meta?: MetaData) => meta?.title; const getPluginDesc = (meta?: MetaData) => meta?.description; const getPluginTags = (meta?: MetaData) => meta?.tags; const getPluginAvatar = (meta?: MetaData) => meta?.avatar || '🧩'; const isCustomPlugin = (id: string, pluginList: LobeTool[]) => pluginList.some((i) => i.identifier === id && i.type === 'customPlugin'); const isSettingSchemaNonEmpty = (schema?: PluginSchema) => schema?.properties && Object.keys(schema.properties).length > 0; export const pluginHelpers = { getPluginAvatar, getPluginDesc, getPluginFormList, getPluginTags, getPluginTitle, isCustomPlugin, isSettingSchemaNonEmpty, };