@lobehub/chat 0.152.5 → 0.152.7
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 +50 -0
- package/README.md +8 -8
- package/README.zh-CN.md +8 -8
- package/docs/self-hosting/advanced/settings-url-share.mdx +100 -0
- package/docs/self-hosting/advanced/settings-url-share.zh-CN.mdx +100 -0
- package/locales/ar/common.json +1 -0
- package/locales/ar/setting.json +4 -1
- package/locales/bg-BG/common.json +1 -0
- package/locales/bg-BG/setting.json +4 -1
- package/locales/de-DE/common.json +1 -0
- package/locales/de-DE/setting.json +4 -1
- package/locales/en-US/common.json +1 -0
- package/locales/en-US/setting.json +4 -1
- package/locales/es-ES/common.json +1 -0
- package/locales/es-ES/setting.json +4 -1
- package/locales/fr-FR/common.json +1 -0
- package/locales/fr-FR/setting.json +4 -1
- package/locales/it-IT/common.json +1 -0
- package/locales/it-IT/setting.json +4 -1
- package/locales/ja-JP/common.json +1 -0
- package/locales/ja-JP/setting.json +4 -1
- package/locales/ko-KR/common.json +1 -0
- package/locales/ko-KR/setting.json +4 -1
- package/locales/nl-NL/common.json +1 -0
- package/locales/nl-NL/setting.json +4 -1
- package/locales/pl-PL/common.json +1 -0
- package/locales/pl-PL/setting.json +4 -1
- package/locales/pt-BR/common.json +1 -0
- package/locales/pt-BR/setting.json +4 -1
- package/locales/ru-RU/common.json +1 -0
- package/locales/ru-RU/setting.json +4 -1
- package/locales/tr-TR/common.json +1 -0
- package/locales/tr-TR/setting.json +4 -1
- package/locales/vi-VN/common.json +1 -0
- package/locales/vi-VN/setting.json +4 -1
- package/locales/zh-CN/common.json +1 -0
- package/locales/zh-CN/setting.json +4 -1
- package/locales/zh-TW/common.json +1 -0
- package/locales/zh-TW/setting.json +4 -1
- package/package.json +1 -1
- package/src/app/(main)/(mobile)/me/features/AvatarBanner.tsx +52 -0
- package/src/app/(main)/(mobile)/me/features/Cate.tsx +35 -0
- package/src/app/(main)/(mobile)/me/features/ExtraCate.tsx +26 -0
- package/src/app/(main)/(mobile)/me/features/useExtraCate.tsx +62 -0
- package/src/app/(main)/(mobile)/me/layout.tsx +11 -0
- package/src/app/(main)/(mobile)/me/loading.tsx +17 -0
- package/src/app/(main)/(mobile)/me/page.tsx +31 -0
- package/src/app/(main)/@nav/_layout/Desktop/index.tsx +1 -1
- package/src/app/(main)/@nav/_layout/Mobile.tsx +3 -3
- package/src/app/(main)/chat/(mobile)/features/SessionHeader.tsx +1 -1
- package/src/app/(main)/chat/_layout/Desktop/index.tsx +6 -8
- package/src/app/(main)/chat/_layout/Mobile/index.tsx +5 -3
- package/src/app/(main)/chat/_layout/type.ts +5 -0
- package/src/app/(main)/chat/features/SettingButton.tsx +3 -4
- package/src/app/(main)/chat/layout.ts +5 -2
- package/src/app/(main)/chat/settings/{(desktop) → _layout/Desktop}/Header.tsx +2 -0
- package/src/app/(main)/chat/settings/_layout/Desktop/index.tsx +28 -0
- package/src/app/(main)/chat/settings/{(mobile) → _layout/Mobile}/Header.tsx +3 -2
- package/src/app/(main)/chat/settings/_layout/Mobile/index.tsx +15 -0
- package/src/app/(main)/chat/settings/error.tsx +5 -0
- package/src/app/(main)/chat/settings/features/HeaderContent.tsx +15 -9
- package/src/app/(main)/chat/settings/features/SubmitAgentButton/SubmitAgentModal.tsx +2 -0
- package/src/app/(main)/chat/settings/features/SubmitAgentButton/index.tsx +16 -8
- package/src/app/(main)/chat/settings/layout.tsx +9 -2
- package/src/app/(main)/chat/settings/loading.tsx +3 -0
- package/src/app/(main)/chat/settings/not-found.tsx +3 -0
- package/src/app/(main)/chat/settings/page.tsx +2 -9
- package/src/app/(main)/market/@detail/default.tsx +1 -10
- package/src/app/(main)/market/{@detail/_layout/Desktop.tsx → _layout/Desktop/DetailSidebar.tsx} +2 -2
- package/src/app/(main)/market/_layout/Desktop/index.tsx +2 -1
- package/src/app/(main)/market/{@detail/_layout/Mobile.tsx → _layout/Mobile/DetailModal.tsx} +2 -2
- package/src/app/(main)/market/_layout/Mobile/index.tsx +3 -1
- package/src/app/(main)/settings/@category/default.tsx +16 -0
- package/src/app/(main)/settings/@category/features/CategoryContent.tsx +33 -0
- package/src/app/(main)/settings/@category/features/UpgradeAlert.tsx +38 -0
- package/src/app/(main)/settings/_layout/Desktop/Header.tsx +78 -23
- package/src/app/(main)/settings/_layout/Desktop/SideBar.tsx +39 -27
- package/src/app/(main)/settings/_layout/Desktop/index.tsx +41 -17
- package/src/app/(main)/settings/_layout/Mobile/{SubSettingHeader.tsx → Header.tsx} +3 -1
- package/src/app/(main)/settings/_layout/Mobile/index.tsx +7 -18
- package/src/app/(main)/settings/_layout/type.ts +6 -0
- package/src/app/(main)/settings/about/features/AboutList.tsx +134 -0
- package/src/app/(main)/settings/about/features/Analytics.tsx +42 -0
- package/src/app/(main)/settings/about/index.tsx +46 -0
- package/src/app/(main)/settings/about/page.tsx +13 -33
- package/src/app/(main)/settings/agent/{Agent.tsx → index.tsx} +8 -4
- package/src/app/(main)/settings/agent/page.tsx +8 -16
- package/src/app/(main)/settings/common/{Common.tsx → features/Common.tsx} +6 -4
- package/src/app/(main)/settings/common/{Theme.tsx → features/Theme/index.tsx} +8 -6
- package/src/app/(main)/settings/common/index.tsx +11 -16
- package/src/app/(main)/settings/common/page.tsx +8 -7
- package/src/app/(main)/settings/error.tsx +5 -0
- package/src/app/(main)/settings/features/Footer.tsx +2 -0
- package/src/app/(main)/settings/features/UpgradeAlert.tsx +21 -13
- package/src/app/(main)/settings/hooks/useCategory.tsx +54 -0
- package/src/app/(main)/settings/hooks/useSyncSettings.ts +2 -2
- package/src/app/(main)/settings/layout.ts +4 -1
- package/src/app/(main)/settings/llm/Anthropic/index.tsx +4 -8
- package/src/app/(main)/settings/llm/Azure/index.tsx +3 -1
- package/src/app/(main)/settings/llm/Bedrock/index.tsx +3 -1
- package/src/app/(main)/settings/llm/Google/index.tsx +4 -2
- package/src/app/(main)/settings/llm/Groq/index.tsx +3 -1
- package/src/app/(main)/settings/llm/Minimax/index.tsx +3 -9
- package/src/app/(main)/settings/llm/Mistral/index.tsx +3 -9
- package/src/app/(main)/settings/llm/Moonshot/index.tsx +3 -1
- package/src/app/(main)/settings/llm/Ollama/index.tsx +3 -1
- package/src/app/(main)/settings/llm/OpenAI/index.tsx +2 -0
- package/src/app/(main)/settings/llm/OpenRouter/index.tsx +3 -9
- package/src/app/(main)/settings/llm/Perplexity/index.tsx +3 -9
- package/src/app/(main)/settings/llm/TogetherAI/index.tsx +3 -9
- package/src/app/(main)/settings/llm/ZeroOne/index.tsx +3 -9
- package/src/app/(main)/settings/llm/Zhipu/index.tsx +3 -10
- package/src/app/(main)/settings/llm/components/Checker.tsx +2 -0
- package/src/app/(main)/settings/llm/components/Footer.tsx +26 -0
- package/src/app/(main)/settings/llm/components/ProviderConfig/index.tsx +29 -3
- package/src/app/(main)/settings/llm/index.tsx +11 -23
- package/src/app/(main)/settings/llm/page.tsx +15 -0
- package/src/app/(main)/settings/loading.tsx +9 -0
- package/src/app/(main)/settings/not-found.tsx +3 -0
- package/src/app/(main)/settings/page.tsx +2 -14
- package/src/app/(main)/settings/sync/{DeviceInfo → features/DeviceInfo}/Card.tsx +6 -5
- package/src/app/(main)/settings/sync/features/DeviceInfo/DeviceName.tsx +63 -0
- package/src/app/(main)/settings/sync/{components → features/DeviceInfo}/SystemIcon.tsx +6 -14
- package/src/app/(main)/settings/sync/{DeviceInfo → features/DeviceInfo}/index.tsx +22 -36
- package/src/app/(main)/settings/sync/{WebRTC → features/WebRTC}/ChannelNameInput.tsx +3 -3
- package/src/app/(main)/settings/sync/{WebRTC → features/WebRTC}/index.tsx +10 -9
- package/src/app/(main)/settings/sync/index.tsx +17 -0
- package/src/app/(main)/settings/sync/page.tsx +11 -15
- package/src/app/(main)/settings/tts/features/OpenAI.tsx +54 -0
- package/src/app/(main)/settings/tts/{TTS/index.tsx → features/STT.tsx} +11 -27
- package/src/app/(main)/settings/tts/index.tsx +15 -0
- package/src/app/(main)/settings/tts/page.tsx +8 -16
- package/src/app/layout.tsx +6 -2
- package/src/components/BrandWatermark/index.tsx +39 -0
- package/src/components/Cell/Divider.tsx +19 -0
- package/src/components/Cell/index.tsx +38 -0
- package/src/components/Menu/index.tsx +97 -0
- package/src/components/SkeletonLoading/index.tsx +21 -0
- package/src/const/url.ts +2 -0
- package/src/features/AgentSetting/AgentChat/index.tsx +135 -0
- package/src/features/AgentSetting/AgentMeta/index.tsx +4 -3
- package/src/features/AgentSetting/AgentModal/index.tsx +95 -0
- package/src/features/AgentSetting/AgentPlugin/index.tsx +65 -66
- package/src/features/AgentSetting/AgentPrompt/index.tsx +101 -47
- package/src/features/AgentSetting/AgentTTS/index.tsx +4 -0
- package/src/features/AgentSetting/StoreUpdater.tsx +2 -0
- package/src/features/AgentSetting/index.tsx +6 -6
- package/src/features/AgentSetting/store/index.ts +2 -0
- package/src/features/AvatarWithUpload/index.tsx +2 -0
- package/src/features/Conversation/components/ChatItem/HistoryDivider.tsx +1 -1
- package/src/hooks/useQuery.test.ts +20 -0
- package/src/hooks/useQuery.ts +7 -0
- package/src/hooks/useQueryRoute.test.ts +86 -0
- package/src/hooks/useQueryRoute.ts +46 -0
- package/src/locales/default/common.ts +1 -0
- package/src/locales/default/setting.ts +3 -0
- package/src/store/global/initialState.ts +1 -0
- package/src/store/user/slices/common/action.test.ts +1 -1
- package/src/app/(main)/chat/settings/(desktop)/index.tsx +0 -23
- package/src/app/(main)/chat/settings/(mobile)/index.tsx +0 -16
- package/src/app/(main)/settings/(desktop)/index.tsx +0 -23
- package/src/app/(main)/settings/(mobile)/features/AvatarBanner.tsx +0 -68
- package/src/app/(main)/settings/(mobile)/features/ExtraList.tsx +0 -65
- package/src/app/(main)/settings/(mobile)/index.tsx +0 -53
- package/src/app/(main)/settings/about/AboutList.tsx +0 -53
- package/src/app/(main)/settings/about/Analytics.tsx +0 -40
- package/src/app/(main)/settings/about/style.ts +0 -22
- package/src/app/(main)/settings/agent/loading.tsx +0 -3
- package/src/app/(main)/settings/common/loading.tsx +0 -3
- package/src/app/(main)/settings/features/SettingList/index.tsx +0 -47
- package/src/app/(main)/settings/llm/layout.tsx +0 -11
- package/src/app/(main)/settings/llm/loading.tsx +0 -3
- package/src/app/(main)/settings/sync/DeviceInfo/DeviceName.tsx +0 -66
- package/src/app/(main)/settings/sync/PageTitle.tsx +0 -11
- package/src/app/(main)/settings/sync/layout.tsx +0 -12
- package/src/app/(main)/settings/sync/loading.tsx +0 -3
- package/src/app/(main)/settings/tts/loading.tsx +0 -3
- package/src/features/AgentSetting/AgentConfig/index.tsx +0 -202
- package/src/features/AgentSetting/AgentConfig/useSyncConfig.ts +0 -23
- /package/src/app/(main)/settings/{features/SettingList → about/features}/Item.tsx +0 -0
- /package/src/app/(main)/settings/{features → common/features/Theme}/ThemeSwatches/ThemeSwatchesNeutral.tsx +0 -0
- /package/src/app/(main)/settings/{features → common/features/Theme}/ThemeSwatches/ThemeSwatchesPrimary.tsx +0 -0
- /package/src/app/(main)/settings/{features → common/features/Theme}/ThemeSwatches/index.ts +0 -0
- /package/src/app/(main)/settings/sync/{Alert.tsx → features/Alert.tsx} +0 -0
- /package/src/app/(main)/settings/sync/{components → features/WebRTC}/SyncSwitch/index.css +0 -0
- /package/src/app/(main)/settings/sync/{components → features/WebRTC}/SyncSwitch/index.tsx +0 -0
- /package/src/app/(main)/settings/sync/{util.ts → features/WebRTC/generateRandomRoomName.ts} +0 -0
- /package/src/app/(main)/settings/tts/{TTS/options.ts → features/const.ts} +0 -0
- /package/src/features/AgentSetting/{AgentConfig → AgentModal}/ModelSelect.tsx +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Alert from './features/Alert';
|
|
2
|
+
import DeviceInfo from './features/DeviceInfo';
|
|
3
|
+
import WebRTC from './features/WebRTC';
|
|
4
|
+
|
|
5
|
+
const Page = ({ browser, os, mobile }: { browser?: string; mobile?: boolean; os?: string }) => {
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<DeviceInfo browser={browser} os={os} />
|
|
9
|
+
<WebRTC />
|
|
10
|
+
<Alert mobile={mobile} />
|
|
11
|
+
</>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
Page.displayName = 'SyncSetting';
|
|
16
|
+
|
|
17
|
+
export default Page;
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
import { notFound } from 'next/navigation';
|
|
2
2
|
|
|
3
3
|
import { serverFeatureFlags } from '@/config/server/featureFlags';
|
|
4
|
+
import { translation } from '@/server/translation';
|
|
4
5
|
import { gerServerDeviceInfo, isMobileDevice } from '@/utils/responsive';
|
|
5
6
|
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import Page from './index';
|
|
8
|
+
|
|
9
|
+
export const generateMetadata = async () => {
|
|
10
|
+
const { t } = await translation('setting');
|
|
11
|
+
return {
|
|
12
|
+
title: t('tab.sync'),
|
|
13
|
+
};
|
|
14
|
+
};
|
|
10
15
|
|
|
11
16
|
export default () => {
|
|
12
17
|
const enableWebrtc = serverFeatureFlags().enableWebrtc;
|
|
13
|
-
|
|
14
18
|
if (!enableWebrtc) return notFound();
|
|
15
19
|
|
|
16
|
-
const { os, browser } = gerServerDeviceInfo();
|
|
17
20
|
const isMobile = isMobileDevice();
|
|
21
|
+
const { os, browser } = gerServerDeviceInfo();
|
|
18
22
|
|
|
19
|
-
return
|
|
20
|
-
<>
|
|
21
|
-
{isMobile && <Alert mobile />}
|
|
22
|
-
<PageTitle />
|
|
23
|
-
<DeviceCard browser={browser} os={os} />
|
|
24
|
-
<WebRTC />
|
|
25
|
-
{!isMobile && <Alert />}
|
|
26
|
-
</>
|
|
27
|
-
);
|
|
23
|
+
return <Page browser={browser} mobile={isMobile} os={os} />;
|
|
28
24
|
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Form, type ItemGroup } from '@lobehub/ui';
|
|
4
|
+
import { Select } from 'antd';
|
|
5
|
+
import isEqual from 'fast-deep-equal';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
import { FORM_STYLE } from '@/const/layoutTokens';
|
|
10
|
+
import { useUserStore } from '@/store/user';
|
|
11
|
+
import { settingsSelectors } from '@/store/user/selectors';
|
|
12
|
+
|
|
13
|
+
import { opeanaiSTTOptions, opeanaiTTSOptions } from './const';
|
|
14
|
+
|
|
15
|
+
type SettingItemGroup = ItemGroup;
|
|
16
|
+
|
|
17
|
+
const TTS_SETTING_KEY = 'tts';
|
|
18
|
+
|
|
19
|
+
const OpenAI = memo(() => {
|
|
20
|
+
const { t } = useTranslation('setting');
|
|
21
|
+
const [form] = Form.useForm();
|
|
22
|
+
const settings = useUserStore(settingsSelectors.currentSettings, isEqual);
|
|
23
|
+
const [setSettings] = useUserStore((s) => [s.setSettings]);
|
|
24
|
+
|
|
25
|
+
const openai: SettingItemGroup = {
|
|
26
|
+
children: [
|
|
27
|
+
{
|
|
28
|
+
children: <Select options={opeanaiTTSOptions} />,
|
|
29
|
+
label: t('settingTTS.openai.ttsModel'),
|
|
30
|
+
name: [TTS_SETTING_KEY, 'openAI', 'ttsModel'],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
children: <Select options={opeanaiSTTOptions} />,
|
|
34
|
+
label: t('settingTTS.openai.sttModel'),
|
|
35
|
+
name: [TTS_SETTING_KEY, 'openAI', 'sttModel'],
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
title: t('settingTTS.openai.title'),
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Form
|
|
43
|
+
form={form}
|
|
44
|
+
initialValues={settings}
|
|
45
|
+
items={[openai]}
|
|
46
|
+
itemsType={'group'}
|
|
47
|
+
onValuesChange={setSettings}
|
|
48
|
+
variant={'pure'}
|
|
49
|
+
{...FORM_STYLE}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export default OpenAI;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import { Form, type ItemGroup } from '@lobehub/ui';
|
|
2
|
-
import {
|
|
4
|
+
import { Select, Switch } from 'antd';
|
|
3
5
|
import isEqual from 'fast-deep-equal';
|
|
4
|
-
import { debounce } from 'lodash-es';
|
|
5
|
-
import { Mic, Webhook } from 'lucide-react';
|
|
6
6
|
import { memo } from 'react';
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
|
|
@@ -10,15 +10,15 @@ import { FORM_STYLE } from '@/const/layoutTokens';
|
|
|
10
10
|
import { useUserStore } from '@/store/user';
|
|
11
11
|
import { settingsSelectors } from '@/store/user/selectors';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { sttOptions } from './const';
|
|
14
14
|
|
|
15
15
|
type SettingItemGroup = ItemGroup;
|
|
16
16
|
|
|
17
17
|
const TTS_SETTING_KEY = 'tts';
|
|
18
18
|
|
|
19
|
-
const
|
|
19
|
+
const STT = memo(() => {
|
|
20
20
|
const { t } = useTranslation('setting');
|
|
21
|
-
const [form] =
|
|
21
|
+
const [form] = Form.useForm();
|
|
22
22
|
const settings = useUserStore(settingsSelectors.currentSettings, isEqual);
|
|
23
23
|
const [setSettings] = useUserStore((s) => [s.setSettings]);
|
|
24
24
|
|
|
@@ -39,36 +39,20 @@ const TTS = memo(() => {
|
|
|
39
39
|
valuePropName: 'checked',
|
|
40
40
|
},
|
|
41
41
|
],
|
|
42
|
-
icon: Mic,
|
|
43
42
|
title: t('settingTTS.stt'),
|
|
44
43
|
};
|
|
45
44
|
|
|
46
|
-
const openai: SettingItemGroup = {
|
|
47
|
-
children: [
|
|
48
|
-
{
|
|
49
|
-
children: <Select options={opeanaiTTSOptions} />,
|
|
50
|
-
label: t('settingTTS.openai.ttsModel'),
|
|
51
|
-
name: [TTS_SETTING_KEY, 'openAI', 'ttsModel'],
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
children: <Select options={opeanaiSTTOptions} />,
|
|
55
|
-
label: t('settingTTS.openai.sttModel'),
|
|
56
|
-
name: [TTS_SETTING_KEY, 'openAI', 'sttModel'],
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
icon: Webhook,
|
|
60
|
-
title: t('settingTTS.openai.title'),
|
|
61
|
-
};
|
|
62
|
-
|
|
63
45
|
return (
|
|
64
46
|
<Form
|
|
65
47
|
form={form}
|
|
66
48
|
initialValues={settings}
|
|
67
|
-
items={[stt
|
|
68
|
-
|
|
49
|
+
items={[stt]}
|
|
50
|
+
itemsType={'group'}
|
|
51
|
+
onValuesChange={setSettings}
|
|
52
|
+
variant={'pure'}
|
|
69
53
|
{...FORM_STYLE}
|
|
70
54
|
/>
|
|
71
55
|
);
|
|
72
56
|
});
|
|
73
57
|
|
|
74
|
-
export default
|
|
58
|
+
export default STT;
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { translation } from '@/server/translation';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
export const generateMetadata = async () => {
|
|
4
|
+
const { t } = await translation('setting');
|
|
5
|
+
return {
|
|
6
|
+
title: t('tab.tts'),
|
|
7
|
+
};
|
|
8
|
+
};
|
|
5
9
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import TTS from './TTS';
|
|
9
|
-
|
|
10
|
-
export default memo(() => {
|
|
11
|
-
const { t } = useTranslation('setting');
|
|
12
|
-
return (
|
|
13
|
-
<>
|
|
14
|
-
<PageTitle title={t('tab.tts')} />
|
|
15
|
-
<TTS />
|
|
16
|
-
</>
|
|
17
|
-
);
|
|
18
|
-
});
|
|
10
|
+
export { default } from './index';
|
package/src/app/layout.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SpeedInsights } from '@vercel/speed-insights/next';
|
|
2
2
|
import { ResolvingViewport } from 'next';
|
|
3
3
|
import { cookies } from 'next/headers';
|
|
4
|
-
import {
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
5
|
import { isRtlLang } from 'rtl-detect';
|
|
6
6
|
|
|
7
7
|
import Analytics from '@/components/Analytics';
|
|
@@ -10,7 +10,11 @@ import AuthProvider from '@/layout/AuthProvider';
|
|
|
10
10
|
import GlobalProvider from '@/layout/GlobalProvider';
|
|
11
11
|
import { isMobileDevice } from '@/utils/responsive';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
type RootLayoutProps = {
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const RootLayout = async ({ children }: RootLayoutProps) => {
|
|
14
18
|
const cookieStore = cookies();
|
|
15
19
|
|
|
16
20
|
const lang = cookieStore.get(LOBE_LOCALE_COOKIE);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Logo } from '@lobehub/ui';
|
|
4
|
+
import { createStyles } from 'antd-style';
|
|
5
|
+
import Link from 'next/link';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
import { Flexbox, FlexboxProps } from 'react-layout-kit';
|
|
8
|
+
|
|
9
|
+
const useStyles = createStyles(({ token, css }) => ({
|
|
10
|
+
logoLink: css`
|
|
11
|
+
height: 20px;
|
|
12
|
+
color: inherit;
|
|
13
|
+
|
|
14
|
+
&:hover {
|
|
15
|
+
color: ${token.colorLink};
|
|
16
|
+
}
|
|
17
|
+
`,
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
const BrandWatermark = memo<Omit<FlexboxProps, 'children'>>(({ style, ...rest }) => {
|
|
21
|
+
const { styles, theme } = useStyles();
|
|
22
|
+
return (
|
|
23
|
+
<Flexbox
|
|
24
|
+
align={'center'}
|
|
25
|
+
flex={'none'}
|
|
26
|
+
gap={4}
|
|
27
|
+
horizontal
|
|
28
|
+
style={{ color: theme.colorTextDescription, fontSize: 12, ...style }}
|
|
29
|
+
{...rest}
|
|
30
|
+
>
|
|
31
|
+
<span>Powered by</span>
|
|
32
|
+
<Link className={styles.logoLink} href={'https://lobehub.com'} target={'_blank'}>
|
|
33
|
+
<Logo size={20} type={'text'} />
|
|
34
|
+
</Link>
|
|
35
|
+
</Flexbox>
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export default BrandWatermark;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
|
|
6
|
+
const useStyles = createStyles(
|
|
7
|
+
({ css, token }) => css`
|
|
8
|
+
height: 6px;
|
|
9
|
+
background: ${token.colorBgLayout};
|
|
10
|
+
`,
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
const Divider = memo(() => {
|
|
14
|
+
const { styles } = useStyles();
|
|
15
|
+
|
|
16
|
+
return <div className={styles} />;
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export default Divider;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Icon, List } from '@lobehub/ui';
|
|
2
|
+
import { createStyles } from 'antd-style';
|
|
3
|
+
import { ChevronRight } from 'lucide-react';
|
|
4
|
+
import { ReactNode, memo } from 'react';
|
|
5
|
+
|
|
6
|
+
const { Item } = List;
|
|
7
|
+
|
|
8
|
+
const useStyles = createStyles(({ css }) => ({
|
|
9
|
+
container: css`
|
|
10
|
+
position: relative;
|
|
11
|
+
padding-block: 16px !important;
|
|
12
|
+
border-radius: 0;
|
|
13
|
+
`,
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
export interface CellProps {
|
|
17
|
+
icon: ReactNode;
|
|
18
|
+
label: string | ReactNode;
|
|
19
|
+
onClick?: () => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const Cell = memo<CellProps>(({ label, icon, onClick }) => {
|
|
23
|
+
const { cx, styles } = useStyles();
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Item
|
|
27
|
+
active={false}
|
|
28
|
+
avatar={icon}
|
|
29
|
+
className={cx(styles.container)}
|
|
30
|
+
onClick={onClick}
|
|
31
|
+
title={label as string}
|
|
32
|
+
>
|
|
33
|
+
<Icon icon={ChevronRight} size={{ fontSize: 16 }} />
|
|
34
|
+
</Item>
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export default Cell;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Menu as AntdMenu, MenuProps as AntdMenuProps, ConfigProvider } from 'antd';
|
|
2
|
+
import { createStyles } from 'antd-style';
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
|
|
5
|
+
const useStyles = createStyles(({ css, token, prefixCls }) => ({
|
|
6
|
+
compact: css`
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: 0.125rem;
|
|
10
|
+
`,
|
|
11
|
+
menu: css`
|
|
12
|
+
flex: 1;
|
|
13
|
+
background: transparent;
|
|
14
|
+
border: none !important;
|
|
15
|
+
|
|
16
|
+
.${prefixCls}-menu-item-divider {
|
|
17
|
+
margin-block: 0.125rem;
|
|
18
|
+
border-color: ${token.colorFillTertiary};
|
|
19
|
+
|
|
20
|
+
&:first-child {
|
|
21
|
+
margin-top: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&:last-child {
|
|
25
|
+
margin-bottom: 0;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.${prefixCls}-menu-item, .${prefixCls}-menu-submenu-title {
|
|
30
|
+
display: flex;
|
|
31
|
+
gap: 0.75rem;
|
|
32
|
+
align-items: center;
|
|
33
|
+
|
|
34
|
+
height: unset;
|
|
35
|
+
min-height: 2rem;
|
|
36
|
+
padding: 0.375rem 0.75rem;
|
|
37
|
+
|
|
38
|
+
line-height: 2;
|
|
39
|
+
|
|
40
|
+
.anticon + .${prefixCls}-menu-title-content {
|
|
41
|
+
margin-inline-start: 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.${prefixCls}-menu-item-selected {
|
|
46
|
+
.${prefixCls}-menu-item-icon svg {
|
|
47
|
+
color: ${token.colorText};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.${prefixCls}-menu-item-icon svg {
|
|
52
|
+
color: ${token.colorTextSecondary};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.${prefixCls}-menu-title-content {
|
|
56
|
+
flex: 1;
|
|
57
|
+
}
|
|
58
|
+
`,
|
|
59
|
+
}));
|
|
60
|
+
|
|
61
|
+
export interface MenuProps extends AntdMenuProps {
|
|
62
|
+
variant?: 'default' | 'compact';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const Menu = memo<MenuProps>(({ className, selectable = false, variant, ...rest }) => {
|
|
66
|
+
const isCompact = variant === 'compact';
|
|
67
|
+
const { cx, styles, theme } = useStyles();
|
|
68
|
+
return (
|
|
69
|
+
<ConfigProvider
|
|
70
|
+
theme={{
|
|
71
|
+
components: {
|
|
72
|
+
Menu: {
|
|
73
|
+
controlHeightLG: 36,
|
|
74
|
+
iconMarginInlineEnd: 8,
|
|
75
|
+
iconSize: 16,
|
|
76
|
+
itemBorderRadius: theme.borderRadius,
|
|
77
|
+
itemColor: selectable ? theme.colorTextSecondary : theme.colorText,
|
|
78
|
+
itemHoverBg: theme.colorFillTertiary,
|
|
79
|
+
itemMarginBlock: isCompact ? 0 : 4,
|
|
80
|
+
itemMarginInline: isCompact ? 0 : 4,
|
|
81
|
+
itemSelectedBg: theme.colorFillSecondary,
|
|
82
|
+
paddingXS: -8,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
<AntdMenu
|
|
88
|
+
className={cx(styles.menu, isCompact && styles.compact, className)}
|
|
89
|
+
mode="vertical"
|
|
90
|
+
selectable={selectable}
|
|
91
|
+
{...rest}
|
|
92
|
+
/>
|
|
93
|
+
</ConfigProvider>
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
export default Menu;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Skeleton, SkeletonProps } from 'antd';
|
|
4
|
+
import { createStyles } from 'antd-style';
|
|
5
|
+
import { memo } from 'react';
|
|
6
|
+
|
|
7
|
+
const useStyles = createStyles(
|
|
8
|
+
({ css, responsive }) => css`
|
|
9
|
+
${responsive.mobile} {
|
|
10
|
+
padding: 16px;
|
|
11
|
+
}
|
|
12
|
+
`,
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const SkeletonLoading = memo<SkeletonProps>(({ className, ...rest }) => {
|
|
16
|
+
const { cx, styles } = useStyles();
|
|
17
|
+
|
|
18
|
+
return <Skeleton className={cx(styles, className)} paragraph={{ rows: 8 }} {...rest} />;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export default SkeletonLoading;
|
package/src/const/url.ts
CHANGED
|
@@ -29,6 +29,7 @@ export const ABOUT = OFFICIAL_SITE;
|
|
|
29
29
|
export const FEEDBACK = pkg.bugs.url;
|
|
30
30
|
export const DISCORD = 'https://discord.gg/AYFPHvv2jT';
|
|
31
31
|
export const PRIVACY_URL = urlJoin(OFFICIAL_SITE, '/privacy');
|
|
32
|
+
export const TERMS_URL = urlJoin(OFFICIAL_SITE, '/terms');
|
|
32
33
|
|
|
33
34
|
export const PLUGINS_INDEX_URL = 'https://chat-plugins.lobehub.com';
|
|
34
35
|
|
|
@@ -49,3 +50,4 @@ export const EMAIL_BUSINESS = 'hello@lobehub.com';
|
|
|
49
50
|
|
|
50
51
|
export const MEDIDUM = 'https://medium.com/@lobehub';
|
|
51
52
|
export const X = 'https://x.com/lobehub';
|
|
53
|
+
export const RELEASES_URL = urlJoin(GITHUB, 'releases');
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Form, ItemGroup, SelectWithImg, SliderWithInput } from '@lobehub/ui';
|
|
4
|
+
import { Input, Switch } from 'antd';
|
|
5
|
+
import { useThemeMode } from 'antd-style';
|
|
6
|
+
import { debounce } from 'lodash-es';
|
|
7
|
+
import { LayoutList, MessagesSquare } from 'lucide-react';
|
|
8
|
+
import { memo } from 'react';
|
|
9
|
+
import { useTranslation } from 'react-i18next';
|
|
10
|
+
|
|
11
|
+
import { useSyncSettings } from '@/app/(main)/settings/hooks/useSyncSettings';
|
|
12
|
+
import { FORM_STYLE } from '@/const/layoutTokens';
|
|
13
|
+
import { imageUrl } from '@/const/url';
|
|
14
|
+
|
|
15
|
+
import { useStore } from '../store';
|
|
16
|
+
|
|
17
|
+
const AgentChat = memo(() => {
|
|
18
|
+
const { t } = useTranslation('setting');
|
|
19
|
+
const [form] = Form.useForm();
|
|
20
|
+
const { isDarkMode } = useThemeMode();
|
|
21
|
+
|
|
22
|
+
const [
|
|
23
|
+
displayMode,
|
|
24
|
+
enableAutoCreateTopic,
|
|
25
|
+
enableHistoryCount,
|
|
26
|
+
enableCompressThreshold,
|
|
27
|
+
updateConfig,
|
|
28
|
+
] = useStore((s) => [
|
|
29
|
+
s.config.displayMode,
|
|
30
|
+
s.config.enableAutoCreateTopic,
|
|
31
|
+
s.config.enableHistoryCount,
|
|
32
|
+
s.config.enableCompressThreshold,
|
|
33
|
+
s.setAgentConfig,
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
useSyncSettings(form);
|
|
37
|
+
|
|
38
|
+
const chat: ItemGroup = {
|
|
39
|
+
children: [
|
|
40
|
+
{
|
|
41
|
+
children: (
|
|
42
|
+
<SelectWithImg
|
|
43
|
+
height={86}
|
|
44
|
+
onChange={(mode) => updateConfig({ displayMode: mode })}
|
|
45
|
+
options={[
|
|
46
|
+
{
|
|
47
|
+
icon: MessagesSquare,
|
|
48
|
+
img: imageUrl(`chatmode_chat_${isDarkMode ? 'dark' : 'light'}.webp`),
|
|
49
|
+
label: t('settingChat.chatStyleType.type.chat'),
|
|
50
|
+
value: 'chat',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
icon: LayoutList,
|
|
54
|
+
img: imageUrl(`chatmode_docs_${isDarkMode ? 'dark' : 'light'}.webp`),
|
|
55
|
+
label: t('settingChat.chatStyleType.type.docs'),
|
|
56
|
+
value: 'docs',
|
|
57
|
+
},
|
|
58
|
+
]}
|
|
59
|
+
unoptimized={false}
|
|
60
|
+
value={displayMode}
|
|
61
|
+
width={144}
|
|
62
|
+
/>
|
|
63
|
+
),
|
|
64
|
+
label: t('settingChat.chatStyleType.title'),
|
|
65
|
+
minWidth: undefined,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
children: <Input.TextArea placeholder={t('settingChat.inputTemplate.placeholder')} />,
|
|
69
|
+
desc: t('settingChat.inputTemplate.desc'),
|
|
70
|
+
label: t('settingChat.inputTemplate.title'),
|
|
71
|
+
name: 'inputTemplate',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
children: <Switch />,
|
|
75
|
+
desc: t('settingChat.enableAutoCreateTopic.desc'),
|
|
76
|
+
label: t('settingChat.enableAutoCreateTopic.title'),
|
|
77
|
+
minWidth: undefined,
|
|
78
|
+
name: 'enableAutoCreateTopic',
|
|
79
|
+
valuePropName: 'checked',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
children: <SliderWithInput max={8} min={0} />,
|
|
83
|
+
desc: t('settingChat.autoCreateTopicThreshold.desc'),
|
|
84
|
+
divider: false,
|
|
85
|
+
hidden: !enableAutoCreateTopic,
|
|
86
|
+
label: t('settingChat.autoCreateTopicThreshold.title'),
|
|
87
|
+
name: 'autoCreateTopicThreshold',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
children: <Switch />,
|
|
91
|
+
label: t('settingChat.enableHistoryCount.title'),
|
|
92
|
+
minWidth: undefined,
|
|
93
|
+
name: 'enableHistoryCount',
|
|
94
|
+
valuePropName: 'checked',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
children: <SliderWithInput max={32} min={1} />,
|
|
98
|
+
desc: t('settingChat.historyCount.desc'),
|
|
99
|
+
divider: false,
|
|
100
|
+
hidden: !enableHistoryCount,
|
|
101
|
+
label: t('settingChat.historyCount.title'),
|
|
102
|
+
name: 'historyCount',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
children: <Switch />,
|
|
106
|
+
label: t('settingChat.enableCompressThreshold.title'),
|
|
107
|
+
minWidth: undefined,
|
|
108
|
+
name: 'enableCompressThreshold',
|
|
109
|
+
valuePropName: 'checked',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
children: <SliderWithInput max={32} min={0} />,
|
|
113
|
+
desc: t('settingChat.compressThreshold.desc'),
|
|
114
|
+
divider: false,
|
|
115
|
+
hidden: !enableCompressThreshold,
|
|
116
|
+
label: t('settingChat.compressThreshold.title'),
|
|
117
|
+
name: 'compressThreshold',
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
title: t('settingChat.title'),
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<Form
|
|
125
|
+
form={form}
|
|
126
|
+
items={[chat]}
|
|
127
|
+
itemsType={'group'}
|
|
128
|
+
onValuesChange={debounce(updateConfig, 100)}
|
|
129
|
+
variant={'pure'}
|
|
130
|
+
{...FORM_STYLE}
|
|
131
|
+
/>
|
|
132
|
+
);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
export default AgentChat;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import { Form, type FormItemProps, Icon, type ItemGroup, Tooltip } from '@lobehub/ui';
|
|
2
4
|
import { Button } from 'antd';
|
|
3
5
|
import isEqual from 'fast-deep-equal';
|
|
4
6
|
import { isString } from 'lodash-es';
|
|
5
|
-
import {
|
|
7
|
+
import { Wand2 } from 'lucide-react';
|
|
6
8
|
import dynamic from 'next/dynamic';
|
|
7
9
|
import { memo, useMemo } from 'react';
|
|
8
10
|
import { useTranslation } from 'react-i18next';
|
|
@@ -118,13 +120,12 @@ const AgentMeta = memo(() => {
|
|
|
118
120
|
</Button>
|
|
119
121
|
</Tooltip>
|
|
120
122
|
),
|
|
121
|
-
icon: UserCircle,
|
|
122
123
|
title: t('settingAgent.title'),
|
|
123
124
|
}),
|
|
124
125
|
[autocompleteItems, meta],
|
|
125
126
|
);
|
|
126
127
|
|
|
127
|
-
return <Form items={[metaData]} {...FORM_STYLE} />;
|
|
128
|
+
return <Form items={[metaData]} itemsType={'group'} variant={'pure'} {...FORM_STYLE} />;
|
|
128
129
|
});
|
|
129
130
|
|
|
130
131
|
export default AgentMeta;
|