@lobehub/chat 0.33.0 → 0.34.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.
- package/CHANGELOG.md +27 -0
- package/package.json +2 -2
- package/src/components/EmojiPicker/index.tsx +48 -0
- package/src/components/EmojiPicker/style.ts +28 -0
- package/src/const/meta.ts +3 -0
- package/src/const/settings.ts +50 -0
- package/src/{pages/chat/[id]/edit → features/AgentSetting}/AgentConfig/index.tsx +13 -11
- package/src/{pages/chat/[id]/edit → features/AgentSetting}/AgentMeta/AutoGenerateInput.tsx +16 -14
- package/src/features/AgentSetting/AgentMeta/BackgroundSwatches.tsx +27 -0
- package/src/features/AgentSetting/AgentMeta/index.tsx +128 -0
- package/src/{pages/chat/[id]/edit → features/AgentSetting}/AgentPlugin/index.tsx +12 -12
- package/src/{pages/chat/[id]/edit → features/AgentSetting}/AgentPrompt/index.tsx +13 -16
- package/src/features/AgentSetting/index.ts +4 -0
- package/src/features/AgentSetting/test.json +40 -0
- package/src/features/SideBar/{BottomAction.tsx → BottomActions.tsx} +15 -5
- package/src/features/SideBar/TopActions.tsx +42 -0
- package/src/features/SideBar/index.tsx +5 -30
- package/src/hooks/useImportConfig.ts +3 -3
- package/src/locales/default/common.ts +4 -0
- package/src/locales/default/setting.ts +4 -0
- package/src/pages/chat/[id]/Conversation/ChatList/index.tsx +1 -1
- package/src/pages/chat/[id]/Conversation/Input/Action.tsx +1 -1
- package/src/pages/chat/[id]/Header.tsx +1 -1
- package/src/pages/chat/[id]/{Config/SideBar.tsx → Sidebar/Inner.tsx} +2 -2
- package/src/pages/chat/[id]/{Config → Sidebar}/Topic/TopicContent.tsx +4 -6
- package/src/pages/chat/[id]/{Config → Sidebar}/index.tsx +2 -2
- package/src/pages/chat/[id]/index.page.tsx +1 -1
- package/src/pages/chat/[id]/{edit → setting}/index.page.tsx +23 -9
- package/src/pages/settings/Settings/Agent.tsx +25 -0
- package/src/pages/{setting/SettingForm.tsx → settings/Settings/Common.tsx} +7 -113
- package/src/pages/settings/Settings/index.tsx +50 -0
- package/src/pages/{setting → settings}/index.page.tsx +2 -2
- package/src/pages/{setting → settings}/layout.tsx +1 -1
- package/src/plugins/searchEngine/Render.tsx +3 -1
- package/src/store/session/slices/agentConfig/action.ts +8 -1
- package/src/store/session/slices/agentConfig/initialState.ts +2 -13
- package/src/store/session/slices/agentConfig/selectors.ts +13 -9
- package/src/store/session/slices/chat/actions/message.ts +12 -5
- package/src/store/session/slices/chat/actions/topic.ts +4 -2
- package/src/store/session/slices/chat/selectors/chat.ts +1 -1
- package/src/store/session/slices/session/action.ts +23 -16
- package/src/store/session/slices/session/initialState.ts +2 -1
- package/src/store/settings/action.ts +82 -11
- package/src/store/settings/initialState.ts +4 -27
- package/src/store/settings/selectors.ts +12 -7
- package/src/store/settings/store.ts +2 -2
- package/src/types/settings.ts +16 -8
- package/src/utils/storeDebug.ts +11 -0
- package/src/pages/chat/[id]/edit/AgentMeta/BackgroundSwatches.tsx +0 -31
- package/src/pages/chat/[id]/edit/AgentMeta/EmojiPicker.tsx +0 -78
- package/src/pages/chat/[id]/edit/AgentMeta/index.tsx +0 -111
- /package/src/pages/chat/[id]/{Config → Sidebar}/Header.tsx +0 -0
- /package/src/pages/chat/[id]/{Config → Sidebar}/Topic/DefaultContent.tsx +0 -0
- /package/src/pages/chat/[id]/{Config → Sidebar}/Topic/TopicItem.tsx +0 -0
- /package/src/pages/chat/[id]/{Config → Sidebar}/Topic/index.tsx +0 -0
- /package/src/pages/chat/[id]/{edit → setting}/Header.tsx +0 -0
- /package/src/pages/{setting → settings}/Header.tsx +0 -0
- /package/src/pages/{setting → settings}/ThemeSwatches/ThemeSwatchesNeutral.tsx +0 -0
- /package/src/pages/{setting → settings}/ThemeSwatches/ThemeSwatchesPrimary.tsx +0 -0
- /package/src/pages/{setting → settings}/ThemeSwatches/index.ts +0 -0
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|