@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.
Files changed (125) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/locales/en_US/error.json +2 -1
  3. package/locales/en_US/plugin.json +1 -0
  4. package/locales/en_US/setting.json +2 -1
  5. package/locales/ru_RU/error.json +2 -1
  6. package/locales/ru_RU/plugin.json +1 -0
  7. package/locales/ru_RU/setting.json +2 -1
  8. package/locales/zh_CN/error.json +1 -0
  9. package/locales/zh_CN/plugin.json +2 -1
  10. package/locales/zh_CN/setting.json +2 -1
  11. package/locales/zh_TW/error.json +2 -1
  12. package/locales/zh_TW/plugin.json +1 -0
  13. package/locales/zh_TW/setting.json +2 -1
  14. package/package.json +6 -5
  15. package/src/app/chat/{features/Header → (desktop)/features/ChatHeader}/Desktop.tsx +2 -2
  16. package/src/app/chat/{features/Header → (desktop)/features/ChatHeader}/index.tsx +1 -1
  17. package/src/app/chat/(desktop)/features/ChatInput/index.tsx +22 -0
  18. package/src/app/chat/{features/SessionList/Header → (desktop)/features/SessionHeader}/Desktop.tsx +1 -1
  19. package/src/app/chat/{features/SessionList/Header → (desktop)/features/SessionHeader}/index.tsx +1 -1
  20. package/src/app/chat/{features → (desktop)/features}/SessionList/Desktop.tsx +1 -1
  21. package/src/app/chat/(desktop)/features/SessionList/index.tsx +20 -0
  22. package/src/app/chat/{features/Sidebar → (desktop)/features/SideBar}/Desktop.tsx +4 -4
  23. package/src/app/chat/(desktop)/features/SideBar/index.tsx +20 -0
  24. package/src/app/chat/(desktop)/index.tsx +24 -0
  25. package/src/app/chat/{layout.desktop.tsx → (desktop)/layout/Desktop.tsx} +4 -4
  26. package/src/app/chat/(desktop)/layout/index.tsx +25 -0
  27. package/src/app/chat/(mobile)/features/ChatHeader.tsx +1 -0
  28. package/src/app/chat/(mobile)/features/ChatInput.tsx +14 -0
  29. package/src/app/chat/(mobile)/features/SessionList.tsx +12 -0
  30. package/src/app/chat/(mobile)/features/Topics.tsx +12 -0
  31. package/src/app/chat/(mobile)/index.tsx +20 -0
  32. package/src/app/chat/(mobile)/layout.tsx +15 -0
  33. package/src/app/chat/(mobile)/mobile/page.tsx +21 -0
  34. package/src/app/chat/{features/Header → components/ChatHeader}/Mobile.tsx +2 -1
  35. package/src/app/chat/{features/Header → components/ChatHeader}/ShareButton/Preview.tsx +3 -3
  36. package/src/app/chat/{features/Conversation/Input → components/ChatInput}/index.tsx +23 -21
  37. package/src/app/chat/components/Inspector/index.tsx +17 -0
  38. package/src/app/chat/{features → components}/SessionList/List/Item/index.tsx +2 -2
  39. package/src/app/chat/{features → components}/SessionList/Mobile.tsx +1 -1
  40. package/src/app/chat/{features → components}/SessionList/index.tsx +3 -10
  41. package/src/app/chat/features/Conversation/index.tsx +8 -4
  42. package/src/app/chat/features/PageTitle.tsx +19 -0
  43. package/src/app/chat/layout.tsx +14 -0
  44. package/src/app/chat/page.tsx +9 -4
  45. package/src/app/chat/settings/(desktop)/Header/index.tsx +13 -0
  46. package/src/app/chat/settings/{layout.desktop.tsx → (desktop)/layout.desktop.tsx} +5 -4
  47. package/src/app/chat/settings/(mobile)/Header.tsx +12 -0
  48. package/src/app/chat/settings/{layout.mobile.tsx → (mobile)/layout.mobile.tsx} +3 -1
  49. package/src/app/chat/settings/{features → components}/Header/index.tsx +4 -13
  50. package/src/app/chat/settings/layout.tsx +14 -0
  51. package/src/app/chat/settings/page.tsx +36 -5
  52. package/src/app/home/index.tsx +15 -11
  53. package/src/app/layout.tsx +4 -1
  54. package/src/app/metadata.ts +4 -1
  55. package/src/app/settings/agent/Agent.tsx +3 -3
  56. package/src/app/settings/agent/index.tsx +1 -0
  57. package/src/app/settings/common/Common.tsx +109 -117
  58. package/src/app/settings/features/SideBar/List.tsx +11 -5
  59. package/src/app/settings/llm/LLM/index.tsx +2 -2
  60. package/src/app/welcome/page.tsx +2 -6
  61. package/src/components/PageTitle.tsx +11 -0
  62. package/src/config/client.ts +13 -0
  63. package/src/const/locale.ts +9 -0
  64. package/src/const/settings.ts +1 -1
  65. package/src/const/url.ts +1 -6
  66. package/src/helpers/export.ts +2 -2
  67. package/src/layout/AppMobileLayout.tsx +15 -24
  68. package/src/layout/GlobalLayout/Locale.tsx +44 -0
  69. package/src/layout/GlobalLayout/LocaleLoading.tsx +21 -0
  70. package/src/layout/GlobalLayout/StoreHydration.tsx +28 -0
  71. package/src/layout/GlobalLayout/index.tsx +29 -41
  72. package/src/locales/create.ts +43 -26
  73. package/src/locales/default/setting.ts +2 -1
  74. package/src/locales/options.ts +6 -5
  75. package/src/services/agentMarket.ts +6 -4
  76. package/src/services/pluginMarket.ts +2 -2
  77. package/src/store/global/hooks/useSwitchSettingsOnInit.ts +5 -2
  78. package/src/store/global/{selectors.test.ts → selectors/settings.test.ts} +11 -11
  79. package/src/store/global/selectors/settings.ts +44 -0
  80. package/src/store/global/selectors.ts +1 -36
  81. package/src/store/global/slices/common.ts +3 -4
  82. package/src/types/locale.ts +4 -0
  83. package/src/types/settings.ts +2 -2
  84. package/src/utils/env.ts +2 -0
  85. package/src/utils/responsive.ts +1 -0
  86. package/src/utils/switchLang.ts +5 -1
  87. package/src/app/chat/features/Sidebar/index.tsx +0 -29
  88. package/src/app/chat/index.tsx +0 -54
  89. package/src/app/chat/layout.mobile.tsx +0 -20
  90. package/src/app/chat/mobile/index.tsx +0 -38
  91. package/src/app/chat/mobile/page.tsx +0 -7
  92. package/src/app/chat/settings/index.tsx +0 -51
  93. package/src/layout/GlobalLayout/style.ts +0 -18
  94. /package/src/app/chat/{features/Conversation/Input → (desktop)/features/ChatInput}/Desktop.tsx +0 -0
  95. /package/src/app/chat/{features/SessionList/Header/Mobile.tsx → (mobile)/features/SessionHeader.tsx} +0 -0
  96. /package/src/app/chat/{features/Header → components/ChatHeader}/PluginTag/PluginStatus.tsx +0 -0
  97. /package/src/app/chat/{features/Header → components/ChatHeader}/PluginTag/index.tsx +0 -0
  98. /package/src/app/chat/{features/Header → components/ChatHeader}/ShareButton/Inner.tsx +0 -0
  99. /package/src/app/chat/{features/Header → components/ChatHeader}/ShareButton/index.tsx +0 -0
  100. /package/src/app/chat/{features/Header → components/ChatHeader}/ShareButton/style.ts +0 -0
  101. /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/ActionBar/ActionLeft.tsx +0 -0
  102. /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/ActionBar/ActionRight.tsx +0 -0
  103. /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/ActionBar/Token.tsx +0 -0
  104. /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/Footer/SaveTopic.tsx +0 -0
  105. /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/Footer/index.tsx +0 -0
  106. /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/Mobile.tsx +0 -0
  107. /package/src/app/chat/{features/Sidebar → components/Inspector}/Mobile.tsx +0 -0
  108. /package/src/app/chat/{features/Sidebar → components/Inspector}/SystemRole/Header.tsx +0 -0
  109. /package/src/app/chat/{features/Sidebar → components/Inspector}/SystemRole/index.tsx +0 -0
  110. /package/src/app/chat/{features/Sidebar → components/Inspector}/SystemRole/style.ts +0 -0
  111. /package/src/app/chat/{features/Sidebar → components/Inspector}/Topic/DefaultContent.tsx +0 -0
  112. /package/src/app/chat/{features/Sidebar → components/Inspector}/Topic/SkeletonList.tsx +0 -0
  113. /package/src/app/chat/{features/Sidebar → components/Inspector}/Topic/TopicContent.tsx +0 -0
  114. /package/src/app/chat/{features/Sidebar → components/Inspector}/Topic/TopicItem.tsx +0 -0
  115. /package/src/app/chat/{features/Sidebar → components/Inspector}/Topic/index.tsx +0 -0
  116. /package/src/app/chat/{features/Sidebar → components/Inspector}/TopicSearchBar/index.tsx +0 -0
  117. /package/src/app/chat/{features → components}/SessionList/CollapseGroup/index.tsx +0 -0
  118. /package/src/app/chat/{features → components}/SessionList/Inbox/index.tsx +0 -0
  119. /package/src/app/chat/{features → components}/SessionList/List/AddButton.tsx +0 -0
  120. /package/src/app/chat/{features → components}/SessionList/List/Item/Actions.tsx +0 -0
  121. /package/src/app/chat/{features → components}/SessionList/List/SkeletonList.tsx +0 -0
  122. /package/src/app/chat/{features → components}/SessionList/List/index.tsx +0 -0
  123. /package/src/app/chat/settings/{features → (desktop)}/Header/Desktop.tsx +0 -0
  124. /package/src/app/chat/settings/{features → components}/Header/Mobile.tsx +0 -0
  125. /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
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#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
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#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>
@@ -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
  }
@@ -115,6 +115,7 @@
115
115
  "updateAt": "Last Updated"
116
116
  },
117
117
  "responseData": "Response Data",
118
+ "setting": "Plugin Settings",
118
119
  "settings": {
119
120
  "indexUrl": {
120
121
  "title": "Marketplace Index",
@@ -211,7 +211,8 @@
211
211
  "title": "Font Size"
212
212
  },
213
213
  "lang": {
214
- "title": "Language Settings"
214
+ "title": "Language Settings",
215
+ "autoMode": "Follow System"
215
216
  },
216
217
  "neutralColor": {
217
218
  "desc": "Custom grayscale for different color tendencies",
@@ -36,6 +36,7 @@
36
36
  "password": {
37
37
  "description": "Шифрование приложения включено администратором. Введите пароль приложения, чтобы разблокировать приложение. Пароль необходимо ввести только один раз.",
38
38
  "title": "Введите пароль для разблокировки приложения"
39
- }
39
+ },
40
+ "closeMessage": "Закрыть сообщение"
40
41
  }
41
42
  }
@@ -95,6 +95,7 @@
95
95
  "plugins": {
96
96
  "unknown": "Проверка плагинов..."
97
97
  },
98
+ "setting": "Настройки плагина",
98
99
  "settings": {
99
100
  "indexUrl": {
100
101
  "title": "Индекс рынка",
@@ -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": "Пользовательская шкала серого для различных цветовых тенденций",
@@ -32,6 +32,7 @@
32
32
  "description": "输入你的 OpenAI API Key 即可绕过密码验证。应用不会记录你的 API Key",
33
33
  "title": "使用自定义 API Key"
34
34
  },
35
+ "closeMessage": "关闭提示",
35
36
  "confirm": "确认并重试",
36
37
  "password": {
37
38
  "description": "管理员已开启应用加密,输入应用密码后即可解锁应用。密码只需填写一次",
@@ -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": "设置插件市场"
@@ -198,7 +198,8 @@
198
198
  "title": "字体大小"
199
199
  },
200
200
  "lang": {
201
- "title": "语言设置"
201
+ "autoMode": "跟随系统",
202
+ "title": "语言"
202
203
  },
203
204
  "neutralColor": {
204
205
  "desc": "不同色彩倾向的灰阶自定义",
@@ -36,6 +36,7 @@
36
36
  "password": {
37
37
  "description": "管理員已啟用應用程式加密,輸入應用程式密碼後即可解鎖應用程式。密碼只需填寫一次。",
38
38
  "title": "輸入密碼解鎖應用程式"
39
- }
39
+ },
40
+ "closeMessage": "關閉提示"
40
41
  }
41
42
  }
@@ -115,6 +115,7 @@
115
115
  "updateAt": "最後更新時間"
116
116
  },
117
117
  "responseData": "回應資料",
118
+ "setting": "插件設置",
118
119
  "settings": {
119
120
  "indexUrl": {
120
121
  "title": "外掛市集索引",
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.82.8",
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": "~4.10.0",
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 './PluginTag';
16
- import ShareButton from './ShareButton';
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);
@@ -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 '../../SessionSearchBar';
10
+ import SessionSearchBar from '../../../features/SessionSearchBar';
11
11
 
12
12
  export const useStyles = createStyles(({ css, token }) => ({
13
13
  logo: css`
@@ -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();
@@ -4,7 +4,7 @@ import { ReactNode, memo } from 'react';
4
4
 
5
5
  import FolderPanel from '@/features/FolderPanel';
6
6
 
7
- import Header from './Header';
7
+ import Header from '../SessionHeader';
8
8
 
9
9
  const useStyles = createStyles(({ stylish }) => stylish.noScrollbar);
10
10
 
@@ -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/slices/session/selectors';
9
+ import { sessionSelectors } from '@/store/session/selectors';
10
10
 
11
- import SystemRole from './SystemRole';
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 SideBar = memo<{ children: ReactNode }>(({ children }) => {
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 SideBar;
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 { Sessions } from './features/SessionList';
8
+ import ResponsiveSessionList from '../features/SessionList';
9
9
 
10
- const ChatLayout = memo<PropsWithChildren>(({ children }) => {
10
+ const Desktop = memo<PropsWithChildren>(({ children }) => {
11
11
  useSwitchSideBarOnInit(SidebarTabKey.Chat);
12
12
 
13
13
  return (
14
14
  <AppLayout>
15
- <Sessions />
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 ChatLayout;
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 pkg from '@/../package.json';
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
- const ChatInput = () => {
19
- const { t } = useTranslation('common');
20
- const [expand, setExpand] = useState<boolean>(false);
21
- const [message, setMessage] = useState('');
22
- const { mobile } = useResponsive();
16
+ interface ChatContentProps {
17
+ expand?: boolean;
18
+ mobile?: boolean;
19
+ onExpandChange?: (expand: boolean) => void;
20
+ }
23
21
 
24
- const [isLoading, sendMessage, stopGenerateMessage] = useSessionStore((s) => [
25
- !!s.chatLoadingId,
26
- s.sendMessage,
27
- s.stopGenerateMessage,
28
- ]);
22
+ export const ChatInputContent = memo<ChatContentProps>(
23
+ ({ expand, onExpandChange, mobile: defaultMobile }) => {
24
+ const { t } = useTranslation('common');
29
25
 
30
- const Render = mobile ? Mobile : Desktop;
26
+ const [message, setMessage] = useState('');
27
+ const { mobile: runtimeMobile } = useResponsive();
31
28
 
32
- return (
33
- <Render expand={expand}>
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={setExpand}
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
- </Render>
60
- );
61
- };
62
-
63
- export default memo(ChatInput);
63
+ );
64
+ },
65
+ );