@lobehub/chat 0.33.0 → 0.35.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 (68) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/locales/en_US/common.json +11 -1
  3. package/locales/en_US/error.json +26 -0
  4. package/locales/en_US/plugin.json +20 -1
  5. package/locales/en_US/setting.json +6 -1
  6. package/locales/zh_CN/common.json +10 -0
  7. package/locales/zh_CN/error.json +26 -0
  8. package/locales/zh_CN/plugin.json +20 -2
  9. package/locales/zh_CN/setting.json +8 -3
  10. package/package.json +2 -2
  11. package/src/components/EmojiPicker/index.tsx +48 -0
  12. package/src/components/EmojiPicker/style.ts +28 -0
  13. package/src/const/meta.ts +3 -0
  14. package/src/const/settings.ts +50 -0
  15. package/src/{pages/chat/[id]/edit → features/AgentSetting}/AgentConfig/index.tsx +13 -11
  16. package/src/{pages/chat/[id]/edit → features/AgentSetting}/AgentMeta/AutoGenerateInput.tsx +16 -14
  17. package/src/features/AgentSetting/AgentMeta/BackgroundSwatches.tsx +27 -0
  18. package/src/features/AgentSetting/AgentMeta/index.tsx +128 -0
  19. package/src/{pages/chat/[id]/edit → features/AgentSetting}/AgentPlugin/index.tsx +12 -12
  20. package/src/{pages/chat/[id]/edit → features/AgentSetting}/AgentPrompt/index.tsx +13 -16
  21. package/src/features/AgentSetting/index.ts +4 -0
  22. package/src/features/AgentSetting/test.json +40 -0
  23. package/src/features/SideBar/{BottomAction.tsx → BottomActions.tsx} +15 -5
  24. package/src/features/SideBar/TopActions.tsx +42 -0
  25. package/src/features/SideBar/index.tsx +5 -30
  26. package/src/hooks/useImportConfig.ts +3 -3
  27. package/src/locales/default/common.ts +4 -0
  28. package/src/locales/default/setting.ts +4 -0
  29. package/src/pages/chat/[id]/Conversation/ChatList/index.tsx +1 -1
  30. package/src/pages/chat/[id]/Conversation/Input/Action.tsx +1 -1
  31. package/src/pages/chat/[id]/Header.tsx +1 -1
  32. package/src/pages/chat/[id]/{Config/SideBar.tsx → Sidebar/Inner.tsx} +2 -2
  33. package/src/pages/chat/[id]/{Config → Sidebar}/Topic/TopicContent.tsx +4 -6
  34. package/src/pages/chat/[id]/{Config → Sidebar}/index.tsx +2 -2
  35. package/src/pages/chat/[id]/index.page.tsx +1 -1
  36. package/src/pages/chat/[id]/{edit → setting}/index.page.tsx +23 -9
  37. package/src/pages/settings/Settings/Agent.tsx +25 -0
  38. package/src/pages/{setting/SettingForm.tsx → settings/Settings/Common.tsx} +7 -113
  39. package/src/pages/settings/Settings/index.tsx +50 -0
  40. package/src/pages/{setting → settings}/index.page.tsx +2 -2
  41. package/src/pages/{setting → settings}/layout.tsx +1 -1
  42. package/src/plugins/searchEngine/Render.tsx +3 -1
  43. package/src/store/session/slices/agentConfig/action.ts +8 -1
  44. package/src/store/session/slices/agentConfig/initialState.ts +2 -13
  45. package/src/store/session/slices/agentConfig/selectors.ts +13 -9
  46. package/src/store/session/slices/chat/actions/message.ts +12 -5
  47. package/src/store/session/slices/chat/actions/topic.ts +4 -2
  48. package/src/store/session/slices/chat/selectors/chat.ts +1 -1
  49. package/src/store/session/slices/session/action.ts +23 -16
  50. package/src/store/session/slices/session/initialState.ts +2 -1
  51. package/src/store/settings/action.ts +82 -11
  52. package/src/store/settings/initialState.ts +4 -27
  53. package/src/store/settings/selectors.ts +12 -7
  54. package/src/store/settings/store.ts +2 -2
  55. package/src/types/settings.ts +16 -8
  56. package/src/utils/storeDebug.ts +11 -0
  57. package/src/pages/chat/[id]/edit/AgentMeta/BackgroundSwatches.tsx +0 -31
  58. package/src/pages/chat/[id]/edit/AgentMeta/EmojiPicker.tsx +0 -78
  59. package/src/pages/chat/[id]/edit/AgentMeta/index.tsx +0 -111
  60. /package/src/pages/chat/[id]/{Config → Sidebar}/Header.tsx +0 -0
  61. /package/src/pages/chat/[id]/{Config → Sidebar}/Topic/DefaultContent.tsx +0 -0
  62. /package/src/pages/chat/[id]/{Config → Sidebar}/Topic/TopicItem.tsx +0 -0
  63. /package/src/pages/chat/[id]/{Config → Sidebar}/Topic/index.tsx +0 -0
  64. /package/src/pages/chat/[id]/{edit → setting}/Header.tsx +0 -0
  65. /package/src/pages/{setting → settings}/Header.tsx +0 -0
  66. /package/src/pages/{setting → settings}/ThemeSwatches/ThemeSwatchesNeutral.tsx +0 -0
  67. /package/src/pages/{setting → settings}/ThemeSwatches/ThemeSwatchesPrimary.tsx +0 -0
  68. /package/src/pages/{setting → settings}/ThemeSwatches/index.ts +0 -0
@@ -1,26 +1,41 @@
1
1
  import { ThemeMode } from 'antd-style';
2
+ import { produce } from 'immer';
3
+ import { merge } from 'lodash-es';
2
4
  import type { StateCreator } from 'zustand/vanilla';
3
5
 
6
+ import { DEFAULT_AGENT, DEFAULT_BASE_SETTINGS, DEFAULT_SETTINGS } from '@/const/settings';
7
+ import { MetaData } from '@/types/meta';
8
+ import type { LobeAgentSession } from '@/types/session';
9
+ import { LobeAgentConfig } from '@/types/session';
4
10
  import type { GlobalSettings } from '@/types/settings';
11
+ import { setNamespace } from '@/utils/storeDebug';
5
12
 
6
13
  import type { SidebarTabKey } from './initialState';
7
- import { DEFAULT_SETTINGS, SettingsState } from './initialState';
14
+ import { AppSettingsState } from './initialState';
8
15
  import type { SettingsStore } from './store';
9
16
 
17
+ const t = setNamespace('settings');
18
+
10
19
  /**
11
20
  * 设置操作
12
21
  */
13
22
  export interface SettingsAction {
14
- importSettings: (settings: GlobalSettings) => void;
23
+ importAppSettings: (settings: GlobalSettings) => void;
24
+ resetAgentConfig: () => void;
25
+ resetAgentMeta: () => void;
26
+ resetBaseSettings: () => void;
27
+ resetDefaultAgent: () => void;
15
28
  /**
16
29
  * 重置设置
17
30
  */
18
31
  resetSettings: () => void;
32
+ setAgentConfig: (config: Partial<LobeAgentSession['config']>) => void;
33
+ setAgentMeta: (meta: Partial<LobeAgentSession['meta']>) => void;
19
34
  /**
20
35
  * 设置全局设置
21
36
  * @param settings - 全局设置
22
37
  */
23
- setGlobalSettings: (settings: SettingsState) => void;
38
+ setAppSettings: (settings: AppSettingsState) => void;
24
39
  /**
25
40
  * 设置部分配置设置
26
41
  * @param settings - 部分配置设置
@@ -37,6 +52,7 @@ export interface SettingsAction {
37
52
  */
38
53
  switchSideBar: (key: SidebarTabKey) => void;
39
54
  toggleAgentPanel: (visible?: boolean) => void;
55
+ toggleAgentPlugin: (pluginId: string) => void;
40
56
  }
41
57
 
42
58
  export const createSettings: StateCreator<
@@ -45,10 +61,10 @@ export const createSettings: StateCreator<
45
61
  [],
46
62
  SettingsAction
47
63
  > = (set, get) => ({
48
- importSettings: (importSettings) => {
64
+ importAppSettings: (importAppSettings) => {
49
65
  const { setSettings } = get();
50
66
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
51
- const { OPENAI_API_KEY: _, password: __, ...settings } = importSettings;
67
+ const { OPENAI_API_KEY: _, password: __, ...settings } = importAppSettings;
52
68
 
53
69
  setSettings({
54
70
  ...settings,
@@ -56,25 +72,80 @@ export const createSettings: StateCreator<
56
72
  avatar: !get().settings.avatar ? settings.avatar : get().settings.avatar,
57
73
  });
58
74
  },
75
+ resetAgentConfig: () => {
76
+ const settings = produce(get().settings, (draft: GlobalSettings) => {
77
+ draft.defaultAgent.config = DEFAULT_AGENT.config;
78
+ });
79
+ set({ settings }, false, t('resetAgentConfig'));
80
+ },
81
+ resetAgentMeta: () => {
82
+ const settings = produce(get().settings, (draft: GlobalSettings) => {
83
+ draft.defaultAgent.meta = DEFAULT_AGENT.meta;
84
+ });
85
+ set({ settings }, false, t('resetAgentMeta'));
86
+ },
87
+ resetBaseSettings: () => {
88
+ const settings = get().settings;
89
+
90
+ set({ settings: { ...settings, ...DEFAULT_BASE_SETTINGS } }, false, t('resetBaseSettings'));
91
+ },
92
+ resetDefaultAgent: () => {
93
+ const settings = produce(get().settings, (draft: GlobalSettings) => {
94
+ draft.defaultAgent = DEFAULT_AGENT;
95
+ });
96
+ set({ settings }, false, t('resetDefaultAgent'));
97
+ },
59
98
  resetSettings: () => {
60
- set({ settings: DEFAULT_SETTINGS });
99
+ set({ settings: DEFAULT_SETTINGS }, false, t('resetSettings'));
61
100
  },
62
- setGlobalSettings: (settings) => {
63
- set({ ...settings });
101
+ setAgentConfig: (config) => {
102
+ const settings = produce(get().settings, (draft: GlobalSettings) => {
103
+ const oldConfig = draft.defaultAgent.config as LobeAgentConfig;
104
+ draft.defaultAgent.config = merge(oldConfig, config);
105
+ });
106
+
107
+ set({ settings }, false, t('setAgentConfig', config));
108
+ },
109
+ setAgentMeta: (meta) => {
110
+ const settings = produce(get().settings, (draft) => {
111
+ const oldMeta = draft.defaultAgent.meta as MetaData;
112
+ draft.defaultAgent.meta = merge(oldMeta, meta);
113
+ });
114
+
115
+ set({ settings }, false, t('setAgentMeta', meta));
116
+ },
117
+ setAppSettings: (settings) => {
118
+ set({ ...settings }, false, t('setAppSettings', settings));
64
119
  },
65
120
  setSettings: (settings) => {
66
121
  const oldSetting = get().settings;
67
- set({ settings: { ...oldSetting, ...settings } });
122
+ set({ settings: merge(oldSetting, settings) }, false, t('setSettings', settings));
68
123
  },
69
124
  setThemeMode: (themeMode) => {
70
125
  get().setSettings({ themeMode });
71
126
  },
72
127
  switchSideBar: (key) => {
73
- set({ sidebarKey: key });
128
+ set({ sidebarKey: key }, false, t('switchSideBar', key));
74
129
  },
75
130
  toggleAgentPanel: (newValue) => {
76
131
  const showAgentConfig = typeof newValue === 'boolean' ? newValue : !get().showAgentConfig;
77
132
 
78
- set({ showAgentConfig });
133
+ set({ showAgentConfig }, false, t('toggleAgentPanel', newValue));
134
+ },
135
+ toggleAgentPlugin: (id: string) => {
136
+ const settings = produce(get().settings, (draft: GlobalSettings) => {
137
+ const oldConfig = draft.defaultAgent.config as LobeAgentConfig;
138
+ if (oldConfig.plugins === undefined) {
139
+ oldConfig.plugins = [id];
140
+ } else {
141
+ if (oldConfig.plugins.includes(id)) {
142
+ oldConfig.plugins.splice(oldConfig.plugins.indexOf(id), 1);
143
+ } else {
144
+ oldConfig.plugins.push(id);
145
+ }
146
+ }
147
+ });
148
+
149
+ set({ settings }, false, t('toggleAgentPlugin', id));
79
150
  },
80
151
  });
@@ -1,32 +1,9 @@
1
- import { LanguageModel } from '@/types/llm';
1
+ import { DEFAULT_SETTINGS } from '@/const/settings';
2
2
  import type { GlobalSettings } from '@/types/settings';
3
3
 
4
- export type SidebarTabKey = 'chat' | 'market' | 'setting';
4
+ export type SidebarTabKey = 'chat' | 'market' | 'settings';
5
5
 
6
- export const DEFAULT_SETTINGS: GlobalSettings = {
7
- OPENAI_API_KEY: '',
8
- avatar: '',
9
- compressThreshold: 24,
10
- enableCompressThreshold: false,
11
- enableHistoryCount: false,
12
- enableMaxTokens: true,
13
- endpoint: '',
14
- fontSize: 14,
15
- frequencyPenalty: 0,
16
- historyCount: 24,
17
- language: 'zh-CN',
18
- maxTokens: 2000,
19
- model: LanguageModel.GPT3_5,
20
- neutralColor: '',
21
- password: '',
22
- presencePenalty: 0,
23
- primaryColor: '',
24
- temperature: 0.5,
25
- themeMode: 'auto',
26
- topP: 1,
27
- };
28
-
29
- export interface SettingsState {
6
+ export interface AppSettingsState {
30
7
  inputHeight: number;
31
8
  sessionExpandable?: boolean;
32
9
  sessionsWidth: number;
@@ -35,7 +12,7 @@ export interface SettingsState {
35
12
  sidebarKey: SidebarTabKey;
36
13
  }
37
14
 
38
- export const initialState: SettingsState = {
15
+ export const initialState: AppSettingsState = {
39
16
  inputHeight: 200,
40
17
  sessionExpandable: true,
41
18
  sessionsWidth: 320,
@@ -1,16 +1,20 @@
1
1
  import { defaults } from 'lodash-es';
2
2
 
3
- import { DEFAULT_SETTINGS } from '@/store/settings/initialState';
3
+ import { DEFAULT_AGENT_META } from '@/const/meta';
4
+ import { DEFAULT_AGENT, DEFAULT_AGENT_CONFIG, DEFAULT_SETTINGS } from '@/const/settings';
4
5
  import { GlobalSettings } from '@/types/settings';
5
6
 
6
7
  import { SettingsStore } from './store';
7
8
 
8
9
  const currentSettings = (s: SettingsStore) => defaults(s.settings, DEFAULT_SETTINGS);
9
10
 
10
- const selecThemeMode = (s: SettingsStore) => ({
11
- setThemeMode: s.setThemeMode,
12
- themeMode: s.settings.themeMode,
13
- });
11
+ const currentDefaultAgent = (s: SettingsStore) => defaults(s.settings.defaultAgent, DEFAULT_AGENT);
12
+
13
+ const currentAgentConfig = (s: SettingsStore) =>
14
+ defaults(s.settings.defaultAgent.config, DEFAULT_AGENT_CONFIG);
15
+
16
+ const currentAgentMeta = (s: SettingsStore) =>
17
+ defaults(s.settings.defaultAgent.meta, DEFAULT_AGENT_META);
14
18
 
15
19
  export const exportSettings = (s: SettingsStore) => {
16
20
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -20,8 +24,9 @@ export const exportSettings = (s: SettingsStore) => {
20
24
  };
21
25
 
22
26
  export const settingsSelectors = {
27
+ currentAgentConfig,
28
+ currentAgentMeta,
29
+ currentDefaultAgent,
23
30
  currentSettings,
24
31
  exportSettings,
25
-
26
- selecThemeMode,
27
32
  };
@@ -1,9 +1,9 @@
1
1
  import { StateCreator } from 'zustand/vanilla';
2
2
 
3
3
  import { type SettingsAction, createSettings } from './action';
4
- import { type SettingsState, initialState } from './initialState';
4
+ import { type AppSettingsState, initialState } from './initialState';
5
5
 
6
- export type SettingsStore = SettingsAction & SettingsState;
6
+ export type SettingsStore = SettingsAction & AppSettingsState;
7
7
 
8
8
  export const createStore: StateCreator<SettingsStore, [['zustand/devtools', never]]> = (
9
9
  ...parameters
@@ -1,13 +1,11 @@
1
- import { NeutralColors, PrimaryColors } from '@lobehub/ui';
2
- import { ThemeMode } from 'antd-style';
1
+ import type { NeutralColors, PrimaryColors } from '@lobehub/ui';
2
+ import type { ThemeMode } from 'antd-style';
3
3
 
4
- import { Locales } from '@/locales/resources';
5
- import { LanguageModel } from '@/types/llm';
4
+ import type { Locales } from '@/locales/resources';
5
+ import type { LanguageModel } from '@/types/llm';
6
+ import type { LobeAgentSession } from '@/types/session';
6
7
 
7
- /**
8
- * 配置设置
9
- */
10
- export interface GlobalSettings {
8
+ export interface GlobalBaseSettings {
11
9
  OPENAI_API_KEY: string;
12
10
  avatar: string;
13
11
  compressThreshold: number;
@@ -29,4 +27,14 @@ export interface GlobalSettings {
29
27
  themeMode: ThemeMode;
30
28
  topP: number;
31
29
  }
30
+
31
+ export type GlobalDefaultAgent = Partial<LobeAgentSession>;
32
+
33
+ /**
34
+ * 配置设置
35
+ */
36
+ export interface GlobalSettings extends GlobalBaseSettings {
37
+ defaultAgent: GlobalDefaultAgent;
38
+ }
39
+
32
40
  export type ConfigKeys = keyof GlobalSettings;
@@ -0,0 +1,11 @@
1
+ export const setNamespace = (namespace: string) => {
2
+ return (type: string, payload?: any) => {
3
+ const name = [namespace, type].filter(Boolean).join('/');
4
+ return payload
5
+ ? {
6
+ payload,
7
+ type: name,
8
+ }
9
+ : name;
10
+ };
11
+ };
@@ -1,31 +0,0 @@
1
- import { Swatches, primaryColorsSwatches } from '@lobehub/ui';
2
- import { memo } from 'react';
3
- import { shallow } from 'zustand/shallow';
4
-
5
- import { DEFAULT_BACKGROUND_COLOR } from '@/const/meta';
6
- import { agentSelectors, useSessionStore } from '@/store/session';
7
-
8
- const BackgroundSwatches = memo(() => {
9
- const [backgroundColor, updateAgentMeta] = useSessionStore(
10
- (s) => [agentSelectors.currentAgentBackgroundColor(s), s.updateAgentMeta],
11
- shallow,
12
- );
13
-
14
- const handleSelect = (v: any) => {
15
- if (v) {
16
- updateAgentMeta({ backgroundColor: v });
17
- } else {
18
- updateAgentMeta({ backgroundColor: DEFAULT_BACKGROUND_COLOR });
19
- }
20
- };
21
-
22
- return (
23
- <Swatches
24
- activeColor={backgroundColor}
25
- colors={primaryColorsSwatches}
26
- onSelect={handleSelect}
27
- />
28
- );
29
- });
30
-
31
- export default BackgroundSwatches;
@@ -1,78 +0,0 @@
1
- import data from '@emoji-mart/data';
2
- import i18n from '@emoji-mart/data/i18n/zh.json';
3
- import Picker from '@emoji-mart/react';
4
- import { Avatar } from '@lobehub/ui';
5
- import { Popover } from 'antd';
6
- import { createStyles } from 'antd-style';
7
- import chroma from 'chroma-js';
8
- import { memo } from 'react';
9
- import { shallow } from 'zustand/shallow';
10
-
11
- import { useSessionStore } from '@/store/session';
12
- import { agentSelectors } from '@/store/session/selectors';
13
-
14
- const useStyles = createStyles(({ css, token, prefixCls }) => ({
15
- avatar: css`
16
- border-radius: 50%;
17
- transition: scale 400ms ${token.motionEaseOut}, box-shadow 100ms ${token.motionEaseOut};
18
-
19
- &:hover {
20
- box-shadow: 0 0 0 3px ${token.colorText};
21
- }
22
-
23
- &:active {
24
- scale: 0.8;
25
- }
26
- `,
27
- picker: css`
28
- em-emoji-picker {
29
- --rgb-accent: ${chroma(token.colorPrimary) .rgb() .join(',')};
30
- --shadow: none;
31
- }
32
- `,
33
- popover: css`
34
- .${prefixCls}-popover-inner {
35
- padding: 0;
36
- }
37
- `,
38
- }));
39
-
40
- const EmojiPicker = () => {
41
- const { styles } = useStyles();
42
- const [avatar, backgroundColor, updateAgentMeta] = useSessionStore(
43
- (s) => [
44
- agentSelectors.currentAgentAvatar(s),
45
- agentSelectors.currentAgentBackgroundColor(s),
46
- s.updateAgentMeta,
47
- ],
48
- shallow,
49
- );
50
-
51
- return (
52
- <Popover
53
- content={
54
- <div className={styles.picker}>
55
- <Picker
56
- data={data}
57
- i18n={i18n}
58
- locale={'zh'}
59
- onEmojiSelect={(e: any) => {
60
- updateAgentMeta({ avatar: e.native });
61
- }}
62
- skinTonePosition={'none'}
63
- theme={'auto'}
64
- />
65
- </div>
66
- }
67
- placement={'left'}
68
- rootClassName={styles.popover}
69
- trigger={'click'}
70
- >
71
- <div className={styles.avatar} style={{ width: 'fit-content' }}>
72
- <Avatar avatar={avatar} background={backgroundColor} size={44} />
73
- </div>
74
- </Popover>
75
- );
76
- };
77
-
78
- export default memo(EmojiPicker);
@@ -1,111 +0,0 @@
1
- import { Form, Icon, type ItemGroup, Tooltip } from '@lobehub/ui';
2
- import { Button } from 'antd';
3
- import isEqual from 'fast-deep-equal';
4
- import { UserCircle, Wand2 } from 'lucide-react';
5
- import { memo, useMemo } from 'react';
6
- import { useTranslation } from 'react-i18next';
7
- import { shallow } from 'zustand/shallow';
8
-
9
- import { FORM_STYLE } from '@/const/layoutTokens';
10
- import { agentSelectors, useSessionStore } from '@/store/session';
11
-
12
- import AutoGenerateInput from './AutoGenerateInput';
13
- import BackgroundSwatches from './BackgroundSwatches';
14
- import EmojiPicker from './EmojiPicker';
15
-
16
- const AgentMeta = memo(() => {
17
- const { t } = useTranslation('setting');
18
-
19
- const metaData = useSessionStore(agentSelectors.currentAgentMeta, isEqual);
20
-
21
- const [
22
- autocompleteMeta,
23
- autocompleteSessionAgentMeta,
24
- loading,
25
- updateAgentMeta,
26
- id,
27
- hasSystemRole,
28
- ] = useSessionStore(
29
- (s) => [
30
- s.autocompleteMeta,
31
- s.autocompleteSessionAgentMeta,
32
- s.autocompleteLoading,
33
- s.updateAgentMeta,
34
- s.activeId,
35
- agentSelectors.hasSystemRole(s),
36
- ],
37
- shallow,
38
- );
39
-
40
- const basic = [
41
- {
42
- key: 'title',
43
- label: t('settingAgent.name.title'),
44
- placeholder: t('settingAgent.name.placeholder'),
45
- },
46
- {
47
- key: 'description',
48
- label: t('settingAgent.description.title'),
49
- placeholder: t('settingAgent.description.placeholder'),
50
- },
51
- // { key: 'tag', label: t('agentTag'), placeholder: t('agentTagPlaceholder') },
52
- ];
53
-
54
- const meta: ItemGroup = useMemo(
55
- () => ({
56
- children: [
57
- {
58
- children: <EmojiPicker />,
59
- label: t('settingAgent.avatar.title'),
60
- minWidth: undefined,
61
- },
62
- {
63
- children: <BackgroundSwatches />,
64
- label: t('settingAgent.backgroundColor.title'),
65
- minWidth: undefined,
66
- },
67
- ...basic.map((item) => ({
68
- children: (
69
- <AutoGenerateInput
70
- loading={loading[item.key as keyof typeof loading]}
71
- onChange={(e) => {
72
- updateAgentMeta({ [item.key]: e.target.value });
73
- }}
74
- onGenerate={() => {
75
- autocompleteMeta(item.key as keyof typeof metaData);
76
- }}
77
- placeholder={item.placeholder}
78
- value={metaData[item.key as keyof typeof metaData]}
79
- />
80
- ),
81
- label: item.label,
82
- })),
83
- ],
84
- extra: (
85
- <Tooltip title={t('autoGenerateTooltip', { ns: 'common' })}>
86
- <Button
87
- disabled={!hasSystemRole}
88
- icon={<Icon icon={Wand2} />}
89
- loading={Object.values(loading).some((i) => !!i)}
90
- onClick={(e: any) => {
91
- e.stopPropagation();
92
- console.log(id);
93
- if (!id) return;
94
- autocompleteSessionAgentMeta(id, true);
95
- }}
96
- size={'small'}
97
- >
98
- {t('autoGenerate', { ns: 'common' })}
99
- </Button>
100
- </Tooltip>
101
- ),
102
- icon: UserCircle,
103
- title: t('settingAgent.title'),
104
- }),
105
- [basic, metaData],
106
- );
107
-
108
- return <Form items={[meta]} {...FORM_STYLE} />;
109
- });
110
-
111
- export default AgentMeta;
File without changes