@lobehub/chat 0.152.0 → 0.152.2
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/locales/ar/common.json +14 -0
- package/locales/ar/setting.json +4 -1
- package/locales/bg-BG/common.json +14 -0
- package/locales/bg-BG/setting.json +4 -1
- package/locales/de-DE/common.json +14 -0
- package/locales/de-DE/setting.json +4 -1
- package/locales/en-US/common.json +14 -0
- package/locales/en-US/setting.json +4 -1
- package/locales/es-ES/common.json +14 -0
- package/locales/es-ES/setting.json +4 -1
- package/locales/fr-FR/common.json +14 -0
- package/locales/fr-FR/setting.json +4 -1
- package/locales/it-IT/common.json +14 -0
- package/locales/it-IT/setting.json +4 -1
- package/locales/ja-JP/common.json +14 -0
- package/locales/ja-JP/setting.json +4 -1
- package/locales/ko-KR/common.json +14 -0
- package/locales/ko-KR/setting.json +4 -1
- package/locales/nl-NL/common.json +14 -0
- package/locales/nl-NL/setting.json +4 -1
- package/locales/pl-PL/common.json +14 -0
- package/locales/pl-PL/setting.json +4 -1
- package/locales/pt-BR/common.json +14 -0
- package/locales/pt-BR/setting.json +4 -1
- package/locales/ru-RU/common.json +14 -0
- package/locales/ru-RU/setting.json +4 -1
- package/locales/tr-TR/common.json +14 -0
- package/locales/tr-TR/setting.json +4 -1
- package/locales/vi-VN/common.json +14 -0
- package/locales/vi-VN/setting.json +4 -1
- package/locales/zh-CN/common.json +14 -0
- package/locales/zh-CN/setting.json +4 -1
- package/locales/zh-TW/common.json +14 -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 +34 -0
- package/src/app/(main)/(mobile)/me/features/ExtraCate.tsx +26 -0
- package/src/app/(main)/(mobile)/me/features/useExtraCate.tsx +68 -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/BottomActions.tsx +7 -120
- package/src/app/(main)/@nav/_layout/Desktop/index.tsx +7 -2
- package/src/app/(main)/@nav/_layout/Mobile.tsx +3 -3
- package/src/app/(main)/@nav/features/UserAvatar.tsx +24 -0
- package/src/app/(main)/@nav/features/UserPanel/LangButton.tsx +55 -0
- package/src/app/(main)/@nav/features/UserPanel/Popover.tsx +34 -0
- package/src/app/(main)/@nav/features/UserPanel/ThemeButton.tsx +70 -0
- package/src/app/(main)/@nav/features/UserPanel/UserInfo.tsx +35 -0
- package/src/app/(main)/@nav/features/UserPanel/index.tsx +69 -0
- package/src/app/(main)/@nav/features/UserPanel/useMenu.tsx +144 -0
- package/src/app/(main)/@nav/features/UserPanel/useNewVersion.tsx +12 -0
- 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 +5 -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 +32 -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 +12 -0
- package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/Header.tsx +30 -21
- package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/index.tsx +10 -4
- package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/style.ts +7 -11
- package/src/app/(main)/market/@detail/loading.tsx +1 -0
- package/src/app/(main)/market/_layout/Desktop/{AgentDetail.tsx → DetailSidebar.tsx} +17 -12
- package/src/app/(main)/market/_layout/Desktop/Header.tsx +3 -6
- package/src/app/(main)/market/_layout/Desktop/Hero.tsx +39 -0
- package/src/app/(main)/market/_layout/Desktop/index.tsx +24 -44
- package/src/app/(main)/market/{(mobile)/features/AgentDetail.tsx → _layout/Mobile/DetailModal.tsx} +9 -7
- package/src/app/(main)/market/_layout/Mobile/Header.tsx +2 -2
- package/src/app/(main)/market/_layout/Mobile/index.tsx +17 -9
- package/src/app/(main)/market/_layout/type.ts +6 -0
- package/src/app/(main)/market/features/AgentCard/AgentCardBanner.tsx +10 -9
- package/src/app/(main)/market/features/AgentCard/index.tsx +133 -58
- package/src/app/(main)/market/features/AgentList.tsx +94 -0
- package/src/app/(main)/market/features/AgentSearchBar.tsx +42 -0
- package/src/app/(main)/market/features/ShareAgentButton/Inner.tsx +9 -7
- package/src/app/(main)/market/features/ShareAgentButton/index.tsx +22 -15
- package/src/app/(main)/market/features/TagList.tsx +65 -0
- package/src/app/(main)/market/layout.tsx +11 -0
- package/src/app/(main)/market/loading.tsx +2 -2
- package/src/app/(main)/market/page.tsx +22 -12
- package/src/app/(main)/settings/@category/default.tsx +16 -0
- package/src/app/(main)/settings/@category/features/CategoryContent.tsx +35 -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 +122 -0
- package/src/app/(main)/settings/about/features/Analytics.tsx +42 -0
- package/src/app/(main)/settings/about/layout.tsx +26 -0
- package/src/app/(main)/settings/about/loading.tsx +5 -0
- package/src/app/(main)/settings/about/page.tsx +20 -25
- package/src/app/(main)/settings/agent/layout.tsx +35 -0
- package/src/app/(main)/settings/agent/loading.tsx +4 -2
- package/src/app/(main)/settings/agent/page.tsx +25 -12
- package/src/app/(main)/settings/common/{Common.tsx → features/Common.tsx} +7 -5
- package/src/app/(main)/settings/common/{Theme.tsx → features/Theme/index.tsx} +8 -6
- package/src/app/(main)/settings/common/page.tsx +21 -4
- 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 -10
- 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 +16 -1
- package/src/app/(main)/settings/llm/page.tsx +57 -3
- 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/page.tsx +19 -11
- 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/page.tsx +17 -11
- package/src/app/@modal/(.)settings/about/layout.tsx +1 -0
- package/src/app/@modal/(.)settings/about/page.tsx +1 -0
- package/src/app/@modal/(.)settings/agent/layout.tsx +1 -0
- package/src/app/@modal/(.)settings/agent/page.tsx +1 -0
- package/src/app/@modal/(.)settings/common/page.tsx +1 -0
- package/src/app/@modal/(.)settings/layout.tsx +28 -0
- package/src/app/@modal/(.)settings/llm/page.tsx +1 -0
- package/src/app/@modal/(.)settings/loading.tsx +5 -0
- package/src/app/@modal/(.)settings/sync/page.tsx +1 -0
- package/src/app/@modal/(.)settings/tts/page.tsx +1 -0
- package/src/app/@modal/_layout/SettingModalLayout.tsx +59 -0
- package/src/app/@modal/chat/(.)settings/features/CategoryContent.tsx +36 -0
- package/src/app/@modal/chat/(.)settings/features/useCategory.tsx +62 -0
- package/src/app/@modal/chat/(.)settings/layout.tsx +55 -0
- package/src/app/@modal/chat/(.)settings/loading.tsx +5 -0
- package/src/app/@modal/chat/(.)settings/page.tsx +40 -0
- package/src/app/@modal/default.tsx +1 -0
- package/src/app/@modal/layout.tsx +30 -0
- package/src/app/@modal/loading.tsx +5 -0
- package/src/app/layout.tsx +11 -3
- 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 +1 -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/ChatInput/STT/browser.tsx +1 -1
- package/src/features/ChatInput/STT/openai.tsx +1 -1
- package/src/features/Conversation/components/InboxWelcome/AgentsSuggest.tsx +2 -2
- package/src/hooks/useQuery.ts +7 -0
- package/src/hooks/useQueryRoute.ts +16 -0
- package/src/locales/default/common.ts +14 -0
- package/src/locales/default/setting.ts +3 -0
- package/src/locales/resources.ts +1 -0
- package/src/server/redirectHard.ts +9 -0
- package/src/server/translation.ts +20 -0
- package/src/services/__tests__/chat.test.ts +1 -1
- package/src/store/global/initialState.ts +1 -0
- package/src/store/market/action.ts +1 -1
- package/src/store/session/slices/session/action.ts +1 -1
- package/src/utils/difference.ts +2 -1
- package/src/app/(main)/@nav/_layout/Desktop/Avatar.tsx +0 -11
- 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)/market/(desktop)/index.tsx +0 -20
- package/src/app/(main)/market/(mobile)/features/AgentCard.tsx +0 -31
- package/src/app/(main)/market/(mobile)/index.tsx +0 -25
- package/src/app/(main)/market/components/Loading.tsx +0 -13
- package/src/app/(main)/market/features/AgentCard/AgentCardItem.tsx +0 -54
- package/src/app/(main)/market/features/AgentCard/style.ts +0 -33
- package/src/app/(main)/market/features/AgentDetailContent/index.tsx +0 -12
- package/src/app/(main)/market/features/AgentSearchBar/index.tsx +0 -40
- package/src/app/(main)/market/features/PageTitle/index.tsx +0 -13
- package/src/app/(main)/market/features/TagList/Inner.tsx +0 -28
- package/src/app/(main)/market/features/TagList/index.tsx +0 -23
- package/src/app/(main)/market/layout.ts +0 -8
- 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/Agent.tsx +0 -29
- package/src/app/(main)/settings/common/index.tsx +0 -24
- 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/index.tsx +0 -59
- 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)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/Comment.tsx +0 -0
- /package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/Loading.tsx +0 -0
- /package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/TokenTag.tsx +0 -0
- /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,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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|