mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-14 03:30:19 +00:00
3415df3715
* ♻️ refactor: remove @lobehub/chat-plugin-sdk dependency Plugins have been deprecated. This removes the SDK entirely: - Define built-in ToolManifest, ToolManifestSettings, ToolErrorType types - Delete src/features/PluginsUI/ (plugin iframe rendering) - Delete src/store/tool/slices/oldStore/ (deprecated plugin store) - Delete src/server/services/pluginGateway/ (plugin gateway) - Delete src/app/(backend)/webapi/plugin/gateway/ (plugin API route) - Migrate all ~50 files from SDK imports to @lobechat/types - Remove @lobehub/chat-plugin-sdk, @lobehub/chat-plugins-gateway deps - Remove @swagger-api/apidom-reference override and patch Fixes LOBE-6655 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: add missing getInstalledPlugins mock in customPlugin test Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🔧 chore: increase Vercel build memory limit to 8192MB The 6144MB limit was causing OOM during Vite SPA chunk rendering. Aligned with other build commands that already use 8192MB. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: unify default tool type to builtin and fix CustomRender - Remove `invokeDefaultTypePlugin` — default type now falls through to builtin in both server and client execution paths - Fix `CustomRender` to actually render builtin tool components via `getBuiltinRender` instead of always returning null - Increase SPA build memory limit from 7168MB to 8192MB to fix OOM Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: remove legacy plugin gateway and type-specific invocations - Delete `runPluginApi`, `internal_callPluginApi`, `invokeMarkdownTypePlugin`, `invokeStandaloneTypePlugin` - Remove plugin gateway endpoint (`/webapi/plugin/gateway`) from URL config - Remove special `builtin → default` runtimeType mapping in plugin model - Clean up unused imports and related tests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: add 'builtin' to runtimeType union to fix type error Use ToolManifestType instead of inline union for runtimeType fields so that 'builtin' is included as a valid type. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
54 lines
1.7 KiB
TypeScript
54 lines
1.7 KiB
TypeScript
import { type LobeTool, type ToolManifest } from '@lobechat/types';
|
|
|
|
import { lambdaClient } from '@/libs/trpc/client';
|
|
import { type LobeToolCustomPlugin } from '@/types/tool/plugin';
|
|
|
|
export interface InstallPluginParams {
|
|
customParams?: Record<string, any>;
|
|
identifier: string;
|
|
manifest: ToolManifest;
|
|
settings?: Record<string, any>;
|
|
type: 'plugin' | 'customPlugin';
|
|
}
|
|
|
|
export class PluginService {
|
|
installPlugin = async (plugin: InstallPluginParams): Promise<void> => {
|
|
await lambdaClient.plugin.createOrInstallPlugin.mutate(plugin);
|
|
};
|
|
|
|
getInstalledPlugins = (): Promise<LobeTool[]> => {
|
|
return lambdaClient.plugin.getPlugins.query();
|
|
};
|
|
|
|
uninstallPlugin = async (identifier: string): Promise<void> => {
|
|
await lambdaClient.plugin.removePlugin.mutate({ id: identifier });
|
|
};
|
|
|
|
createCustomPlugin = async (customPlugin: LobeToolCustomPlugin): Promise<void> => {
|
|
await lambdaClient.plugin.createPlugin.mutate({ ...customPlugin, type: 'customPlugin' });
|
|
};
|
|
|
|
updatePlugin = async (id: string, value: Partial<LobeToolCustomPlugin>): Promise<void> => {
|
|
await lambdaClient.plugin.updatePlugin.mutate({
|
|
customParams: value.customParams,
|
|
id,
|
|
manifest: value.manifest,
|
|
settings: value.settings,
|
|
});
|
|
};
|
|
|
|
updatePluginManifest = async (id: string, manifest: ToolManifest): Promise<void> => {
|
|
await lambdaClient.plugin.updatePlugin.mutate({ id, manifest });
|
|
};
|
|
|
|
removeAllPlugins = async (): Promise<void> => {
|
|
await lambdaClient.plugin.removeAllPlugins.mutate();
|
|
};
|
|
|
|
updatePluginSettings = async (id: string, settings: any, signal?: AbortSignal): Promise<void> => {
|
|
await lambdaClient.plugin.updatePlugin.mutate({ id, settings }, { signal });
|
|
};
|
|
}
|
|
|
|
export const pluginService = new PluginService();
|