@lobehub/chat 0.152.6 → 0.152.8
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/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 +3 -3
- 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/features/ShareButton/ShareModal.tsx +2 -2
- 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 +4 -2
- 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/layout/GlobalProvider/index.tsx +7 -1
- package/src/locales/default/common.ts +1 -0
- package/src/locales/default/setting.ts +3 -0
- package/src/services/chat.ts +2 -2
- package/src/store/chat/slices/message/selectors.ts +2 -2
- package/src/store/global/initialState.ts +1 -0
- package/src/store/serverConfig/Provider.tsx +3 -2
- package/src/store/serverConfig/selectors.ts +1 -0
- package/src/store/serverConfig/store.ts +1 -0
- package/src/store/user/initialState.ts +5 -3
- package/src/store/user/selectors.ts +1 -1
- package/src/store/user/slices/auth/action.test.ts +118 -0
- package/src/store/user/slices/auth/action.ts +81 -0
- package/src/store/user/slices/auth/initialState.ts +20 -0
- package/src/store/user/slices/auth/selectors.ts +6 -0
- package/src/store/user/slices/common/action.test.ts +1 -224
- package/src/store/user/slices/common/action.ts +3 -112
- package/src/store/user/slices/settings/initialState.ts +0 -2
- package/src/store/user/slices/sync/action.test.ts +150 -0
- package/src/store/user/slices/sync/action.ts +94 -0
- package/src/store/user/slices/{common → sync}/initialState.ts +2 -7
- package/src/store/user/store.ts +11 -2
- 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/store/user/slices/common/selectors.ts +0 -6
- /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
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Divider } from 'antd';
|
|
4
|
-
import { createStyles } from 'antd-style';
|
|
5
|
-
import { memo } from 'react';
|
|
6
|
-
import { Center, Flexbox } from 'react-layout-kit';
|
|
7
|
-
|
|
8
|
-
import { CURRENT_VERSION } from '@/const/version';
|
|
9
|
-
import AvatarWithUpload from '@/features/AvatarWithUpload';
|
|
10
|
-
import { useUserStore } from '@/store/user';
|
|
11
|
-
import { commonSelectors } from '@/store/user/selectors';
|
|
12
|
-
|
|
13
|
-
import SettingList from '../features/SettingList';
|
|
14
|
-
import AvatarBanner from './features/AvatarBanner';
|
|
15
|
-
import ExtraList from './features/ExtraList';
|
|
16
|
-
|
|
17
|
-
const useStyles = createStyles(({ css, token }) => ({
|
|
18
|
-
divider: css`
|
|
19
|
-
height: 6px;
|
|
20
|
-
background: ${token.colorFillTertiary};
|
|
21
|
-
`,
|
|
22
|
-
footer: css`
|
|
23
|
-
font-size: 12px;
|
|
24
|
-
color: ${token.colorTextQuaternary};
|
|
25
|
-
`,
|
|
26
|
-
}));
|
|
27
|
-
|
|
28
|
-
const Setting = memo(() => {
|
|
29
|
-
const avatar = useUserStore(commonSelectors.userAvatar);
|
|
30
|
-
const { styles } = useStyles();
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<Flexbox style={{ overflow: 'scroll' }}>
|
|
34
|
-
<AvatarBanner avatar={avatar}>
|
|
35
|
-
<Center style={{ marginTop: 32, position: 'absolute', zIndex: 2 }}>
|
|
36
|
-
<AvatarWithUpload size={88} />
|
|
37
|
-
</Center>
|
|
38
|
-
</AvatarBanner>
|
|
39
|
-
<div style={{ width: '100%' }}>
|
|
40
|
-
<SettingList />
|
|
41
|
-
<div className={styles.divider} />
|
|
42
|
-
<ExtraList />
|
|
43
|
-
<Center style={{ paddingInline: 64 }}>
|
|
44
|
-
<Divider>
|
|
45
|
-
<span className={styles.footer}>LobeChat v{CURRENT_VERSION}</span>
|
|
46
|
-
</Divider>
|
|
47
|
-
</Center>
|
|
48
|
-
</div>
|
|
49
|
-
</Flexbox>
|
|
50
|
-
);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
export default Setting;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Feather, FileClock, Heart } from 'lucide-react';
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { Flexbox } from 'react-layout-kit';
|
|
5
|
-
|
|
6
|
-
import { ABOUT, CHANGELOG, FEEDBACK } from '@/const/url';
|
|
7
|
-
|
|
8
|
-
import Item from '../features/SettingList/Item';
|
|
9
|
-
import { useStyles } from './style';
|
|
10
|
-
|
|
11
|
-
const AboutList = memo(() => {
|
|
12
|
-
const { t } = useTranslation('setting');
|
|
13
|
-
const { styles } = useStyles();
|
|
14
|
-
const items = [
|
|
15
|
-
{
|
|
16
|
-
icon: Feather,
|
|
17
|
-
label: t('feedback', { ns: 'common' }),
|
|
18
|
-
onClick: () => window.open(FEEDBACK, '__blank'),
|
|
19
|
-
value: 'feedback',
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
icon: FileClock,
|
|
23
|
-
label: t('changelog', { ns: 'common' }),
|
|
24
|
-
onClick: () => window.open(CHANGELOG, '__blank'),
|
|
25
|
-
value: 'changelog',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
icon: Heart,
|
|
29
|
-
label: t('about', { ns: 'common' }),
|
|
30
|
-
onClick: () => window.open(ABOUT, '__blank'),
|
|
31
|
-
value: 'about',
|
|
32
|
-
},
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<div className={styles.wrapper}>
|
|
37
|
-
<Flexbox className={styles.container} gap={24} padding={16}>
|
|
38
|
-
<Flexbox className={styles.title} gap={8} horizontal>
|
|
39
|
-
{t('about.title')}
|
|
40
|
-
</Flexbox>
|
|
41
|
-
<Flexbox width={'100%'}>
|
|
42
|
-
{items.map(({ value, icon, label, onClick }) => (
|
|
43
|
-
<div key={value} onClick={onClick}>
|
|
44
|
-
<Item active={false} icon={icon} label={label} />
|
|
45
|
-
</div>
|
|
46
|
-
))}
|
|
47
|
-
</Flexbox>
|
|
48
|
-
</Flexbox>
|
|
49
|
-
</div>
|
|
50
|
-
);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
export default AboutList;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Switch } from 'antd';
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { Flexbox } from 'react-layout-kit';
|
|
5
|
-
|
|
6
|
-
import { useUserStore } from '@/store/user';
|
|
7
|
-
import { preferenceSelectors } from '@/store/user/selectors';
|
|
8
|
-
|
|
9
|
-
import { useStyles } from './style';
|
|
10
|
-
|
|
11
|
-
const Analytics = memo(() => {
|
|
12
|
-
const { t } = useTranslation('setting');
|
|
13
|
-
const { styles } = useStyles();
|
|
14
|
-
const checked = useUserStore(preferenceSelectors.userAllowTrace);
|
|
15
|
-
const [updatePreference] = useUserStore((s) => [s.updatePreference]);
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<div className={styles.wrapper}>
|
|
19
|
-
<Flexbox className={styles.container} gap={24} padding={16}>
|
|
20
|
-
<Flexbox className={styles.title} gap={8} horizontal>
|
|
21
|
-
{t('analytics.title')}
|
|
22
|
-
</Flexbox>
|
|
23
|
-
<Flexbox gap={24} horizontal>
|
|
24
|
-
<Switch
|
|
25
|
-
checked={!!checked}
|
|
26
|
-
onChange={(e) => {
|
|
27
|
-
updatePreference({ telemetry: e });
|
|
28
|
-
}}
|
|
29
|
-
/>
|
|
30
|
-
<Flexbox gap={8}>
|
|
31
|
-
<Flexbox>{t('analytics.telemetry.title')}</Flexbox>
|
|
32
|
-
<Flexbox className={styles.desc}>{t('analytics.telemetry.desc')}</Flexbox>
|
|
33
|
-
</Flexbox>
|
|
34
|
-
</Flexbox>
|
|
35
|
-
</Flexbox>
|
|
36
|
-
</div>
|
|
37
|
-
);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
export default Analytics;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { createStyles } from 'antd-style';
|
|
2
|
-
|
|
3
|
-
export const useStyles = createStyles(({ css, token, responsive }) => ({
|
|
4
|
-
container: css`
|
|
5
|
-
border: 1px solid ${token.colorBorder};
|
|
6
|
-
border-radius: 8px;
|
|
7
|
-
`,
|
|
8
|
-
desc: css`
|
|
9
|
-
color: ${token.colorTextTertiary};
|
|
10
|
-
`,
|
|
11
|
-
title: css`
|
|
12
|
-
font-size: 16px;
|
|
13
|
-
font-weight: 600;
|
|
14
|
-
`,
|
|
15
|
-
wrapper: css`
|
|
16
|
-
width: 100%;
|
|
17
|
-
|
|
18
|
-
${responsive.mobile} {
|
|
19
|
-
padding: 0 12px;
|
|
20
|
-
}
|
|
21
|
-
`,
|
|
22
|
-
}));
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Bot, Cloudy, Info, Mic2, Settings2, Webhook } from 'lucide-react';
|
|
2
|
-
import Link from 'next/link';
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
|
|
6
|
-
import { SettingsTabs } from '@/store/global/initialState';
|
|
7
|
-
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
8
|
-
|
|
9
|
-
import Item from './Item';
|
|
10
|
-
|
|
11
|
-
interface TabItem {
|
|
12
|
-
icon: any;
|
|
13
|
-
label: string;
|
|
14
|
-
value: SettingsTabs;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface SettingListProps {
|
|
18
|
-
activeTab?: SettingsTabs;
|
|
19
|
-
mobile?: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const SettingList = memo<SettingListProps>(({ activeTab, mobile }) => {
|
|
23
|
-
const { t } = useTranslation('setting');
|
|
24
|
-
const { enableWebrtc, showLLM } = useServerConfigStore(featureFlagsSelectors);
|
|
25
|
-
|
|
26
|
-
const items = [
|
|
27
|
-
{ icon: Settings2, label: t('tab.common'), value: SettingsTabs.Common },
|
|
28
|
-
enableWebrtc && { icon: Cloudy, label: t('tab.sync'), value: SettingsTabs.Sync },
|
|
29
|
-
showLLM && { icon: Webhook, label: t('tab.llm'), value: SettingsTabs.LLM },
|
|
30
|
-
{ icon: Mic2, label: t('tab.tts'), value: SettingsTabs.TTS },
|
|
31
|
-
{ icon: Bot, label: t('tab.agent'), value: SettingsTabs.Agent },
|
|
32
|
-
{ icon: Info, label: t('tab.about'), value: SettingsTabs.About },
|
|
33
|
-
].filter(Boolean) as TabItem[];
|
|
34
|
-
|
|
35
|
-
return items.map(({ value, icon, label }) => (
|
|
36
|
-
<Link aria-label={label} href={`/settings/${value}`} key={value}>
|
|
37
|
-
<Item
|
|
38
|
-
active={mobile ? false : activeTab === value}
|
|
39
|
-
hoverable={!mobile}
|
|
40
|
-
icon={icon}
|
|
41
|
-
label={label}
|
|
42
|
-
/>
|
|
43
|
-
</Link>
|
|
44
|
-
));
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
export default SettingList;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { notFound } from 'next/navigation';
|
|
2
|
-
import { PropsWithChildren } from 'react';
|
|
3
|
-
|
|
4
|
-
import { serverFeatureFlags } from '@/config/server/featureFlags';
|
|
5
|
-
|
|
6
|
-
export default ({ children }: PropsWithChildren) => {
|
|
7
|
-
const showLLM = serverFeatureFlags().showLLM;
|
|
8
|
-
if (!showLLM) return notFound();
|
|
9
|
-
|
|
10
|
-
return children;
|
|
11
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { EditableText } from '@lobehub/ui';
|
|
4
|
-
import { Typography } from 'antd';
|
|
5
|
-
import { memo, useState } from 'react';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import { Flexbox } from 'react-layout-kit';
|
|
8
|
-
|
|
9
|
-
import { useUserStore } from '@/store/user';
|
|
10
|
-
import { syncSettingsSelectors } from '@/store/user/selectors';
|
|
11
|
-
|
|
12
|
-
const DeviceName = memo(() => {
|
|
13
|
-
const { t } = useTranslation('setting');
|
|
14
|
-
|
|
15
|
-
const [deviceName, setSettings] = useUserStore((s) => [
|
|
16
|
-
syncSettingsSelectors.deviceName(s),
|
|
17
|
-
s.setSettings,
|
|
18
|
-
]);
|
|
19
|
-
|
|
20
|
-
const [editing, setEditing] = useState(false);
|
|
21
|
-
|
|
22
|
-
const updateDeviceName = (deviceName: string) => {
|
|
23
|
-
setSettings({ sync: { deviceName } });
|
|
24
|
-
setEditing(false);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<Flexbox gap={4}>
|
|
29
|
-
<Flexbox
|
|
30
|
-
align={'center'}
|
|
31
|
-
height={40}
|
|
32
|
-
horizontal
|
|
33
|
-
style={{ fontSize: 20, fontWeight: 'bold' }}
|
|
34
|
-
width={'100%'}
|
|
35
|
-
>
|
|
36
|
-
{!deviceName && !editing && (
|
|
37
|
-
<Flexbox
|
|
38
|
-
onClick={() => {
|
|
39
|
-
setEditing(true);
|
|
40
|
-
}}
|
|
41
|
-
style={{ cursor: 'pointer' }}
|
|
42
|
-
>
|
|
43
|
-
<Typography.Text type={'secondary'}>{t('sync.device.deviceName.hint')}</Typography.Text>
|
|
44
|
-
</Flexbox>
|
|
45
|
-
)}
|
|
46
|
-
<EditableText
|
|
47
|
-
editing={editing}
|
|
48
|
-
onBlur={(e) => {
|
|
49
|
-
updateDeviceName(e.target.value);
|
|
50
|
-
}}
|
|
51
|
-
onChange={(e) => {
|
|
52
|
-
updateDeviceName(e);
|
|
53
|
-
}}
|
|
54
|
-
onEditingChange={setEditing}
|
|
55
|
-
placeholder={t('sync.device.deviceName.placeholder')}
|
|
56
|
-
size={'large'}
|
|
57
|
-
style={{ maxWidth: 200 }}
|
|
58
|
-
type={'block'}
|
|
59
|
-
value={deviceName}
|
|
60
|
-
/>
|
|
61
|
-
</Flexbox>
|
|
62
|
-
</Flexbox>
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
export default DeviceName;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
|
|
6
|
-
import PageTitle from '@/components/PageTitle';
|
|
7
|
-
|
|
8
|
-
export default memo(() => {
|
|
9
|
-
const { t } = useTranslation('setting');
|
|
10
|
-
return <PageTitle title={t('tab.sync')} />;
|
|
11
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { notFound } from 'next/navigation';
|
|
2
|
-
import { PropsWithChildren } from 'react';
|
|
3
|
-
|
|
4
|
-
import { serverFeatureFlags } from '@/config/server/featureFlags';
|
|
5
|
-
|
|
6
|
-
export default ({ children }: PropsWithChildren) => {
|
|
7
|
-
const enableWebrtc = serverFeatureFlags().enableWebrtc;
|
|
8
|
-
|
|
9
|
-
if (!enableWebrtc) return notFound();
|
|
10
|
-
|
|
11
|
-
return children;
|
|
12
|
-
};
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import { Form, ItemGroup, SelectWithImg, SliderWithInput } from '@lobehub/ui';
|
|
2
|
-
import { Form as AFrom, Input, Switch } from 'antd';
|
|
3
|
-
import { useThemeMode } from 'antd-style';
|
|
4
|
-
import { debounce } from 'lodash-es';
|
|
5
|
-
import { BrainCog, LayoutList, MessageSquare, MessagesSquare } from 'lucide-react';
|
|
6
|
-
import { memo, useMemo } from 'react';
|
|
7
|
-
import { useTranslation } from 'react-i18next';
|
|
8
|
-
|
|
9
|
-
import { FORM_STYLE } from '@/const/layoutTokens';
|
|
10
|
-
import { imageUrl } from '@/const/url';
|
|
11
|
-
|
|
12
|
-
import { useStore } from '../store';
|
|
13
|
-
import ModelSelect from './ModelSelect';
|
|
14
|
-
import { useSyncConfig } from './useSyncConfig';
|
|
15
|
-
|
|
16
|
-
const AgentConfig = memo(() => {
|
|
17
|
-
const { t } = useTranslation('setting');
|
|
18
|
-
const [form] = AFrom.useForm();
|
|
19
|
-
const { isDarkMode } = useThemeMode();
|
|
20
|
-
|
|
21
|
-
const [
|
|
22
|
-
displayMode,
|
|
23
|
-
enableAutoCreateTopic,
|
|
24
|
-
enableHistoryCount,
|
|
25
|
-
enableCompressThreshold,
|
|
26
|
-
enableMaxTokens,
|
|
27
|
-
updateConfig,
|
|
28
|
-
] = useStore((s) => [
|
|
29
|
-
s.config.displayMode,
|
|
30
|
-
s.config.enableAutoCreateTopic,
|
|
31
|
-
s.config.enableHistoryCount,
|
|
32
|
-
s.config.enableCompressThreshold,
|
|
33
|
-
s.config.enableMaxTokens,
|
|
34
|
-
s.setAgentConfig,
|
|
35
|
-
]);
|
|
36
|
-
|
|
37
|
-
useSyncConfig(form);
|
|
38
|
-
|
|
39
|
-
const formItems = useMemo(() => {
|
|
40
|
-
const chat: ItemGroup = {
|
|
41
|
-
children: [
|
|
42
|
-
{
|
|
43
|
-
children: (
|
|
44
|
-
<SelectWithImg
|
|
45
|
-
height={86}
|
|
46
|
-
onChange={(mode) => updateConfig({ displayMode: mode })}
|
|
47
|
-
options={[
|
|
48
|
-
{
|
|
49
|
-
icon: MessagesSquare,
|
|
50
|
-
img: imageUrl(`chatmode_chat_${isDarkMode ? 'dark' : 'light'}.webp`),
|
|
51
|
-
label: t('settingChat.chatStyleType.type.chat'),
|
|
52
|
-
value: 'chat',
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
icon: LayoutList,
|
|
56
|
-
img: imageUrl(`chatmode_docs_${isDarkMode ? 'dark' : 'light'}.webp`),
|
|
57
|
-
label: t('settingChat.chatStyleType.type.docs'),
|
|
58
|
-
value: 'docs',
|
|
59
|
-
},
|
|
60
|
-
]}
|
|
61
|
-
unoptimized={false}
|
|
62
|
-
value={displayMode}
|
|
63
|
-
width={144}
|
|
64
|
-
/>
|
|
65
|
-
),
|
|
66
|
-
label: t('settingChat.chatStyleType.title'),
|
|
67
|
-
minWidth: undefined,
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
children: <Input.TextArea placeholder={t('settingChat.inputTemplate.placeholder')} />,
|
|
71
|
-
desc: t('settingChat.inputTemplate.desc'),
|
|
72
|
-
label: t('settingChat.inputTemplate.title'),
|
|
73
|
-
name: 'inputTemplate',
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
children: <Switch />,
|
|
77
|
-
desc: t('settingChat.enableAutoCreateTopic.desc'),
|
|
78
|
-
label: t('settingChat.enableAutoCreateTopic.title'),
|
|
79
|
-
minWidth: undefined,
|
|
80
|
-
name: 'enableAutoCreateTopic',
|
|
81
|
-
valuePropName: 'checked',
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
children: <SliderWithInput max={8} min={0} />,
|
|
85
|
-
desc: t('settingChat.autoCreateTopicThreshold.desc'),
|
|
86
|
-
divider: false,
|
|
87
|
-
hidden: !enableAutoCreateTopic,
|
|
88
|
-
label: t('settingChat.autoCreateTopicThreshold.title'),
|
|
89
|
-
name: 'autoCreateTopicThreshold',
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
children: <Switch />,
|
|
93
|
-
label: t('settingChat.enableHistoryCount.title'),
|
|
94
|
-
minWidth: undefined,
|
|
95
|
-
name: 'enableHistoryCount',
|
|
96
|
-
valuePropName: 'checked',
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
children: <SliderWithInput max={32} min={1} />,
|
|
100
|
-
desc: t('settingChat.historyCount.desc'),
|
|
101
|
-
divider: false,
|
|
102
|
-
hidden: !enableHistoryCount,
|
|
103
|
-
label: t('settingChat.historyCount.title'),
|
|
104
|
-
name: 'historyCount',
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
children: <Switch />,
|
|
108
|
-
label: t('settingChat.enableCompressThreshold.title'),
|
|
109
|
-
minWidth: undefined,
|
|
110
|
-
name: 'enableCompressThreshold',
|
|
111
|
-
valuePropName: 'checked',
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
children: <SliderWithInput max={32} min={0} />,
|
|
115
|
-
desc: t('settingChat.compressThreshold.desc'),
|
|
116
|
-
divider: false,
|
|
117
|
-
hidden: !enableCompressThreshold,
|
|
118
|
-
label: t('settingChat.compressThreshold.title'),
|
|
119
|
-
name: 'compressThreshold',
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
icon: MessageSquare,
|
|
123
|
-
title: t('settingChat.title'),
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const model: ItemGroup = {
|
|
127
|
-
children: [
|
|
128
|
-
{
|
|
129
|
-
children: <ModelSelect />,
|
|
130
|
-
desc: t('settingModel.model.desc'),
|
|
131
|
-
label: t('settingModel.model.title'),
|
|
132
|
-
name: 'model',
|
|
133
|
-
tag: 'model',
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
children: <SliderWithInput max={1} min={0} step={0.1} />,
|
|
137
|
-
desc: t('settingModel.temperature.desc'),
|
|
138
|
-
label: t('settingModel.temperature.title'),
|
|
139
|
-
name: ['params', 'temperature'],
|
|
140
|
-
tag: 'temperature',
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
children: <SliderWithInput max={1} min={0} step={0.1} />,
|
|
144
|
-
desc: t('settingModel.topP.desc'),
|
|
145
|
-
label: t('settingModel.topP.title'),
|
|
146
|
-
name: ['params', 'top_p'],
|
|
147
|
-
tag: 'top_p',
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
children: <SliderWithInput max={2} min={-2} step={0.1} />,
|
|
151
|
-
desc: t('settingModel.presencePenalty.desc'),
|
|
152
|
-
label: t('settingModel.presencePenalty.title'),
|
|
153
|
-
name: ['params', 'presence_penalty'],
|
|
154
|
-
tag: 'presence_penalty',
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
children: <SliderWithInput max={2} min={-2} step={0.1} />,
|
|
158
|
-
desc: t('settingModel.frequencyPenalty.desc'),
|
|
159
|
-
label: t('settingModel.frequencyPenalty.title'),
|
|
160
|
-
name: ['params', 'frequency_penalty'],
|
|
161
|
-
tag: 'frequency_penalty',
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
children: <Switch />,
|
|
165
|
-
label: t('settingModel.enableMaxTokens.title'),
|
|
166
|
-
minWidth: undefined,
|
|
167
|
-
name: 'enableMaxTokens',
|
|
168
|
-
valuePropName: 'checked',
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
children: <SliderWithInput max={32_000} min={0} step={100} />,
|
|
172
|
-
desc: t('settingModel.maxTokens.desc'),
|
|
173
|
-
divider: false,
|
|
174
|
-
hidden: !enableMaxTokens,
|
|
175
|
-
label: t('settingModel.maxTokens.title'),
|
|
176
|
-
name: ['params', 'max_tokens'],
|
|
177
|
-
tag: 'max_tokens',
|
|
178
|
-
},
|
|
179
|
-
],
|
|
180
|
-
icon: BrainCog,
|
|
181
|
-
title: t('settingModel.title'),
|
|
182
|
-
};
|
|
183
|
-
return [chat, model];
|
|
184
|
-
}, [
|
|
185
|
-
displayMode,
|
|
186
|
-
enableAutoCreateTopic,
|
|
187
|
-
enableHistoryCount,
|
|
188
|
-
enableMaxTokens,
|
|
189
|
-
enableCompressThreshold,
|
|
190
|
-
]);
|
|
191
|
-
|
|
192
|
-
return (
|
|
193
|
-
<Form
|
|
194
|
-
form={form}
|
|
195
|
-
items={formItems}
|
|
196
|
-
onValuesChange={debounce(updateConfig, 100)}
|
|
197
|
-
{...FORM_STYLE}
|
|
198
|
-
/>
|
|
199
|
-
);
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
export default AgentConfig;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { FormInstance } from 'antd/es/form/hooks/useForm';
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
|
-
|
|
4
|
-
import { useStoreApi } from '../store';
|
|
5
|
-
|
|
6
|
-
export const useSyncConfig = (form: FormInstance) => {
|
|
7
|
-
const storeApi = useStoreApi();
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
// set the first time
|
|
11
|
-
form.setFieldsValue(storeApi.getState().config);
|
|
12
|
-
|
|
13
|
-
// sync with later updated settings
|
|
14
|
-
const unsubscribe = storeApi.subscribe(
|
|
15
|
-
(s) => s.config,
|
|
16
|
-
(config) => form.setFieldsValue(config),
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
return () => {
|
|
20
|
-
unsubscribe();
|
|
21
|
-
};
|
|
22
|
-
}, []);
|
|
23
|
-
};
|
|
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
|
|
File without changes
|