@lobehub/chat 0.82.8 → 0.83.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 +42 -0
- package/locales/en_US/error.json +2 -1
- package/locales/en_US/plugin.json +1 -0
- package/locales/en_US/setting.json +2 -1
- package/locales/ru_RU/error.json +2 -1
- package/locales/ru_RU/plugin.json +1 -0
- package/locales/ru_RU/setting.json +2 -1
- package/locales/zh_CN/error.json +1 -0
- package/locales/zh_CN/plugin.json +2 -1
- package/locales/zh_CN/setting.json +2 -1
- package/locales/zh_TW/error.json +2 -1
- package/locales/zh_TW/plugin.json +1 -0
- package/locales/zh_TW/setting.json +2 -1
- package/package.json +6 -5
- package/src/app/chat/{features/Header → (desktop)/features/ChatHeader}/Desktop.tsx +2 -2
- package/src/app/chat/{features/Header → (desktop)/features/ChatHeader}/index.tsx +1 -1
- package/src/app/chat/(desktop)/features/ChatInput/index.tsx +22 -0
- package/src/app/chat/{features/SessionList/Header → (desktop)/features/SessionHeader}/Desktop.tsx +1 -1
- package/src/app/chat/{features/SessionList/Header → (desktop)/features/SessionHeader}/index.tsx +1 -1
- package/src/app/chat/{features → (desktop)/features}/SessionList/Desktop.tsx +1 -1
- package/src/app/chat/(desktop)/features/SessionList/index.tsx +20 -0
- package/src/app/chat/{features/Sidebar → (desktop)/features/SideBar}/Desktop.tsx +4 -4
- package/src/app/chat/(desktop)/features/SideBar/index.tsx +20 -0
- package/src/app/chat/(desktop)/index.tsx +24 -0
- package/src/app/chat/{layout.desktop.tsx → (desktop)/layout/Desktop.tsx} +4 -4
- package/src/app/chat/(desktop)/layout/index.tsx +25 -0
- package/src/app/chat/(mobile)/features/ChatHeader.tsx +1 -0
- package/src/app/chat/(mobile)/features/ChatInput.tsx +14 -0
- package/src/app/chat/(mobile)/features/SessionList.tsx +12 -0
- package/src/app/chat/(mobile)/features/Topics.tsx +12 -0
- package/src/app/chat/(mobile)/index.tsx +20 -0
- package/src/app/chat/(mobile)/layout.tsx +15 -0
- package/src/app/chat/(mobile)/mobile/page.tsx +21 -0
- package/src/app/chat/{features/Header → components/ChatHeader}/Mobile.tsx +2 -1
- package/src/app/chat/{features/Header → components/ChatHeader}/ShareButton/Preview.tsx +3 -3
- package/src/app/chat/{features/Conversation/Input → components/ChatInput}/index.tsx +23 -21
- package/src/app/chat/components/Inspector/index.tsx +17 -0
- package/src/app/chat/{features → components}/SessionList/List/Item/index.tsx +2 -2
- package/src/app/chat/{features → components}/SessionList/Mobile.tsx +1 -1
- package/src/app/chat/{features → components}/SessionList/index.tsx +3 -10
- package/src/app/chat/features/Conversation/index.tsx +8 -4
- package/src/app/chat/features/PageTitle.tsx +19 -0
- package/src/app/chat/layout.tsx +14 -0
- package/src/app/chat/page.tsx +9 -4
- package/src/app/chat/settings/(desktop)/Header/index.tsx +13 -0
- package/src/app/chat/settings/{layout.desktop.tsx → (desktop)/layout.desktop.tsx} +5 -4
- package/src/app/chat/settings/(mobile)/Header.tsx +12 -0
- package/src/app/chat/settings/{layout.mobile.tsx → (mobile)/layout.mobile.tsx} +3 -1
- package/src/app/chat/settings/{features → components}/Header/index.tsx +4 -13
- package/src/app/chat/settings/layout.tsx +14 -0
- package/src/app/chat/settings/page.tsx +36 -5
- package/src/app/home/index.tsx +15 -11
- package/src/app/layout.tsx +4 -1
- package/src/app/metadata.ts +4 -1
- package/src/app/settings/agent/Agent.tsx +3 -3
- package/src/app/settings/agent/index.tsx +1 -0
- package/src/app/settings/common/Common.tsx +109 -117
- package/src/app/settings/features/SideBar/List.tsx +11 -5
- package/src/app/settings/llm/LLM/index.tsx +2 -2
- package/src/app/welcome/page.tsx +2 -6
- package/src/components/PageTitle.tsx +11 -0
- package/src/config/client.ts +13 -0
- package/src/const/locale.ts +9 -0
- package/src/const/settings.ts +1 -1
- package/src/const/url.ts +1 -6
- package/src/helpers/export.ts +2 -2
- package/src/layout/AppMobileLayout.tsx +15 -24
- package/src/layout/GlobalLayout/Locale.tsx +44 -0
- package/src/layout/GlobalLayout/LocaleLoading.tsx +21 -0
- package/src/layout/GlobalLayout/StoreHydration.tsx +28 -0
- package/src/layout/GlobalLayout/index.tsx +29 -41
- package/src/locales/create.ts +43 -26
- package/src/locales/default/setting.ts +2 -1
- package/src/locales/options.ts +6 -5
- package/src/services/agentMarket.ts +6 -4
- package/src/services/pluginMarket.ts +2 -2
- package/src/store/global/hooks/useSwitchSettingsOnInit.ts +5 -2
- package/src/store/global/{selectors.test.ts → selectors/settings.test.ts} +11 -11
- package/src/store/global/selectors/settings.ts +44 -0
- package/src/store/global/selectors.ts +1 -36
- package/src/store/global/slices/common.ts +3 -4
- package/src/types/locale.ts +4 -0
- package/src/types/settings.ts +2 -2
- package/src/utils/env.ts +2 -0
- package/src/utils/responsive.ts +1 -0
- package/src/utils/switchLang.ts +5 -1
- package/src/app/chat/features/Sidebar/index.tsx +0 -29
- package/src/app/chat/index.tsx +0 -54
- package/src/app/chat/layout.mobile.tsx +0 -20
- package/src/app/chat/mobile/index.tsx +0 -38
- package/src/app/chat/mobile/page.tsx +0 -7
- package/src/app/chat/settings/index.tsx +0 -51
- package/src/layout/GlobalLayout/style.ts +0 -18
- /package/src/app/chat/{features/Conversation/Input → (desktop)/features/ChatInput}/Desktop.tsx +0 -0
- /package/src/app/chat/{features/SessionList/Header/Mobile.tsx → (mobile)/features/SessionHeader.tsx} +0 -0
- /package/src/app/chat/{features/Header → components/ChatHeader}/PluginTag/PluginStatus.tsx +0 -0
- /package/src/app/chat/{features/Header → components/ChatHeader}/PluginTag/index.tsx +0 -0
- /package/src/app/chat/{features/Header → components/ChatHeader}/ShareButton/Inner.tsx +0 -0
- /package/src/app/chat/{features/Header → components/ChatHeader}/ShareButton/index.tsx +0 -0
- /package/src/app/chat/{features/Header → components/ChatHeader}/ShareButton/style.ts +0 -0
- /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/ActionBar/ActionLeft.tsx +0 -0
- /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/ActionBar/ActionRight.tsx +0 -0
- /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/ActionBar/Token.tsx +0 -0
- /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/Footer/SaveTopic.tsx +0 -0
- /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/Footer/index.tsx +0 -0
- /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/Mobile.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/Mobile.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/SystemRole/Header.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/SystemRole/index.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/SystemRole/style.ts +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/Topic/DefaultContent.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/Topic/SkeletonList.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/Topic/TopicContent.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/Topic/TopicItem.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/Topic/index.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/TopicSearchBar/index.tsx +0 -0
- /package/src/app/chat/{features → components}/SessionList/CollapseGroup/index.tsx +0 -0
- /package/src/app/chat/{features → components}/SessionList/Inbox/index.tsx +0 -0
- /package/src/app/chat/{features → components}/SessionList/List/AddButton.tsx +0 -0
- /package/src/app/chat/{features → components}/SessionList/List/Item/Actions.tsx +0 -0
- /package/src/app/chat/{features → components}/SessionList/List/SkeletonList.tsx +0 -0
- /package/src/app/chat/{features → components}/SessionList/List/index.tsx +0 -0
- /package/src/app/chat/settings/{features → (desktop)}/Header/Desktop.tsx +0 -0
- /package/src/app/chat/settings/{features → components}/Header/Mobile.tsx +0 -0
- /package/src/{components/AppTheme/index.tsx → layout/GlobalLayout/AppTheme.tsx} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 0.83.0](https://github.com/lobehub/lobe-chat/compare/v0.82.9...v0.83.0)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-10-06**</sup>
|
|
8
|
+
|
|
9
|
+
#### ✨ Features
|
|
10
|
+
|
|
11
|
+
- **misc**: Upgrade locale with SSR.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's improved
|
|
19
|
+
|
|
20
|
+
- **misc**: Upgrade locale with SSR, closes [#268](https://github.com/lobehub/lobe-chat/issues/268) ([2fdea52](https://github.com/lobehub/lobe-chat/commit/2fdea52))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
### [Version 0.82.9](https://github.com/lobehub/lobe-chat/compare/v0.82.8...v0.82.9)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2023-10-05**</sup>
|
|
33
|
+
|
|
34
|
+
<br/>
|
|
35
|
+
|
|
36
|
+
<details>
|
|
37
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
38
|
+
|
|
39
|
+
</details>
|
|
40
|
+
|
|
41
|
+
<div align="right">
|
|
42
|
+
|
|
43
|
+
[](#readme-top)
|
|
44
|
+
|
|
45
|
+
</div>
|
|
46
|
+
|
|
5
47
|
### [Version 0.82.8](https://github.com/lobehub/lobe-chat/compare/v0.82.7...v0.82.8)
|
|
6
48
|
|
|
7
49
|
<sup>Released on **2023-09-30**</sup>
|
package/locales/en_US/error.json
CHANGED
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"password": {
|
|
37
37
|
"description": "The application encryption has been enabled by the administrator. Enter the application password to unlock the application. The password only needs to be filled in once.",
|
|
38
38
|
"title": "Enter Password to Unlock Application"
|
|
39
|
-
}
|
|
39
|
+
},
|
|
40
|
+
"closeMessage": "Close message"
|
|
40
41
|
}
|
|
41
42
|
}
|
package/locales/ru_RU/error.json
CHANGED
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"password": {
|
|
37
37
|
"description": "Шифрование приложения включено администратором. Введите пароль приложения, чтобы разблокировать приложение. Пароль необходимо ввести только один раз.",
|
|
38
38
|
"title": "Введите пароль для разблокировки приложения"
|
|
39
|
-
}
|
|
39
|
+
},
|
|
40
|
+
"closeMessage": "Закрыть сообщение"
|
|
40
41
|
}
|
|
41
42
|
}
|
|
@@ -211,7 +211,8 @@
|
|
|
211
211
|
"title": "Размер шрифта"
|
|
212
212
|
},
|
|
213
213
|
"lang": {
|
|
214
|
-
"title": "Языковые настройки"
|
|
214
|
+
"title": "Языковые настройки",
|
|
215
|
+
"autoMode": "Следовать за системой"
|
|
215
216
|
},
|
|
216
217
|
"neutralColor": {
|
|
217
218
|
"desc": "Пользовательская шкала серого для различных цветовых тенденций",
|
package/locales/zh_CN/error.json
CHANGED
|
@@ -95,10 +95,11 @@
|
|
|
95
95
|
"plugins": {
|
|
96
96
|
"unknown": "插件检测中..."
|
|
97
97
|
},
|
|
98
|
+
"setting": "插件设置",
|
|
98
99
|
"settings": {
|
|
99
100
|
"indexUrl": {
|
|
100
101
|
"title": "市场索引",
|
|
101
|
-
"tooltip": "
|
|
102
|
+
"tooltip": "暂不支持在线编辑,请通过部署时环境变量进行设置"
|
|
102
103
|
},
|
|
103
104
|
"modalDesc": "配置插件市场的地址后,可以使用自定义的插件市场",
|
|
104
105
|
"title": "设置插件市场"
|
package/locales/zh_TW/error.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.83.0",
|
|
4
4
|
"description": "An open-source, extensible (Function Calling), high-performance chatbot framework. It supports one-click free deployment of your private ChatGPT/LLM web application",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chatbot",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"ahooks": "^3",
|
|
77
77
|
"ai": "^2",
|
|
78
78
|
"antd": "^5",
|
|
79
|
-
"antd-style": "^3",
|
|
79
|
+
"antd-style": "^3.5",
|
|
80
80
|
"brotli-wasm": "^1",
|
|
81
81
|
"chroma-js": "^2",
|
|
82
82
|
"dayjs": "^1",
|
|
@@ -85,6 +85,9 @@
|
|
|
85
85
|
"gpt-tokenizer": "^2",
|
|
86
86
|
"html-to-image": "^1",
|
|
87
87
|
"i18next": "^23",
|
|
88
|
+
"i18next-browser-languagedetector": "^7",
|
|
89
|
+
"i18next-resources-for-ts": "^1",
|
|
90
|
+
"i18next-resources-to-backend": "^1",
|
|
88
91
|
"idb-keyval": "^6",
|
|
89
92
|
"immer": "^10",
|
|
90
93
|
"lodash-es": "^4",
|
|
@@ -92,7 +95,7 @@
|
|
|
92
95
|
"mixpanel-browser": "^2",
|
|
93
96
|
"nanoid": "^5",
|
|
94
97
|
"next": "^13.5.3",
|
|
95
|
-
"openai": "
|
|
98
|
+
"openai": "^4.10.0",
|
|
96
99
|
"polished": "^4",
|
|
97
100
|
"posthog-js": "^1",
|
|
98
101
|
"react": "^18",
|
|
@@ -139,8 +142,6 @@
|
|
|
139
142
|
"dpdm": "^3",
|
|
140
143
|
"eslint": "^8",
|
|
141
144
|
"husky": "^8",
|
|
142
|
-
"i18next-browser-languagedetector": "^7",
|
|
143
|
-
"i18next-resources-for-ts": "^1",
|
|
144
145
|
"jsdom": "^22",
|
|
145
146
|
"lint-staged": "^14",
|
|
146
147
|
"next-pwa": "^5",
|
|
@@ -12,8 +12,8 @@ import { useSessionChatInit, useSessionStore } from '@/store/session';
|
|
|
12
12
|
import { agentSelectors, sessionSelectors } from '@/store/session/selectors';
|
|
13
13
|
import { pathString } from '@/utils/url';
|
|
14
14
|
|
|
15
|
-
import PluginTag from '
|
|
16
|
-
import ShareButton from '
|
|
15
|
+
import PluginTag from '../../../components/ChatHeader/PluginTag';
|
|
16
|
+
import ShareButton from '../../../components/ChatHeader/ShareButton';
|
|
17
17
|
|
|
18
18
|
const Header = memo(() => {
|
|
19
19
|
const init = useSessionChatInit();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useResponsive } from 'antd-style';
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
|
|
4
|
+
import Mobile from '../../../components/ChatHeader/Mobile';
|
|
4
5
|
import Desktop from './Desktop';
|
|
5
|
-
import Mobile from './Mobile';
|
|
6
6
|
|
|
7
7
|
const Header = memo(() => {
|
|
8
8
|
const { mobile } = useResponsive();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useResponsive } from 'antd-style';
|
|
2
|
+
import { memo, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import { ChatInputContent } from '../../../components/ChatInput';
|
|
5
|
+
import Mobile from '../../../components/ChatInput/Mobile';
|
|
6
|
+
import Desktop from './Desktop';
|
|
7
|
+
|
|
8
|
+
const ChatInput = () => {
|
|
9
|
+
const [expand, setExpand] = useState<boolean>(false);
|
|
10
|
+
|
|
11
|
+
const { mobile } = useResponsive();
|
|
12
|
+
|
|
13
|
+
const Render = mobile ? Mobile : Desktop;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Render expand={expand}>
|
|
17
|
+
<ChatInputContent expand={expand} onExpandChange={setExpand} />
|
|
18
|
+
</Render>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default memo(ChatInput);
|
package/src/app/chat/{features/SessionList/Header → (desktop)/features/SessionHeader}/Desktop.tsx
RENAMED
|
@@ -7,7 +7,7 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
7
7
|
|
|
8
8
|
import { useSessionStore } from '@/store/session';
|
|
9
9
|
|
|
10
|
-
import SessionSearchBar from '
|
|
10
|
+
import SessionSearchBar from '../../../features/SessionSearchBar';
|
|
11
11
|
|
|
12
12
|
export const useStyles = createStyles(({ css, token }) => ({
|
|
13
13
|
logo: css`
|
package/src/app/chat/{features/SessionList/Header → (desktop)/features/SessionHeader}/index.tsx
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useResponsive } from 'antd-style';
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
|
|
4
|
+
import Mobile from '../../../(mobile)/features/SessionHeader';
|
|
4
5
|
import Desktop from './Desktop';
|
|
5
|
-
import Mobile from './Mobile';
|
|
6
6
|
|
|
7
7
|
const Header = memo(() => {
|
|
8
8
|
const { mobile } = useResponsive();
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useResponsive } from 'antd-style';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
|
|
4
|
+
import { SessionListContent } from '../../../components/SessionList';
|
|
5
|
+
import Mobile from '../../../components/SessionList/Mobile';
|
|
6
|
+
import Desktop from './Desktop';
|
|
7
|
+
|
|
8
|
+
const ResponsiveSessionList = memo(() => {
|
|
9
|
+
const { mobile } = useResponsive();
|
|
10
|
+
|
|
11
|
+
const Wrapper = mobile ? Mobile : Desktop;
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<Wrapper>
|
|
15
|
+
<SessionListContent />
|
|
16
|
+
</Wrapper>
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export default ResponsiveSessionList;
|
|
@@ -6,9 +6,9 @@ import SafeSpacing from '@/components/SafeSpacing';
|
|
|
6
6
|
import { CHAT_SIDEBAR_WIDTH } from '@/const/layoutTokens';
|
|
7
7
|
import { useGlobalStore } from '@/store/global';
|
|
8
8
|
import { useSessionStore } from '@/store/session';
|
|
9
|
-
import { sessionSelectors } from '@/store/session/
|
|
9
|
+
import { sessionSelectors } from '@/store/session/selectors';
|
|
10
10
|
|
|
11
|
-
import SystemRole from '
|
|
11
|
+
import SystemRole from '../../../components/Inspector/SystemRole';
|
|
12
12
|
|
|
13
13
|
const useStyles = createStyles(({ css, token }) => ({
|
|
14
14
|
content: css`
|
|
@@ -23,7 +23,7 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
|
23
23
|
`,
|
|
24
24
|
}));
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const Desktop = memo<{ children: ReactNode }>(({ children }) => {
|
|
27
27
|
const { styles } = useStyles();
|
|
28
28
|
const [showAgentSettings, toggleConfig] = useGlobalStore((s) => [
|
|
29
29
|
s.preference.showChatSideBar,
|
|
@@ -55,4 +55,4 @@ const SideBar = memo<{ children: ReactNode }>(({ children }) => {
|
|
|
55
55
|
);
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
export default
|
|
58
|
+
export default Desktop;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useResponsive } from 'antd-style';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
|
|
4
|
+
import { InspectorContent } from '../../../components/Inspector';
|
|
5
|
+
import Mobile from '../../../components/Inspector/Mobile';
|
|
6
|
+
import Desktop from './Desktop';
|
|
7
|
+
|
|
8
|
+
const SideBar = memo(() => {
|
|
9
|
+
const { mobile } = useResponsive();
|
|
10
|
+
|
|
11
|
+
const Render = mobile ? Mobile : Desktop;
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<Render>
|
|
15
|
+
<InspectorContent />
|
|
16
|
+
</Render>
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export default SideBar;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import { Flexbox } from 'react-layout-kit';
|
|
5
|
+
|
|
6
|
+
import Conversation from '../features/Conversation';
|
|
7
|
+
import PageTitle from '../features/PageTitle';
|
|
8
|
+
import ChatHeader from './features/ChatHeader';
|
|
9
|
+
import ChatInput from './features/ChatInput';
|
|
10
|
+
import SideBar from './features/SideBar';
|
|
11
|
+
|
|
12
|
+
const DesktopPage = memo(() => {
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<PageTitle />
|
|
16
|
+
<ChatHeader />
|
|
17
|
+
<Flexbox flex={1} height={'calc(100vh - 64px)'} horizontal>
|
|
18
|
+
<Conversation chatInput={<ChatInput />} />
|
|
19
|
+
<SideBar />
|
|
20
|
+
</Flexbox>
|
|
21
|
+
</>
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
export default DesktopPage;
|
|
@@ -5,14 +5,14 @@ import AppLayout from '@/layout/AppLayout';
|
|
|
5
5
|
import { useSwitchSideBarOnInit } from '@/store/global';
|
|
6
6
|
import { SidebarTabKey } from '@/store/global/initialState';
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import ResponsiveSessionList from '../features/SessionList';
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const Desktop = memo<PropsWithChildren>(({ children }) => {
|
|
11
11
|
useSwitchSideBarOnInit(SidebarTabKey.Chat);
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
14
|
<AppLayout>
|
|
15
|
-
<
|
|
15
|
+
<ResponsiveSessionList />
|
|
16
16
|
<Flexbox
|
|
17
17
|
flex={1}
|
|
18
18
|
height={'100vh'}
|
|
@@ -25,4 +25,4 @@ const ChatLayout = memo<PropsWithChildren>(({ children }) => {
|
|
|
25
25
|
);
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
export default
|
|
28
|
+
export default Desktop;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useResponsive } from 'antd-style';
|
|
4
|
+
import { PropsWithChildren, memo } from 'react';
|
|
5
|
+
|
|
6
|
+
import { useEffectAfterSessionHydrated } from '@/store/session/hooks';
|
|
7
|
+
|
|
8
|
+
import MobileLayout from '../../(mobile)/layout';
|
|
9
|
+
import DesktopLayout from './Desktop';
|
|
10
|
+
|
|
11
|
+
const Chat = memo<PropsWithChildren>(({ children }) => {
|
|
12
|
+
const { mobile } = useResponsive();
|
|
13
|
+
|
|
14
|
+
const RenderLayout = mobile ? MobileLayout : DesktopLayout;
|
|
15
|
+
|
|
16
|
+
useEffectAfterSessionHydrated(
|
|
17
|
+
(store) => {
|
|
18
|
+
store.setState({ isMobile: mobile });
|
|
19
|
+
},
|
|
20
|
+
[mobile],
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
return <RenderLayout>{children}</RenderLayout>;
|
|
24
|
+
});
|
|
25
|
+
export default Chat;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '../../components/ChatHeader/Mobile';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { ChatInputContent } from '../../components/ChatInput';
|
|
4
|
+
import Mobile from '../../components/ChatInput/Mobile';
|
|
5
|
+
|
|
6
|
+
const ChatInput = () => {
|
|
7
|
+
return (
|
|
8
|
+
<Mobile>
|
|
9
|
+
<ChatInputContent mobile />
|
|
10
|
+
</Mobile>
|
|
11
|
+
);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default memo(ChatInput);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { SessionListContent } from '../../components/SessionList';
|
|
4
|
+
import Wrapper from '../../components/SessionList/Mobile';
|
|
5
|
+
|
|
6
|
+
const SessionList = memo(() => (
|
|
7
|
+
<Wrapper>
|
|
8
|
+
<SessionListContent />
|
|
9
|
+
</Wrapper>
|
|
10
|
+
));
|
|
11
|
+
|
|
12
|
+
export default SessionList;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { InspectorContent } from '../../components/Inspector';
|
|
4
|
+
import Mobile from '../../components/Inspector/Mobile';
|
|
5
|
+
|
|
6
|
+
const Topics = memo(() => (
|
|
7
|
+
<Mobile>
|
|
8
|
+
<InspectorContent />
|
|
9
|
+
</Mobile>
|
|
10
|
+
));
|
|
11
|
+
|
|
12
|
+
export default Topics;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
|
|
5
|
+
import AppMobileLayout from '@/layout/AppMobileLayout';
|
|
6
|
+
|
|
7
|
+
import PageTitle from '../features/PageTitle';
|
|
8
|
+
import SessionHeader from './features/SessionHeader';
|
|
9
|
+
import SessionList from './features/SessionList';
|
|
10
|
+
|
|
11
|
+
const ChatMobilePage = memo(() => {
|
|
12
|
+
return (
|
|
13
|
+
<AppMobileLayout navBar={<SessionHeader />} showTabBar>
|
|
14
|
+
<PageTitle />
|
|
15
|
+
<SessionList />
|
|
16
|
+
</AppMobileLayout>
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export default ChatMobilePage;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { PropsWithChildren, memo } from 'react';
|
|
4
|
+
|
|
5
|
+
import { useEffectAfterSessionHydrated } from '@/store/session';
|
|
6
|
+
|
|
7
|
+
const ChatMobileLayout = memo<PropsWithChildren>(({ children }) => {
|
|
8
|
+
useEffectAfterSessionHydrated((store) => {
|
|
9
|
+
store.setState({ isMobile: true });
|
|
10
|
+
}, []);
|
|
11
|
+
|
|
12
|
+
return children;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export default ChatMobileLayout;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import { Flexbox } from 'react-layout-kit';
|
|
5
|
+
|
|
6
|
+
import AppMobileLayout from '@/layout/AppMobileLayout';
|
|
7
|
+
|
|
8
|
+
import Conversation from '../../features/Conversation';
|
|
9
|
+
import Header from '../features/ChatHeader';
|
|
10
|
+
import ChatInput from '../features/ChatInput';
|
|
11
|
+
import Topics from '../features/Topics';
|
|
12
|
+
|
|
13
|
+
const Chat = memo(() => (
|
|
14
|
+
<AppMobileLayout navBar={<Header />}>
|
|
15
|
+
<Flexbox height={'calc(100vh - 44px)'} horizontal>
|
|
16
|
+
<Conversation chatInput={<ChatInput />} mobile />
|
|
17
|
+
<Topics />
|
|
18
|
+
</Flexbox>
|
|
19
|
+
</AppMobileLayout>
|
|
20
|
+
));
|
|
21
|
+
export default Chat;
|
|
@@ -4,13 +4,14 @@ import { useRouter } from 'next/navigation';
|
|
|
4
4
|
import { memo } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
|
|
7
|
-
import ShareButton from '@/app/chat/features/Header/ShareButton';
|
|
8
7
|
import { MOBILE_HEADER_ICON_SIZE } from '@/const/layoutTokens';
|
|
9
8
|
import { useGlobalStore } from '@/store/global';
|
|
10
9
|
import { useSessionStore } from '@/store/session';
|
|
11
10
|
import { agentSelectors, sessionSelectors } from '@/store/session/selectors';
|
|
12
11
|
import { pathString } from '@/utils/url';
|
|
13
12
|
|
|
13
|
+
import ShareButton from './ShareButton';
|
|
14
|
+
|
|
14
15
|
const MobileHeader = memo(() => {
|
|
15
16
|
const { t } = useTranslation('common');
|
|
16
17
|
const router = useRouter();
|
|
@@ -6,14 +6,14 @@ import { toJpeg, toPng, toSvg } from 'html-to-image';
|
|
|
6
6
|
import { memo, useCallback, useState } from 'react';
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
import { Flexbox } from 'react-layout-kit';
|
|
9
|
+
import ChatList from 'src/app/chat/features/Conversation/ChatList';
|
|
9
10
|
|
|
10
|
-
import
|
|
11
|
-
import ChatList from '@/app/chat/features/Conversation/ChatList';
|
|
12
|
-
import PluginTag from '@/app/chat/features/Header/PluginTag';
|
|
11
|
+
import PluginTag from '@/app/chat/components/ChatHeader/PluginTag';
|
|
13
12
|
import { useSessionStore } from '@/store/session';
|
|
14
13
|
import { agentSelectors } from '@/store/session/slices/agentConfig';
|
|
15
14
|
import { sessionSelectors } from '@/store/session/slices/session/selectors';
|
|
16
15
|
|
|
16
|
+
import pkg from '../../../../../../package.json';
|
|
17
17
|
import { useStyles } from './style';
|
|
18
18
|
|
|
19
19
|
export enum ImageType {
|
|
@@ -9,28 +9,32 @@ import { useSessionStore } from '@/store/session';
|
|
|
9
9
|
|
|
10
10
|
import ActionLeft from './ActionBar/ActionLeft';
|
|
11
11
|
import ActionsRight from './ActionBar/ActionRight';
|
|
12
|
-
import Desktop from './Desktop';
|
|
13
12
|
import Footer from './Footer';
|
|
14
|
-
import Mobile from './Mobile';
|
|
15
13
|
|
|
16
14
|
const Token = dynamic(() => import('./ActionBar/Token'), { ssr: false });
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
interface ChatContentProps {
|
|
17
|
+
expand?: boolean;
|
|
18
|
+
mobile?: boolean;
|
|
19
|
+
onExpandChange?: (expand: boolean) => void;
|
|
20
|
+
}
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
s.stopGenerateMessage,
|
|
28
|
-
]);
|
|
22
|
+
export const ChatInputContent = memo<ChatContentProps>(
|
|
23
|
+
({ expand, onExpandChange, mobile: defaultMobile }) => {
|
|
24
|
+
const { t } = useTranslation('common');
|
|
29
25
|
|
|
30
|
-
|
|
26
|
+
const [message, setMessage] = useState('');
|
|
27
|
+
const { mobile: runtimeMobile } = useResponsive();
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
const mobile = runtimeMobile || defaultMobile;
|
|
30
|
+
|
|
31
|
+
const [isLoading, sendMessage, stopGenerateMessage] = useSessionStore((s) => [
|
|
32
|
+
!!s.chatLoadingId,
|
|
33
|
+
s.sendMessage,
|
|
34
|
+
s.stopGenerateMessage,
|
|
35
|
+
]);
|
|
36
|
+
|
|
37
|
+
return (
|
|
34
38
|
<ChatInputArea
|
|
35
39
|
actions={
|
|
36
40
|
<>
|
|
@@ -45,7 +49,7 @@ const ChatInput = () => {
|
|
|
45
49
|
footer={<Footer />}
|
|
46
50
|
loading={isLoading}
|
|
47
51
|
minHeight={mobile ? 0 : CHAT_TEXTAREA_HEIGHT}
|
|
48
|
-
onExpandChange={
|
|
52
|
+
onExpandChange={onExpandChange}
|
|
49
53
|
onInputChange={setMessage}
|
|
50
54
|
onSend={sendMessage}
|
|
51
55
|
onStop={stopGenerateMessage}
|
|
@@ -56,8 +60,6 @@ const ChatInput = () => {
|
|
|
56
60
|
}}
|
|
57
61
|
value={message}
|
|
58
62
|
/>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
export default memo(ChatInput);
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
);
|