@lobehub/chat 0.83.9 → 0.83.10

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 (147) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/package.json +2 -2
  3. package/src/app/chat/(desktop)/features/{ChatHeader/Desktop.tsx → ChatHeader.tsx} +2 -2
  4. package/src/app/chat/(desktop)/features/{ChatInput/Desktop.tsx → ChatInput.tsx} +5 -7
  5. package/src/app/chat/(desktop)/features/{SessionHeader/Desktop.tsx → SessionHeader.tsx} +1 -1
  6. package/src/app/chat/(desktop)/features/{SessionList/Desktop.tsx → SessionList.tsx} +5 -4
  7. package/src/app/chat/(desktop)/features/{SideBar/Desktop.tsx → SideBar.tsx} +5 -4
  8. package/src/app/chat/(desktop)/index.tsx +14 -8
  9. package/src/app/chat/(desktop)/{layout/Desktop.tsx → layout.desktop.tsx} +7 -8
  10. package/src/app/chat/(desktop)/layout.responsive.tsx +12 -0
  11. package/src/app/chat/(mobile)/features/ChatHeader.tsx +54 -1
  12. package/src/app/chat/(mobile)/features/ChatInput.tsx +28 -8
  13. package/src/app/chat/(mobile)/features/SessionList.tsx +13 -8
  14. package/src/app/chat/{components/Inspector/Mobile.tsx → (mobile)/features/TopicList.tsx} +6 -4
  15. package/src/app/chat/(mobile)/index.tsx +3 -5
  16. package/src/app/chat/(mobile)/layout.mobile.tsx +17 -0
  17. package/src/app/chat/(mobile)/mobile/index.tsx +19 -0
  18. package/src/app/chat/(mobile)/mobile/layout.mobile.tsx +11 -0
  19. package/src/app/chat/(mobile)/mobile/page.tsx +2 -20
  20. package/src/app/chat/{components → features}/ChatHeader/ShareButton/Preview.tsx +25 -9
  21. package/src/app/chat/{components → features}/ChatHeader/ShareButton/style.ts +7 -7
  22. package/src/app/chat/{components/ChatInput → features/ChatInputContent}/index.tsx +3 -1
  23. package/src/app/chat/{components/SessionList → features/SessionListContent}/Inbox/index.tsx +7 -5
  24. package/src/app/chat/{components/SessionList → features/SessionListContent}/index.tsx +3 -1
  25. package/src/app/chat/{components/Inspector → features/TopicListContent}/index.tsx +3 -1
  26. package/src/app/chat/page.tsx +3 -1
  27. package/src/app/chat/settings/(desktop)/index.tsx +14 -0
  28. package/src/app/chat/settings/(desktop)/layout.desktop.tsx +10 -15
  29. package/src/app/chat/settings/(desktop)/layout.responsive.tsx +12 -0
  30. package/src/app/chat/settings/(mobile)/index.tsx +14 -0
  31. package/src/app/chat/settings/(mobile)/layout.mobile.tsx +4 -8
  32. package/src/app/chat/settings/features/EditPage.tsx +38 -0
  33. package/src/app/chat/settings/page.tsx +9 -33
  34. package/src/app/market/(desktop)/{AgentDetail/Desktop.tsx → features/AgentDetail.tsx} +5 -3
  35. package/src/app/market/(desktop)/index.tsx +12 -0
  36. package/src/app/market/(desktop)/{layout/Desktop.tsx → layout.desktop.tsx} +5 -5
  37. package/src/app/market/(desktop)/layout.responsive.tsx +16 -0
  38. package/src/app/market/{components/AgentDetail/Mobile.tsx → (mobile)/features/AgentDetail.tsx} +6 -4
  39. package/src/app/market/(mobile)/index.tsx +12 -0
  40. package/src/app/market/(mobile)/layout.mobile.tsx +5 -5
  41. package/src/app/market/{components/AgentDetail → features/AgentDetailContent}/AgentInfo/Header.tsx +1 -0
  42. package/src/app/market/{components/AgentDetail → features/AgentDetailContent}/index.tsx +3 -1
  43. package/src/app/market/features/TagList/index.tsx +2 -1
  44. package/src/app/market/page.tsx +8 -5
  45. package/src/app/settings/{features/Header/Desktop.tsx → (desktop)/features/Header.tsx} +2 -2
  46. package/src/app/settings/(desktop)/index.tsx +17 -0
  47. package/src/app/settings/{layout.desktop/Desktop.tsx → (desktop)/layout.desktop.tsx} +10 -9
  48. package/src/app/settings/(desktop)/layout.responsive.tsx +14 -0
  49. package/src/app/settings/{mobile → (mobile)/features}/ExtraList.tsx +1 -1
  50. package/src/app/settings/(mobile)/features/Header/Home.tsx +8 -0
  51. package/src/app/settings/{features/Header/Mobile.tsx → (mobile)/features/Header/index.tsx} +1 -0
  52. package/src/app/settings/(mobile)/index.tsx +3 -0
  53. package/src/app/settings/(mobile)/layout.mobile.tsx +19 -0
  54. package/src/app/settings/{mobile → (mobile)/mobile}/index.tsx +7 -7
  55. package/src/app/settings/(mobile)/mobile/layout.mobile.tsx +14 -0
  56. package/src/app/settings/agent/Agent.tsx +30 -0
  57. package/src/app/settings/agent/index.tsx +23 -0
  58. package/src/app/settings/agent/layout.tsx +1 -0
  59. package/src/app/settings/agent/page.tsx +2 -31
  60. package/src/app/settings/common/index.tsx +23 -0
  61. package/src/app/settings/common/layout.tsx +1 -0
  62. package/src/app/settings/common/page.tsx +2 -14
  63. package/src/app/settings/layout.server.tsx +12 -0
  64. package/src/app/settings/llm/index.tsx +23 -0
  65. package/src/app/settings/llm/layout.tsx +1 -0
  66. package/src/app/settings/llm/page.tsx +2 -14
  67. package/src/app/settings/page.tsx +14 -1
  68. package/src/app/welcome/(desktop)/features/Showcase.tsx +23 -0
  69. package/src/app/welcome/(desktop)/index.tsx +19 -0
  70. package/src/app/welcome/{DesktopLayout/Desktop.tsx → (desktop)/layout.desktop.tsx} +4 -4
  71. package/src/app/welcome/(desktop)/layout.responsive.tsx +14 -0
  72. package/src/app/welcome/(mobile)/features/Header.tsx +6 -0
  73. package/src/app/welcome/(mobile)/features/Showcase.tsx +16 -0
  74. package/src/app/welcome/(mobile)/index.tsx +10 -0
  75. package/src/app/welcome/(mobile)/layout.mobile.tsx +20 -0
  76. package/src/app/welcome/features/Banner/Hero.tsx +2 -3
  77. package/src/app/welcome/features/Banner/index.tsx +34 -31
  78. package/src/app/welcome/features/Banner/style.ts +10 -1
  79. package/src/app/welcome/page.tsx +9 -7
  80. package/src/components/ResponsiveIndex.tsx +17 -0
  81. package/src/features/MobileTabBar/index.tsx +1 -1
  82. package/src/features/SideBar/BottomActions.tsx +1 -1
  83. package/src/layout/{AppLayout.tsx → AppLayout.desktop.tsx} +2 -2
  84. package/src/layout/{AppMobileLayout.tsx → AppLayout.mobile.tsx} +2 -2
  85. package/src/layout/GlobalLayout/StoreHydration.tsx +15 -1
  86. package/src/layout/ResponsiveLayout.client.tsx +18 -0
  87. package/src/{components/ResponsiveLayout.tsx → layout/ResponsiveLayout.server.tsx} +4 -3
  88. package/src/store/session/slices/session/initialState.ts +2 -2
  89. package/src/app/chat/(desktop)/features/ChatHeader/index.tsx +0 -14
  90. package/src/app/chat/(desktop)/features/ChatInput/index.tsx +0 -22
  91. package/src/app/chat/(desktop)/features/SessionHeader/index.tsx +0 -14
  92. package/src/app/chat/(desktop)/features/SessionList/index.tsx +0 -20
  93. package/src/app/chat/(desktop)/features/SideBar/index.tsx +0 -20
  94. package/src/app/chat/(desktop)/layout/index.tsx +0 -25
  95. package/src/app/chat/(mobile)/features/Topics.tsx +0 -12
  96. package/src/app/chat/(mobile)/layout.tsx +0 -15
  97. package/src/app/chat/components/ChatHeader/Mobile.tsx +0 -54
  98. package/src/app/chat/components/ChatInput/Mobile.tsx +0 -35
  99. package/src/app/chat/components/SessionList/Mobile.tsx +0 -16
  100. package/src/app/chat/layout.tsx +0 -15
  101. package/src/app/chat/settings/layout.tsx +0 -14
  102. package/src/app/market/(desktop)/AgentDetail/index.tsx +0 -16
  103. package/src/app/market/(desktop)/Header/index.tsx +0 -13
  104. package/src/app/market/(desktop)/layout/index.tsx +0 -17
  105. package/src/app/market/(mobile)/AgentDetail.tsx +0 -12
  106. package/src/app/market/layout.tsx +0 -13
  107. package/src/app/settings/features/Header/index.tsx +0 -14
  108. package/src/app/settings/layout.desktop/index.tsx +0 -32
  109. package/src/app/settings/layout.mobile.tsx +0 -16
  110. package/src/app/settings/layout.tsx +0 -15
  111. package/src/app/settings/mobile/page.tsx +0 -7
  112. package/src/app/welcome/DesktopLayout/index.tsx +0 -15
  113. package/src/app/welcome/MobileLayout.tsx +0 -23
  114. package/src/app/welcome/layout.tsx +0 -22
  115. /package/src/app/chat/{components → features}/ChatHeader/PluginTag/PluginStatus.tsx +0 -0
  116. /package/src/app/chat/{components → features}/ChatHeader/PluginTag/index.tsx +0 -0
  117. /package/src/app/chat/{components → features}/ChatHeader/ShareButton/Inner.tsx +0 -0
  118. /package/src/app/chat/{components → features}/ChatHeader/ShareButton/index.tsx +0 -0
  119. /package/src/app/chat/{components/ChatInput → features/ChatInputContent}/ActionBar/ActionLeft.tsx +0 -0
  120. /package/src/app/chat/{components/ChatInput → features/ChatInputContent}/ActionBar/ActionRight.tsx +0 -0
  121. /package/src/app/chat/{components/ChatInput → features/ChatInputContent}/ActionBar/Token.tsx +0 -0
  122. /package/src/app/chat/{components/ChatInput → features/ChatInputContent}/Footer/SaveTopic.tsx +0 -0
  123. /package/src/app/chat/{components/ChatInput → features/ChatInputContent}/Footer/index.tsx +0 -0
  124. /package/src/app/chat/features/{PageTitle.tsx → PageTitle/index.tsx} +0 -0
  125. /package/src/app/chat/{components/SessionList → features/SessionListContent}/CollapseGroup/index.tsx +0 -0
  126. /package/src/app/chat/{components/SessionList → features/SessionListContent}/List/AddButton.tsx +0 -0
  127. /package/src/app/chat/{components/SessionList → features/SessionListContent}/List/Item/Actions.tsx +0 -0
  128. /package/src/app/chat/{components/SessionList → features/SessionListContent}/List/Item/index.tsx +0 -0
  129. /package/src/app/chat/{components/SessionList → features/SessionListContent}/List/SkeletonList.tsx +0 -0
  130. /package/src/app/chat/{components/SessionList → features/SessionListContent}/List/index.tsx +0 -0
  131. /package/src/app/chat/{components/Inspector → features/TopicListContent}/SystemRole/Header.tsx +0 -0
  132. /package/src/app/chat/{components/Inspector → features/TopicListContent}/SystemRole/index.tsx +0 -0
  133. /package/src/app/chat/{components/Inspector → features/TopicListContent}/SystemRole/style.ts +0 -0
  134. /package/src/app/chat/{components/Inspector → features/TopicListContent}/Topic/DefaultContent.tsx +0 -0
  135. /package/src/app/chat/{components/Inspector → features/TopicListContent}/Topic/SkeletonList.tsx +0 -0
  136. /package/src/app/chat/{components/Inspector → features/TopicListContent}/Topic/TopicContent.tsx +0 -0
  137. /package/src/app/chat/{components/Inspector → features/TopicListContent}/Topic/TopicItem.tsx +0 -0
  138. /package/src/app/chat/{components/Inspector → features/TopicListContent}/Topic/index.tsx +0 -0
  139. /package/src/app/chat/{components/Inspector → features/TopicListContent}/TopicSearchBar/index.tsx +0 -0
  140. /package/src/app/market/(desktop)/{Header/Desktop.tsx → features/Header.tsx} +0 -0
  141. /package/src/app/market/(mobile)/{Header.tsx → features/Header.tsx} +0 -0
  142. /package/src/app/market/{components/AgentDetail → features/AgentDetailContent}/AgentInfo/Comment.tsx +0 -0
  143. /package/src/app/market/{components/AgentDetail → features/AgentDetailContent}/AgentInfo/Loading.tsx +0 -0
  144. /package/src/app/market/{components/AgentDetail → features/AgentDetailContent}/AgentInfo/TokenTag.tsx +0 -0
  145. /package/src/app/market/{components/AgentDetail → features/AgentDetailContent}/AgentInfo/index.tsx +0 -0
  146. /package/src/app/market/{components/AgentDetail → features/AgentDetailContent}/AgentInfo/style.ts +0 -0
  147. /package/src/app/welcome/{features/Footer/index.tsx → (desktop)/features/Footer.tsx} +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,43 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.83.10](https://github.com/lobehub/lobe-chat/compare/v0.83.9...v0.83.10)
6
+
7
+ <sup>Released on **2023-10-09**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **layout**: Refactor layout, Refactor settings layout, Refactor ssc layout.
12
+ - **share**: Use modern-screenshot.
13
+
14
+ #### 🐛 Bug Fixes
15
+
16
+ - **misc**: Fix rsc layout.
17
+
18
+ <br/>
19
+
20
+ <details>
21
+ <summary><kbd>Improvements and Fixes</kbd></summary>
22
+
23
+ #### Code refactoring
24
+
25
+ - **layout**: Refactor layout ([ace21f4](https://github.com/lobehub/lobe-chat/commit/ace21f4))
26
+ - **layout**: Refactor settings layout ([bd48121](https://github.com/lobehub/lobe-chat/commit/bd48121))
27
+ - **layout**: Refactor ssc layout ([26e1c41](https://github.com/lobehub/lobe-chat/commit/26e1c41))
28
+ - **share**: Use modern-screenshot, closes [#256](https://github.com/lobehub/lobe-chat/issues/256) ([b3d7108](https://github.com/lobehub/lobe-chat/commit/b3d7108))
29
+
30
+ #### What's fixed
31
+
32
+ - **misc**: Fix rsc layout ([d73f13f](https://github.com/lobehub/lobe-chat/commit/d73f13f))
33
+
34
+ </details>
35
+
36
+ <div align="right">
37
+
38
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
39
+
40
+ </div>
41
+
5
42
  ### [Version 0.83.9](https://github.com/lobehub/lobe-chat/compare/v0.83.8...v0.83.9)
6
43
 
7
44
  <sup>Released on **2023-10-08**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.83.9",
3
+ "version": "0.83.10",
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",
@@ -83,7 +83,6 @@
83
83
  "emoji-mart": "^5",
84
84
  "fast-deep-equal": "^3",
85
85
  "gpt-tokenizer": "^2",
86
- "html-to-image": "^1",
87
86
  "i18next": "^23",
88
87
  "i18next-browser-languagedetector": "^7",
89
88
  "i18next-resources-for-ts": "^1",
@@ -93,6 +92,7 @@
93
92
  "lodash-es": "^4",
94
93
  "lucide-react": "latest",
95
94
  "mixpanel-browser": "^2",
95
+ "modern-screenshot": "^4",
96
96
  "nanoid": "^5",
97
97
  "next": "^13.5.3",
98
98
  "openai": "^4.10.0",
@@ -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 '../../../components/ChatHeader/PluginTag';
16
- import ShareButton from '../../../components/ChatHeader/ShareButton';
15
+ import PluginTag from '../../features/ChatHeader/PluginTag';
16
+ import ShareButton from '../../features/ChatHeader/ShareButton';
17
17
 
18
18
  const Header = memo(() => {
19
19
  const init = useSessionChatInit();
@@ -1,15 +1,13 @@
1
1
  import { DraggablePanel } from '@lobehub/ui';
2
- import { ReactNode, memo } from 'react';
2
+ import { memo, useState } from 'react';
3
3
 
4
4
  import { CHAT_TEXTAREA_HEIGHT, HEADER_HEIGHT } from '@/const/layoutTokens';
5
5
  import { useGlobalStore } from '@/store/global';
6
6
 
7
- interface ChatInputDesktopLayoutProps {
8
- children: ReactNode;
9
- expand?: boolean;
10
- }
7
+ import ChatInputContent from '../../features/ChatInputContent';
11
8
 
12
- const ChatInputDesktopLayout = memo<ChatInputDesktopLayoutProps>(({ children, expand }) => {
9
+ const ChatInputDesktopLayout = memo(() => {
10
+ const [expand, setExpand] = useState<boolean>(false);
13
11
  const [inputHeight, updatePreference] = useGlobalStore((s) => [
14
12
  s.preference.inputHeight,
15
13
  s.updatePreference,
@@ -32,7 +30,7 @@ const ChatInputDesktopLayout = memo<ChatInputDesktopLayoutProps>(({ children, ex
32
30
  size={{ height: inputHeight, width: '100%' }}
33
31
  style={{ zIndex: 10 }}
34
32
  >
35
- {children}
33
+ <ChatInputContent expand={expand} onExpandChange={setExpand} />
36
34
  </DraggablePanel>
37
35
  );
38
36
  });
@@ -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 '../../../features/SessionSearchBar';
10
+ import SessionSearchBar from '../../features/SessionSearchBar';
11
11
 
12
12
  export const useStyles = createStyles(({ css, token }) => ({
13
13
  logo: css`
@@ -1,21 +1,22 @@
1
1
  import { DraggablePanelBody } from '@lobehub/ui';
2
2
  import { createStyles } from 'antd-style';
3
- import { ReactNode, memo } from 'react';
3
+ import { memo } from 'react';
4
4
 
5
5
  import FolderPanel from '@/features/FolderPanel';
6
6
 
7
- import Header from '../SessionHeader';
7
+ import SessionListContent from '../../features/SessionListContent';
8
+ import Header from './SessionHeader';
8
9
 
9
10
  const useStyles = createStyles(({ stylish }) => stylish.noScrollbar);
10
11
 
11
- const Sessions = memo<{ children: ReactNode }>(({ children }) => {
12
+ const Sessions = memo(() => {
12
13
  const { styles } = useStyles();
13
14
 
14
15
  return (
15
16
  <FolderPanel>
16
17
  <Header />
17
18
  <DraggablePanelBody className={styles} style={{ padding: 0 }}>
18
- {children}
19
+ <SessionListContent />
19
20
  </DraggablePanelBody>
20
21
  </FolderPanel>
21
22
  );
@@ -1,6 +1,6 @@
1
1
  import { DraggablePanel, DraggablePanelContainer } from '@lobehub/ui';
2
2
  import { createStyles } from 'antd-style';
3
- import { ReactNode, memo } from 'react';
3
+ import { memo } from 'react';
4
4
 
5
5
  import SafeSpacing from '@/components/SafeSpacing';
6
6
  import { CHAT_SIDEBAR_WIDTH } from '@/const/layoutTokens';
@@ -8,7 +8,8 @@ import { useGlobalStore } from '@/store/global';
8
8
  import { useSessionStore } from '@/store/session';
9
9
  import { sessionSelectors } from '@/store/session/selectors';
10
10
 
11
- import SystemRole from '../../../components/Inspector/SystemRole';
11
+ import TopicListContent from '../../features/TopicListContent';
12
+ import SystemRole from '../../features/TopicListContent/SystemRole';
12
13
 
13
14
  const useStyles = createStyles(({ css, token }) => ({
14
15
  content: css`
@@ -23,7 +24,7 @@ const useStyles = createStyles(({ css, token }) => ({
23
24
  `,
24
25
  }));
25
26
 
26
- const Desktop = memo<{ children: ReactNode }>(({ children }) => {
27
+ const Desktop = memo(() => {
27
28
  const { styles } = useStyles();
28
29
  const [showAgentSettings, toggleConfig] = useGlobalStore((s) => [
29
30
  s.preference.showChatSideBar,
@@ -49,7 +50,7 @@ const Desktop = memo<{ children: ReactNode }>(({ children }) => {
49
50
  >
50
51
  <SafeSpacing />
51
52
  {!isInbox && <SystemRole />}
52
- {children}
53
+ <TopicListContent />
53
54
  </DraggablePanelContainer>
54
55
  </DraggablePanel>
55
56
  );
@@ -3,20 +3,26 @@
3
3
  import { memo } from 'react';
4
4
  import { Flexbox } from 'react-layout-kit';
5
5
 
6
+ import ResponsiveIndex from '@/components/ResponsiveIndex';
7
+
8
+ import Mobile from '../(mobile)';
6
9
  import Conversation from '../features/Conversation';
7
10
  import PageTitle from '../features/PageTitle';
8
11
  import ChatHeader from './features/ChatHeader';
9
12
  import ChatInput from './features/ChatInput';
10
13
  import SideBar from './features/SideBar';
14
+ import Layout from './layout.responsive';
11
15
 
12
16
  const DesktopPage = memo(() => (
13
- <>
14
- <PageTitle />
15
- <ChatHeader />
16
- <Flexbox flex={1} height={'calc(100vh - 64px)'} horizontal>
17
- <Conversation chatInput={<ChatInput />} />
18
- <SideBar />
19
- </Flexbox>
20
- </>
17
+ <ResponsiveIndex Mobile={Mobile}>
18
+ <Layout>
19
+ <PageTitle />
20
+ <ChatHeader />
21
+ <Flexbox flex={1} height={'calc(100vh - 64px)'} horizontal>
22
+ <Conversation chatInput={<ChatInput />} />
23
+ <SideBar />
24
+ </Flexbox>
25
+ </Layout>
26
+ </ResponsiveIndex>
21
27
  ));
22
28
  export default DesktopPage;
@@ -1,17 +1,18 @@
1
+ 'use client';
2
+
1
3
  import { PropsWithChildren, memo } from 'react';
2
4
  import { Flexbox } from 'react-layout-kit';
3
5
 
4
- import AppLayout from '@/layout/AppLayout';
6
+ import AppLayoutDesktop from '@/layout/AppLayout.desktop';
5
7
  import { useSwitchSideBarOnInit } from '@/store/global';
6
8
  import { SidebarTabKey } from '@/store/global/initialState';
7
9
 
8
- import ResponsiveSessionList from '../features/SessionList';
10
+ import ResponsiveSessionList from './features/SessionList';
9
11
 
10
- const Desktop = memo<PropsWithChildren>(({ children }) => {
12
+ export default memo(({ children }: PropsWithChildren) => {
11
13
  useSwitchSideBarOnInit(SidebarTabKey.Chat);
12
-
13
14
  return (
14
- <AppLayout>
15
+ <AppLayoutDesktop>
15
16
  <ResponsiveSessionList />
16
17
  <Flexbox
17
18
  flex={1}
@@ -21,8 +22,6 @@ const Desktop = memo<PropsWithChildren>(({ children }) => {
21
22
  >
22
23
  {children}
23
24
  </Flexbox>
24
- </AppLayout>
25
+ </AppLayoutDesktop>
25
26
  );
26
27
  });
27
-
28
- export default Desktop;
@@ -0,0 +1,12 @@
1
+ import { PropsWithChildren, memo } from 'react';
2
+
3
+ import ResponsiveLayout from '@/layout/ResponsiveLayout.client';
4
+
5
+ import Mobile from '../(mobile)/layout.mobile';
6
+ import Desktop from './layout.desktop';
7
+
8
+ export default memo(({ children }: PropsWithChildren) => (
9
+ <ResponsiveLayout Desktop={Desktop} Mobile={Mobile}>
10
+ {children}
11
+ </ResponsiveLayout>
12
+ ));
@@ -1 +1,54 @@
1
- export { default } from '../../components/ChatHeader/Mobile';
1
+ import { ActionIcon, MobileNavBar, MobileNavBarTitle } from '@lobehub/ui';
2
+ import { LayoutList, Settings } from 'lucide-react';
3
+ import { useRouter } from 'next/navigation';
4
+ import { memo } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+
7
+ import { MOBILE_HEADER_ICON_SIZE } from '@/const/layoutTokens';
8
+ import { useGlobalStore } from '@/store/global';
9
+ import { useSessionStore } from '@/store/session';
10
+ import { agentSelectors, sessionSelectors } from '@/store/session/selectors';
11
+ import { pathString } from '@/utils/url';
12
+
13
+ import ShareButton from '../../features/ChatHeader/ShareButton';
14
+
15
+ const MobileHeader = memo(() => {
16
+ const { t } = useTranslation('common');
17
+ const router = useRouter();
18
+
19
+ const [isInbox, title] = useSessionStore((s) => [
20
+ sessionSelectors.isInboxSession(s),
21
+ agentSelectors.currentAgentTitle(s),
22
+ ]);
23
+
24
+ const [toggleConfig] = useGlobalStore((s) => [s.toggleMobileTopic]);
25
+
26
+ const displayTitle = isInbox ? t('inbox.title') : title;
27
+
28
+ return (
29
+ <MobileNavBar
30
+ center={<MobileNavBarTitle title={displayTitle} />}
31
+ onBackClick={() => router.push('/chat')}
32
+ right={
33
+ <>
34
+ <ShareButton />
35
+ <ActionIcon
36
+ icon={LayoutList}
37
+ onClick={() => toggleConfig()}
38
+ size={MOBILE_HEADER_ICON_SIZE}
39
+ />
40
+ {!isInbox && (
41
+ <ActionIcon
42
+ icon={Settings}
43
+ onClick={() => router.push(pathString('/chat/settings', { hash: location.hash }))}
44
+ size={MOBILE_HEADER_ICON_SIZE}
45
+ />
46
+ )}
47
+ </>
48
+ }
49
+ showBackButton
50
+ />
51
+ );
52
+ });
53
+
54
+ export default MobileHeader;
@@ -1,14 +1,34 @@
1
+ import { createStyles } from 'antd-style';
1
2
  import { memo } from 'react';
2
3
 
3
- import { ChatInputContent } from '../../components/ChatInput';
4
- import Mobile from '../../components/ChatInput/Mobile';
4
+ import SafeSpacing from '@/components/SafeSpacing';
5
+ import { CHAT_TEXTAREA_HEIGHT_MOBILE } from '@/const/layoutTokens';
5
6
 
6
- const ChatInput = () => {
7
+ import ChatInputContent from '../../features/ChatInputContent';
8
+
9
+ const useStyles = createStyles(
10
+ ({ css, token }) => css`
11
+ position: fixed;
12
+ right: 0;
13
+ bottom: 0;
14
+ left: 0;
15
+
16
+ width: 100vw;
17
+
18
+ background: ${token.colorBgLayout};
19
+ `,
20
+ );
21
+
22
+ const ChatInputMobileLayout = memo(() => {
23
+ const { styles } = useStyles();
7
24
  return (
8
- <Mobile>
9
- <ChatInputContent mobile />
10
- </Mobile>
25
+ <>
26
+ <SafeSpacing height={CHAT_TEXTAREA_HEIGHT_MOBILE} mobile position={'bottom'} />
27
+ <div className={styles}>
28
+ <ChatInputContent mobile />
29
+ </div>
30
+ </>
11
31
  );
12
- };
32
+ });
13
33
 
14
- export default memo(ChatInput);
34
+ export default ChatInputMobileLayout;
@@ -1,12 +1,17 @@
1
1
  import { memo } from 'react';
2
2
 
3
- import { SessionListContent } from '../../components/SessionList';
4
- import Wrapper from '../../components/SessionList/Mobile';
3
+ import SessionListContent from '../../features/SessionListContent';
4
+ import SessionSearchBar from '../../features/SessionSearchBar';
5
5
 
6
- const SessionList = memo(() => (
7
- <Wrapper>
8
- <SessionListContent />
9
- </Wrapper>
10
- ));
6
+ const Sessions = memo(() => {
7
+ return (
8
+ <>
9
+ <div style={{ padding: '8px 16px' }}>
10
+ <SessionSearchBar />
11
+ </div>
12
+ <SessionListContent />
13
+ </>
14
+ );
15
+ });
11
16
 
12
- export default SessionList;
17
+ export default Sessions;
@@ -1,10 +1,12 @@
1
1
  import { Modal } from '@lobehub/ui';
2
- import { PropsWithChildren, memo } from 'react';
2
+ import { memo } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
 
5
5
  import { useGlobalStore } from '@/store/global';
6
6
 
7
- const Mobile = memo<PropsWithChildren>(({ children }) => {
7
+ import TopicListContent from '../../features/TopicListContent';
8
+
9
+ const Topics = memo(() => {
8
10
  const [showAgentSettings, toggleConfig] = useGlobalStore((s) => [
9
11
  s.preference.mobileShowTopic,
10
12
  s.toggleMobileTopic,
@@ -14,9 +16,9 @@ const Mobile = memo<PropsWithChildren>(({ children }) => {
14
16
 
15
17
  return (
16
18
  <Modal onCancel={() => toggleConfig(false)} open={showAgentSettings} title={t('topic.title')}>
17
- {children}
19
+ <TopicListContent />
18
20
  </Modal>
19
21
  );
20
22
  });
21
23
 
22
- export default Mobile;
24
+ export default Topics;
@@ -2,18 +2,16 @@
2
2
 
3
3
  import { memo } from 'react';
4
4
 
5
- import AppMobileLayout from '@/layout/AppMobileLayout';
6
-
7
5
  import PageTitle from '../features/PageTitle';
8
- import SessionHeader from './features/SessionHeader';
9
6
  import SessionList from './features/SessionList';
7
+ import Layout from './layout.mobile';
10
8
 
11
9
  const ChatMobilePage = memo(() => {
12
10
  return (
13
- <AppMobileLayout navBar={<SessionHeader />} showTabBar>
11
+ <Layout>
14
12
  <PageTitle />
15
13
  <SessionList />
16
- </AppMobileLayout>
14
+ </Layout>
17
15
  );
18
16
  });
19
17
 
@@ -0,0 +1,17 @@
1
+ 'use client';
2
+
3
+ import { PropsWithChildren, memo } from 'react';
4
+
5
+ import SessionHeader from '@/app/chat/(mobile)/features/SessionHeader';
6
+ import AppLayoutMobile from '@/layout/AppLayout.mobile';
7
+ import { useSwitchSideBarOnInit } from '@/store/global';
8
+ import { SidebarTabKey } from '@/store/global/initialState';
9
+
10
+ export default memo(({ children }: PropsWithChildren) => {
11
+ useSwitchSideBarOnInit(SidebarTabKey.Chat);
12
+ return (
13
+ <AppLayoutMobile navBar={<SessionHeader />} showTabBar>
14
+ {children}
15
+ </AppLayoutMobile>
16
+ );
17
+ });
@@ -0,0 +1,19 @@
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 ChatInput from '../features/ChatInput';
8
+ import TopicList from '../features/TopicList';
9
+ import Layout from './layout.mobile';
10
+
11
+ const Chat = memo(() => (
12
+ <Layout>
13
+ <Flexbox height={'calc(100vh - 44px)'} horizontal>
14
+ <Conversation chatInput={<ChatInput />} mobile />
15
+ <TopicList />
16
+ </Flexbox>
17
+ </Layout>
18
+ ));
19
+ export default Chat;
@@ -0,0 +1,11 @@
1
+ 'use client';
2
+
3
+ import { PropsWithChildren } from 'react';
4
+
5
+ import AppLayoutMobile from '@/layout/AppLayout.mobile';
6
+
7
+ import ChatHeader from '../features/ChatHeader';
8
+
9
+ export default ({ children }: PropsWithChildren) => (
10
+ <AppLayoutMobile navBar={<ChatHeader />}>{children}</AppLayoutMobile>
11
+ );
@@ -1,21 +1,3 @@
1
- 'use client';
1
+ import Index from './index';
2
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;
3
+ export default () => <Index />;
@@ -2,24 +2,25 @@ import { SiOpenai } from '@icons-pack/react-simple-icons';
2
2
  import { Avatar, ChatHeaderTitle, Logo, Markdown, Tag } from '@lobehub/ui';
3
3
  import { Button, SegmentedProps } from 'antd';
4
4
  import dayjs from 'dayjs';
5
- import { toJpeg, toPng, toSvg } from 'html-to-image';
5
+ import { domToJpeg, domToPng, domToSvg, domToWebp } from 'modern-screenshot';
6
6
  import { memo, useCallback, useState } from 'react';
7
7
  import { useTranslation } from 'react-i18next';
8
8
  import { Flexbox } from 'react-layout-kit';
9
9
  import ChatList from 'src/app/chat/features/Conversation/ChatList';
10
10
 
11
- import PluginTag from '@/app/chat/components/ChatHeader/PluginTag';
11
+ import pkg from '@/../package.json';
12
12
  import { useSessionStore } from '@/store/session';
13
13
  import { agentSelectors } from '@/store/session/slices/agentConfig';
14
14
  import { sessionSelectors } from '@/store/session/slices/session/selectors';
15
15
 
16
- import pkg from '../../../../../../package.json';
16
+ import PluginTag from '../../ChatHeader/PluginTag';
17
17
  import { useStyles } from './style';
18
18
 
19
19
  export enum ImageType {
20
20
  JPG = 'jpg',
21
21
  PNG = 'png',
22
22
  SVG = 'svg',
23
+ WEBP = 'webp',
23
24
  }
24
25
 
25
26
  export const imageTypeOptions: SegmentedProps['options'] = [
@@ -35,6 +36,10 @@ export const imageTypeOptions: SegmentedProps['options'] = [
35
36
  label: 'SVG',
36
37
  value: ImageType.SVG,
37
38
  },
39
+ {
40
+ label: 'WEBP',
41
+ value: ImageType.WEBP,
42
+ },
38
43
  ];
39
44
 
40
45
  interface PreviewProps {
@@ -69,26 +74,37 @@ const Preview = memo<PreviewProps>(({ withSystemRole, imageType, withBackground,
69
74
  let screenshotFn: any;
70
75
  switch (imageType) {
71
76
  case ImageType.JPG: {
72
- screenshotFn = toJpeg;
77
+ screenshotFn = domToJpeg;
73
78
  break;
74
79
  }
75
80
  case ImageType.PNG: {
76
- screenshotFn = toPng;
81
+ screenshotFn = domToPng;
77
82
  break;
78
83
  }
79
84
  case ImageType.SVG: {
80
- screenshotFn = toSvg;
85
+ screenshotFn = domToSvg;
86
+ break;
87
+ }
88
+ case ImageType.WEBP: {
89
+ screenshotFn = domToWebp;
81
90
  break;
82
91
  }
83
92
  }
84
- const dataUrl = await screenshotFn(document.querySelector('#preview') as HTMLDivElement);
93
+
94
+ const dataUrl = await screenshotFn(document.querySelector('#preview') as HTMLDivElement, {
95
+ features: {
96
+ // 不启用移除控制符,否则会导致 safari emoji 报错
97
+ removeControlCharacter: false,
98
+ },
99
+ scale: 2,
100
+ });
85
101
  const link = document.createElement('a');
86
102
  link.download = `LobeChat_${title}_${dayjs().format('YYYY-MM-DD')}.${imageType}`;
87
103
  link.href = dataUrl;
88
104
  link.click();
89
105
  setLoading(false);
90
- } catch {
91
- console.error('Failed to download image');
106
+ } catch (error) {
107
+ console.error('Failed to download image', error);
92
108
  setLoading(false);
93
109
  }
94
110
  }, [imageType, title]);
@@ -1,22 +1,22 @@
1
1
  import { createStyles } from 'antd-style';
2
- import { rgba } from 'polished';
3
2
 
4
3
  export const useStyles = createStyles(({ css, token, stylish, cx }, withBackground: boolean) => ({
5
4
  background: css`
6
5
  padding: 24px;
7
- background: url('/images/screenshot_background.webp') no-repeat;
8
- background-size: 100% 100%;
6
+
7
+ background-color: ${token.colorBgLayout};
8
+ background-image: url('/images/screenshot_background.webp');
9
+ background-position: center;
10
+ background-size: 120% 120%;
9
11
  `,
10
12
  container: cx(
11
13
  withBackground &&
12
14
  css`
13
15
  overflow: hidden;
14
- border: 1px solid ${rgba(token.colorText, 0.15)};
16
+ border: 2px solid ${token.colorBorder};
15
17
  border-radius: ${token.borderRadiusLG}px;
16
- box-shadow:
17
- 0 8px 16px -4px rgba(0, 0, 0, 75%),
18
- 0 8px 24px -4px rgba(0, 0, 0, 75%);
19
18
  `,
19
+
20
20
  css`
21
21
  background: ${token.colorBgLayout};
22
22
  `,
@@ -19,7 +19,7 @@ interface ChatContentProps {
19
19
  onExpandChange?: (expand: boolean) => void;
20
20
  }
21
21
 
22
- export const ChatInputContent = memo<ChatContentProps>(
22
+ const ChatInputContent = memo<ChatContentProps>(
23
23
  ({ expand, onExpandChange, mobile: defaultMobile }) => {
24
24
  const { t } = useTranslation('common');
25
25
 
@@ -63,3 +63,5 @@ export const ChatInputContent = memo<ChatContentProps>(
63
63
  );
64
64
  },
65
65
  );
66
+
67
+ export default ChatInputContent;