@lobehub/chat 0.66.0 → 0.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/.eslintrc.js +1 -0
  2. package/CHANGELOG.md +68 -0
  3. package/README-zh_CN.md +4 -1
  4. package/README.md +4 -1
  5. package/locales/en_US/plugin.json +8 -2
  6. package/package.json +2 -2
  7. package/src/features/AgentSetting/AgentPlugin/LocalPluginItem.tsx +10 -8
  8. package/src/features/AgentSetting/AgentPlugin/MarketList.tsx +29 -13
  9. package/src/features/PluginDevModal/ManifestForm.tsx +150 -86
  10. package/src/features/PluginDevModal/MetaForm.tsx +16 -17
  11. package/src/features/PluginDevModal/PluginPreview.tsx +9 -8
  12. package/src/features/PluginDevModal/index.tsx +26 -23
  13. package/src/locales/default/plugin.ts +9 -5
  14. package/src/pages/chat/features/Conversation/ChatList/Plugins/IFrameRender/hooks.ts +29 -0
  15. package/src/pages/chat/features/Conversation/ChatList/Plugins/IFrameRender/index.tsx +62 -0
  16. package/src/pages/chat/features/Conversation/ChatList/Plugins/IFrameRender/utils.ts +17 -0
  17. package/src/pages/chat/features/Conversation/ChatList/Plugins/PluginMessage.tsx +20 -4
  18. package/src/pages/chat/features/Conversation/ChatList/Plugins/{CustomRender.tsx → SystemJsRender/index.tsx} +5 -4
  19. package/src/store/plugin/initialState.ts +5 -34
  20. package/src/store/plugin/selectors.ts +12 -7
  21. package/src/store/plugin/slices/customPlugin/action.ts +64 -0
  22. package/src/store/plugin/slices/customPlugin/index.ts +3 -0
  23. package/src/store/plugin/slices/customPlugin/initialState.ts +16 -0
  24. package/src/store/plugin/{reducers/devPluginList.ts → slices/customPlugin/reducers/customPluginList.ts} +6 -6
  25. package/src/store/plugin/{action.ts → slices/plugin/action.ts} +13 -25
  26. package/src/store/plugin/slices/plugin/index.ts +3 -0
  27. package/src/store/plugin/slices/plugin/initialState.ts +22 -0
  28. package/src/store/plugin/store.ts +6 -4
  29. package/src/types/plugin.ts +8 -1
  30. /package/src/pages/chat/features/Conversation/ChatList/Plugins/{dynamticLoader.ts → SystemJsRender/utils.ts} +0 -0
  31. /package/src/store/plugin/{reducers → slices/plugin/reducers}/manifest.ts +0 -0
@@ -5,23 +5,25 @@ import { StateCreator } from 'zustand/vanilla';
5
5
 
6
6
  import { isDev } from '@/utils/env';
7
7
 
8
- import { PluginAction, createPluginSlice } from './action';
9
8
  import { PluginStoreState, initialState } from './initialState';
9
+ import { CustomPluginAction, createCustomPluginSlice } from './slices/customPlugin';
10
+ import { PluginAction, createPluginSlice } from './slices/plugin';
10
11
 
11
12
  // =============== 聚合 createStoreFn ============ //
12
13
 
13
- export type PluginStore = PluginStoreState & PluginAction;
14
+ export type PluginStore = PluginStoreState & CustomPluginAction & PluginAction;
14
15
 
15
16
  const createStore: StateCreator<PluginStore, [['zustand/devtools', never]]> = (...parameters) => ({
16
17
  ...initialState,
17
18
  ...createPluginSlice(...parameters),
19
+ ...createCustomPluginSlice(...parameters),
18
20
  });
19
21
 
20
22
  // =============== persist 本地缓存中间件配置 ============ //
21
23
 
22
24
  type SessionPersist = Pick<
23
25
  PluginStore,
24
- 'pluginList' | 'pluginManifestMap' | 'pluginsSettings' | 'devPluginList'
26
+ 'pluginList' | 'pluginManifestMap' | 'pluginsSettings' | 'customPluginList'
25
27
  >;
26
28
 
27
29
  const storeName = 'LOBE_PLUGIN';
@@ -30,7 +32,7 @@ const persistOptions: PersistOptions<PluginStore, SessionPersist> = {
30
32
  name: storeName,
31
33
 
32
34
  partialize: (s) => ({
33
- devPluginList: s.devPluginList,
35
+ customPluginList: s.customPluginList,
34
36
  pluginList: s.pluginList,
35
37
  pluginManifestMap: s.pluginManifestMap,
36
38
  pluginsSettings: s.pluginsSettings,
@@ -1,3 +1,10 @@
1
- import { LobeChatPluginManifest } from '@lobehub/chat-plugin-sdk';
1
+ import { LobeChatPluginManifest, LobeChatPluginMeta } from '@lobehub/chat-plugin-sdk';
2
2
 
3
3
  export type PluginManifestMap = Record<string, LobeChatPluginManifest>;
4
+
5
+ export interface CustomPlugin extends LobeChatPluginMeta {
6
+ apiMode: 'openapi' | 'simple';
7
+ enableSettings: boolean;
8
+ manifestConfig?: LobeChatPluginManifest;
9
+ manifestMode: 'local' | 'url';
10
+ }