@lobehub/chat 0.83.10 → 0.84.0-beta.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.
Files changed (152) hide show
  1. package/.dockerignore +10 -0
  2. package/.github/workflows/release.yml +3 -0
  3. package/.releaserc.js +14 -1
  4. package/CHANGELOG.md +27 -14
  5. package/Dockerfile +47 -0
  6. package/next.config.mjs +3 -0
  7. package/package.json +4 -2
  8. package/src/app/chat/(desktop)/features/{ChatHeader.tsx → ChatHeader/Desktop.tsx} +2 -2
  9. package/src/app/chat/(desktop)/features/ChatHeader/index.tsx +14 -0
  10. package/src/app/chat/(desktop)/features/{ChatInput.tsx → ChatInput/Desktop.tsx} +7 -5
  11. package/src/app/chat/(desktop)/features/ChatInput/index.tsx +22 -0
  12. package/src/app/chat/(desktop)/features/{SessionHeader.tsx → SessionHeader/Desktop.tsx} +1 -1
  13. package/src/app/chat/(desktop)/features/SessionHeader/index.tsx +14 -0
  14. package/src/app/chat/(desktop)/features/{SessionList.tsx → SessionList/Desktop.tsx} +4 -5
  15. package/src/app/chat/(desktop)/features/SessionList/index.tsx +20 -0
  16. package/src/app/chat/(desktop)/features/{SideBar.tsx → SideBar/Desktop.tsx} +4 -5
  17. package/src/app/chat/(desktop)/features/SideBar/index.tsx +20 -0
  18. package/src/app/chat/(desktop)/index.tsx +8 -14
  19. package/src/app/chat/(desktop)/{layout.desktop.tsx → layout/Desktop.tsx} +8 -7
  20. package/src/app/chat/(desktop)/layout/index.tsx +25 -0
  21. package/src/app/chat/(mobile)/features/ChatHeader.tsx +1 -54
  22. package/src/app/chat/(mobile)/features/ChatInput.tsx +8 -28
  23. package/src/app/chat/(mobile)/features/SessionList.tsx +8 -13
  24. package/src/app/chat/(mobile)/features/Topics.tsx +12 -0
  25. package/src/app/chat/(mobile)/index.tsx +5 -3
  26. package/src/app/chat/(mobile)/layout.tsx +15 -0
  27. package/src/app/chat/(mobile)/mobile/page.tsx +20 -2
  28. package/src/app/chat/components/ChatHeader/Mobile.tsx +54 -0
  29. package/src/app/chat/{features → components}/ChatHeader/ShareButton/Preview.tsx +9 -25
  30. package/src/app/chat/{features → components}/ChatHeader/ShareButton/style.ts +7 -7
  31. package/src/app/chat/components/ChatInput/Mobile.tsx +35 -0
  32. package/src/app/chat/{features/ChatInputContent → components/ChatInput}/index.tsx +1 -3
  33. package/src/app/chat/{(mobile)/features/TopicList.tsx → components/Inspector/Mobile.tsx} +4 -6
  34. package/src/app/chat/{features/TopicListContent → components/Inspector}/index.tsx +1 -3
  35. package/src/app/chat/{features/SessionListContent → components/SessionList}/Inbox/index.tsx +5 -7
  36. package/src/app/chat/components/SessionList/Mobile.tsx +16 -0
  37. package/src/app/chat/{features/SessionListContent → components/SessionList}/index.tsx +1 -3
  38. package/src/app/chat/layout.tsx +15 -0
  39. package/src/app/chat/page.tsx +1 -3
  40. package/src/app/chat/settings/(desktop)/layout.desktop.tsx +15 -10
  41. package/src/app/chat/settings/(mobile)/layout.mobile.tsx +8 -4
  42. package/src/app/chat/settings/layout.tsx +14 -0
  43. package/src/app/chat/settings/page.tsx +33 -9
  44. package/src/app/market/(desktop)/{features/AgentDetail.tsx → AgentDetail/Desktop.tsx} +3 -5
  45. package/src/app/market/(desktop)/AgentDetail/index.tsx +16 -0
  46. package/src/app/market/(desktop)/Header/index.tsx +13 -0
  47. package/src/app/market/(desktop)/{layout.desktop.tsx → layout/Desktop.tsx} +5 -5
  48. package/src/app/market/(desktop)/layout/index.tsx +17 -0
  49. package/src/app/market/(mobile)/AgentDetail.tsx +12 -0
  50. package/src/app/market/(mobile)/layout.mobile.tsx +5 -5
  51. package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/Header.tsx +0 -1
  52. package/src/app/market/{(mobile)/features/AgentDetail.tsx → components/AgentDetail/Mobile.tsx} +4 -6
  53. package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/index.tsx +1 -3
  54. package/src/app/market/features/TagList/index.tsx +1 -2
  55. package/src/app/market/layout.tsx +13 -0
  56. package/src/app/market/page.tsx +5 -8
  57. package/src/app/settings/agent/page.tsx +31 -2
  58. package/src/app/settings/common/page.tsx +14 -2
  59. package/src/app/settings/{(desktop)/features/Header.tsx → features/Header/Desktop.tsx} +2 -2
  60. package/src/app/settings/{(mobile)/features/Header/index.tsx → features/Header/Mobile.tsx} +0 -1
  61. package/src/app/settings/features/Header/index.tsx +14 -0
  62. package/src/app/settings/{(desktop)/layout.desktop.tsx → layout.desktop/Desktop.tsx} +9 -10
  63. package/src/app/settings/layout.desktop/index.tsx +32 -0
  64. package/src/app/settings/layout.mobile.tsx +16 -0
  65. package/src/app/settings/layout.tsx +15 -0
  66. package/src/app/settings/llm/page.tsx +14 -2
  67. package/src/app/settings/{(mobile)/features → mobile}/ExtraList.tsx +1 -1
  68. package/src/app/settings/{(mobile)/mobile → mobile}/index.tsx +7 -7
  69. package/src/app/settings/mobile/page.tsx +7 -0
  70. package/src/app/settings/page.tsx +1 -14
  71. package/src/app/welcome/{(desktop)/layout.desktop.tsx → DesktopLayout/Desktop.tsx} +4 -4
  72. package/src/app/welcome/DesktopLayout/index.tsx +15 -0
  73. package/src/app/welcome/MobileLayout.tsx +23 -0
  74. package/src/app/welcome/features/Banner/Hero.tsx +3 -2
  75. package/src/app/welcome/features/Banner/index.tsx +31 -34
  76. package/src/app/welcome/features/Banner/style.ts +1 -10
  77. package/src/app/welcome/layout.tsx +22 -0
  78. package/src/app/welcome/page.tsx +7 -9
  79. package/src/{layout/ResponsiveLayout.server.tsx → components/ResponsiveLayout.tsx} +3 -4
  80. package/src/features/MobileTabBar/index.tsx +1 -1
  81. package/src/features/SideBar/BottomActions.tsx +1 -1
  82. package/src/layout/{AppLayout.desktop.tsx → AppLayout.tsx} +2 -2
  83. package/src/layout/{AppLayout.mobile.tsx → AppMobileLayout.tsx} +2 -2
  84. package/src/layout/GlobalLayout/StoreHydration.tsx +1 -15
  85. package/src/store/session/slices/session/initialState.ts +2 -2
  86. package/src/app/chat/(desktop)/layout.responsive.tsx +0 -12
  87. package/src/app/chat/(mobile)/layout.mobile.tsx +0 -17
  88. package/src/app/chat/(mobile)/mobile/index.tsx +0 -19
  89. package/src/app/chat/(mobile)/mobile/layout.mobile.tsx +0 -11
  90. package/src/app/chat/settings/(desktop)/index.tsx +0 -14
  91. package/src/app/chat/settings/(desktop)/layout.responsive.tsx +0 -12
  92. package/src/app/chat/settings/(mobile)/index.tsx +0 -14
  93. package/src/app/chat/settings/features/EditPage.tsx +0 -38
  94. package/src/app/market/(desktop)/index.tsx +0 -12
  95. package/src/app/market/(desktop)/layout.responsive.tsx +0 -16
  96. package/src/app/market/(mobile)/index.tsx +0 -12
  97. package/src/app/settings/(desktop)/index.tsx +0 -17
  98. package/src/app/settings/(desktop)/layout.responsive.tsx +0 -14
  99. package/src/app/settings/(mobile)/features/Header/Home.tsx +0 -8
  100. package/src/app/settings/(mobile)/index.tsx +0 -3
  101. package/src/app/settings/(mobile)/layout.mobile.tsx +0 -19
  102. package/src/app/settings/(mobile)/mobile/layout.mobile.tsx +0 -14
  103. package/src/app/settings/agent/Agent.tsx +0 -30
  104. package/src/app/settings/agent/index.tsx +0 -23
  105. package/src/app/settings/agent/layout.tsx +0 -1
  106. package/src/app/settings/common/index.tsx +0 -23
  107. package/src/app/settings/common/layout.tsx +0 -1
  108. package/src/app/settings/layout.server.tsx +0 -12
  109. package/src/app/settings/llm/index.tsx +0 -23
  110. package/src/app/settings/llm/layout.tsx +0 -1
  111. package/src/app/welcome/(desktop)/features/Showcase.tsx +0 -23
  112. package/src/app/welcome/(desktop)/index.tsx +0 -19
  113. package/src/app/welcome/(desktop)/layout.responsive.tsx +0 -14
  114. package/src/app/welcome/(mobile)/features/Header.tsx +0 -6
  115. package/src/app/welcome/(mobile)/features/Showcase.tsx +0 -16
  116. package/src/app/welcome/(mobile)/index.tsx +0 -10
  117. package/src/app/welcome/(mobile)/layout.mobile.tsx +0 -20
  118. package/src/components/ResponsiveIndex.tsx +0 -17
  119. package/src/layout/ResponsiveLayout.client.tsx +0 -18
  120. /package/src/app/chat/{features → components}/ChatHeader/PluginTag/PluginStatus.tsx +0 -0
  121. /package/src/app/chat/{features → components}/ChatHeader/PluginTag/index.tsx +0 -0
  122. /package/src/app/chat/{features → components}/ChatHeader/ShareButton/Inner.tsx +0 -0
  123. /package/src/app/chat/{features → components}/ChatHeader/ShareButton/index.tsx +0 -0
  124. /package/src/app/chat/{features/ChatInputContent → components/ChatInput}/ActionBar/ActionLeft.tsx +0 -0
  125. /package/src/app/chat/{features/ChatInputContent → components/ChatInput}/ActionBar/ActionRight.tsx +0 -0
  126. /package/src/app/chat/{features/ChatInputContent → components/ChatInput}/ActionBar/Token.tsx +0 -0
  127. /package/src/app/chat/{features/ChatInputContent → components/ChatInput}/Footer/SaveTopic.tsx +0 -0
  128. /package/src/app/chat/{features/ChatInputContent → components/ChatInput}/Footer/index.tsx +0 -0
  129. /package/src/app/chat/{features/TopicListContent → components/Inspector}/SystemRole/Header.tsx +0 -0
  130. /package/src/app/chat/{features/TopicListContent → components/Inspector}/SystemRole/index.tsx +0 -0
  131. /package/src/app/chat/{features/TopicListContent → components/Inspector}/SystemRole/style.ts +0 -0
  132. /package/src/app/chat/{features/TopicListContent → components/Inspector}/Topic/DefaultContent.tsx +0 -0
  133. /package/src/app/chat/{features/TopicListContent → components/Inspector}/Topic/SkeletonList.tsx +0 -0
  134. /package/src/app/chat/{features/TopicListContent → components/Inspector}/Topic/TopicContent.tsx +0 -0
  135. /package/src/app/chat/{features/TopicListContent → components/Inspector}/Topic/TopicItem.tsx +0 -0
  136. /package/src/app/chat/{features/TopicListContent → components/Inspector}/Topic/index.tsx +0 -0
  137. /package/src/app/chat/{features/TopicListContent → components/Inspector}/TopicSearchBar/index.tsx +0 -0
  138. /package/src/app/chat/{features/SessionListContent → components/SessionList}/CollapseGroup/index.tsx +0 -0
  139. /package/src/app/chat/{features/SessionListContent → components/SessionList}/List/AddButton.tsx +0 -0
  140. /package/src/app/chat/{features/SessionListContent → components/SessionList}/List/Item/Actions.tsx +0 -0
  141. /package/src/app/chat/{features/SessionListContent → components/SessionList}/List/Item/index.tsx +0 -0
  142. /package/src/app/chat/{features/SessionListContent → components/SessionList}/List/SkeletonList.tsx +0 -0
  143. /package/src/app/chat/{features/SessionListContent → components/SessionList}/List/index.tsx +0 -0
  144. /package/src/app/chat/features/{PageTitle/index.tsx → PageTitle.tsx} +0 -0
  145. /package/src/app/market/(desktop)/{features/Header.tsx → Header/Desktop.tsx} +0 -0
  146. /package/src/app/market/(mobile)/{features/Header.tsx → Header.tsx} +0 -0
  147. /package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/Comment.tsx +0 -0
  148. /package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/Loading.tsx +0 -0
  149. /package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/TokenTag.tsx +0 -0
  150. /package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/index.tsx +0 -0
  151. /package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/style.ts +0 -0
  152. /package/src/app/welcome/{(desktop)/features/Footer.tsx → features/Footer/index.tsx} +0 -0
package/.dockerignore ADDED
@@ -0,0 +1,10 @@
1
+ Dockerfile
2
+ .dockerignore
3
+ node_modules
4
+ npm-debug.log
5
+ .next
6
+ .git
7
+ scripts
8
+ docs
9
+ .github
10
+ *.md
@@ -3,6 +3,7 @@ on:
3
3
  push:
4
4
  branches:
5
5
  - main
6
+ - beta
6
7
 
7
8
  jobs:
8
9
  release:
@@ -28,3 +29,5 @@ jobs:
28
29
  env:
29
30
  GH_TOKEN: ${{ secrets.GH_TOKEN }}
30
31
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
32
+ DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
33
+ DOCKER_REGISTRY_USER: ${{ secrets.DOCKER_REGISTRY_USER }}
package/.releaserc.js CHANGED
@@ -1 +1,14 @@
1
- module.exports = require('@lobehub/lint').semanticRelease;
1
+ const release = require('@lobehub/lint').semanticRelease;
2
+
3
+ module.exports = {
4
+ ...release,
5
+ plugins: [
6
+ ...release.plugins,
7
+ [
8
+ '@codedependant/semantic-release-docker',
9
+ {
10
+ dockerImage: 'lobe-chat',
11
+ },
12
+ ],
13
+ ],
14
+ };
package/CHANGELOG.md CHANGED
@@ -2,34 +2,47 @@
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)
5
+ ## [Version 0.84.0-beta.2](https://github.com/lobehub/lobe-chat/compare/v0.84.0-beta.1...v0.84.0-beta.2)
6
6
 
7
7
  <sup>Released on **2023-10-09**</sup>
8
8
 
9
- #### ♻ Code Refactoring
10
-
11
- - **layout**: Refactor layout, Refactor settings layout, Refactor ssc layout.
12
- - **share**: Use modern-screenshot.
13
-
14
9
  #### 🐛 Bug Fixes
15
10
 
16
- - **misc**: Fix rsc layout.
11
+ - **misc**: Use bun to improve speed.
17
12
 
18
13
  <br/>
19
14
 
20
15
  <details>
21
16
  <summary><kbd>Improvements and Fixes</kbd></summary>
22
17
 
23
- #### Code refactoring
18
+ #### What's fixed
24
19
 
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))
20
+ - **misc**: Use bun to improve speed ([8db2a3c](https://github.com/lobehub/lobe-chat/commit/8db2a3c))
29
21
 
30
- #### What's fixed
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.84.0-beta.1](https://github.com/lobehub/lobe-chat/compare/v0.83.9...v0.84.0-beta.1)
31
+
32
+ <sup>Released on **2023-10-09**</sup>
33
+
34
+ #### ✨ Features
35
+
36
+ - **misc**: Dockerize lobe-chat.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's improved
31
44
 
32
- - **misc**: Fix rsc layout ([d73f13f](https://github.com/lobehub/lobe-chat/commit/d73f13f))
45
+ - **misc**: Dockerize lobe-chat ([1b750f8](https://github.com/lobehub/lobe-chat/commit/1b750f8))
33
46
 
34
47
  </details>
35
48
 
package/Dockerfile ADDED
@@ -0,0 +1,47 @@
1
+ FROM node:20-slim AS base
2
+ ENV PNPM_HOME="/pnpm"
3
+ ENV PATH="$PNPM_HOME:$PATH"
4
+ RUN corepack enable
5
+
6
+ ## Install dependencies only when needed
7
+ FROM base AS builder
8
+ WORKDIR /app
9
+
10
+ COPY package.json ./
11
+
12
+ RUN pnpm i -g bun
13
+ # If you want to build docker in China
14
+ #RUN npm config set registry https://registry.npmmirror.com/
15
+ RUN bun i
16
+
17
+ COPY . .
18
+ RUN pnpm run build:docker # run build standalone for docker version
19
+
20
+ ## Production image, copy all the files and run next
21
+ FROM base AS runner
22
+ WORKDIR /app
23
+
24
+ ENV NODE_ENV production
25
+
26
+ RUN addgroup --system --gid 1001 nodejs
27
+ RUN adduser --system --uid 1001 nextjs
28
+
29
+ COPY --from=builder /app/public ./public
30
+
31
+ # Set the correct permission for prerender cache
32
+ RUN mkdir .next
33
+ RUN chown nextjs:nodejs .next
34
+
35
+ # Automatically leverage output traces to reduce image size
36
+ # https://nextjs.org/docs/advanced-features/output-file-tracing
37
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
38
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
39
+
40
+ USER nextjs
41
+
42
+ EXPOSE 3000
43
+
44
+ # set hostname to localhost
45
+ ENV HOSTNAME "0.0.0.0"
46
+
47
+ CMD ["node", "server.js"]
package/next.config.mjs CHANGED
@@ -2,6 +2,7 @@ import analyzer from '@next/bundle-analyzer';
2
2
  import nextPWA from 'next-pwa';
3
3
 
4
4
  const isProd = process.env.NODE_ENV === 'production';
5
+ const buildWithDocker = process.env.DOCKER === 'true';
5
6
 
6
7
  const withBundleAnalyzer = analyzer({
7
8
  enabled: process.env.ANALYZE === 'true',
@@ -32,6 +33,8 @@ const nextConfig = {
32
33
  AGENTS_INDEX_URL: process.env.AGENTS_INDEX_URL,
33
34
  PLUGINS_INDEX_URL: process.env.PLUGINS_INDEX_URL,
34
35
  },
36
+
37
+ output: buildWithDocker ? 'standalone' : undefined,
35
38
  };
36
39
 
37
40
  export default isProd ? withBundleAnalyzer(withPWA(nextConfig)) : nextConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.83.10",
3
+ "version": "0.84.0-beta.2",
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",
@@ -25,6 +25,7 @@
25
25
  "scripts": {
26
26
  "build": "next build",
27
27
  "build:analyze": "ANALYZE=true next build",
28
+ "build:docker": "DOCKER=true next build",
28
29
  "dev": "next dev -p 3010",
29
30
  "i18n": "npm run i18n:workflow && lobe-i18n",
30
31
  "i18n:workflow": "ts-node --project ./tsconfig.json scripts/i18nWorkflow/index.ts",
@@ -83,6 +84,7 @@
83
84
  "emoji-mart": "^5",
84
85
  "fast-deep-equal": "^3",
85
86
  "gpt-tokenizer": "^2",
87
+ "html-to-image": "^1",
86
88
  "i18next": "^23",
87
89
  "i18next-browser-languagedetector": "^7",
88
90
  "i18next-resources-for-ts": "^1",
@@ -92,7 +94,6 @@
92
94
  "lodash-es": "^4",
93
95
  "lucide-react": "latest",
94
96
  "mixpanel-browser": "^2",
95
- "modern-screenshot": "^4",
96
97
  "nanoid": "^5",
97
98
  "next": "^13.5.3",
98
99
  "openai": "^4.10.0",
@@ -119,6 +120,7 @@
119
120
  "zustand-utils": "^1"
120
121
  },
121
122
  "devDependencies": {
123
+ "@codedependant/semantic-release-docker": "^4",
122
124
  "@commitlint/cli": "^17",
123
125
  "@lobehub/i18n-cli": "latest",
124
126
  "@lobehub/lint": "latest",
@@ -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 '../../features/ChatHeader/PluginTag';
16
- import ShareButton from '../../features/ChatHeader/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();
@@ -0,0 +1,14 @@
1
+ import { useResponsive } from 'antd-style';
2
+ import { memo } from 'react';
3
+
4
+ import Mobile from '../../../components/ChatHeader/Mobile';
5
+ import Desktop from './Desktop';
6
+
7
+ const Header = memo(() => {
8
+ const { mobile } = useResponsive();
9
+ const Render = mobile ? Mobile : Desktop;
10
+
11
+ return <Render />;
12
+ });
13
+
14
+ export default Header;
@@ -1,13 +1,15 @@
1
1
  import { DraggablePanel } from '@lobehub/ui';
2
- import { memo, useState } from 'react';
2
+ import { ReactNode, memo } 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
- import ChatInputContent from '../../features/ChatInputContent';
7
+ interface ChatInputDesktopLayoutProps {
8
+ children: ReactNode;
9
+ expand?: boolean;
10
+ }
8
11
 
9
- const ChatInputDesktopLayout = memo(() => {
10
- const [expand, setExpand] = useState<boolean>(false);
12
+ const ChatInputDesktopLayout = memo<ChatInputDesktopLayoutProps>(({ children, expand }) => {
11
13
  const [inputHeight, updatePreference] = useGlobalStore((s) => [
12
14
  s.preference.inputHeight,
13
15
  s.updatePreference,
@@ -30,7 +32,7 @@ const ChatInputDesktopLayout = memo(() => {
30
32
  size={{ height: inputHeight, width: '100%' }}
31
33
  style={{ zIndex: 10 }}
32
34
  >
33
- <ChatInputContent expand={expand} onExpandChange={setExpand} />
35
+ {children}
34
36
  </DraggablePanel>
35
37
  );
36
38
  });
@@ -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 '../../features/SessionSearchBar';
10
+ import SessionSearchBar from '../../../features/SessionSearchBar';
11
11
 
12
12
  export const useStyles = createStyles(({ css, token }) => ({
13
13
  logo: css`
@@ -0,0 +1,14 @@
1
+ import { useResponsive } from 'antd-style';
2
+ import { memo } from 'react';
3
+
4
+ import Mobile from '../../../(mobile)/features/SessionHeader';
5
+ import Desktop from './Desktop';
6
+
7
+ const Header = memo(() => {
8
+ const { mobile } = useResponsive();
9
+ const Render = mobile ? Mobile : Desktop;
10
+
11
+ return <Render />;
12
+ });
13
+
14
+ export default Header;
@@ -1,22 +1,21 @@
1
1
  import { DraggablePanelBody } from '@lobehub/ui';
2
2
  import { createStyles } from 'antd-style';
3
- import { memo } from 'react';
3
+ import { ReactNode, memo } from 'react';
4
4
 
5
5
  import FolderPanel from '@/features/FolderPanel';
6
6
 
7
- import SessionListContent from '../../features/SessionListContent';
8
- import Header from './SessionHeader';
7
+ import Header from '../SessionHeader';
9
8
 
10
9
  const useStyles = createStyles(({ stylish }) => stylish.noScrollbar);
11
10
 
12
- const Sessions = memo(() => {
11
+ const Sessions = memo<{ children: ReactNode }>(({ children }) => {
13
12
  const { styles } = useStyles();
14
13
 
15
14
  return (
16
15
  <FolderPanel>
17
16
  <Header />
18
17
  <DraggablePanelBody className={styles} style={{ padding: 0 }}>
19
- <SessionListContent />
18
+ {children}
20
19
  </DraggablePanelBody>
21
20
  </FolderPanel>
22
21
  );
@@ -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;
@@ -1,6 +1,6 @@
1
1
  import { DraggablePanel, DraggablePanelContainer } from '@lobehub/ui';
2
2
  import { createStyles } from 'antd-style';
3
- import { memo } from 'react';
3
+ import { ReactNode, memo } from 'react';
4
4
 
5
5
  import SafeSpacing from '@/components/SafeSpacing';
6
6
  import { CHAT_SIDEBAR_WIDTH } from '@/const/layoutTokens';
@@ -8,8 +8,7 @@ import { useGlobalStore } from '@/store/global';
8
8
  import { useSessionStore } from '@/store/session';
9
9
  import { sessionSelectors } from '@/store/session/selectors';
10
10
 
11
- import TopicListContent from '../../features/TopicListContent';
12
- import SystemRole from '../../features/TopicListContent/SystemRole';
11
+ import SystemRole from '../../../components/Inspector/SystemRole';
13
12
 
14
13
  const useStyles = createStyles(({ css, token }) => ({
15
14
  content: css`
@@ -24,7 +23,7 @@ const useStyles = createStyles(({ css, token }) => ({
24
23
  `,
25
24
  }));
26
25
 
27
- const Desktop = memo(() => {
26
+ const Desktop = memo<{ children: ReactNode }>(({ children }) => {
28
27
  const { styles } = useStyles();
29
28
  const [showAgentSettings, toggleConfig] = useGlobalStore((s) => [
30
29
  s.preference.showChatSideBar,
@@ -50,7 +49,7 @@ const Desktop = memo(() => {
50
49
  >
51
50
  <SafeSpacing />
52
51
  {!isInbox && <SystemRole />}
53
- <TopicListContent />
52
+ {children}
54
53
  </DraggablePanelContainer>
55
54
  </DraggablePanel>
56
55
  );
@@ -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;
@@ -3,26 +3,20 @@
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)';
9
6
  import Conversation from '../features/Conversation';
10
7
  import PageTitle from '../features/PageTitle';
11
8
  import ChatHeader from './features/ChatHeader';
12
9
  import ChatInput from './features/ChatInput';
13
10
  import SideBar from './features/SideBar';
14
- import Layout from './layout.responsive';
15
11
 
16
12
  const DesktopPage = memo(() => (
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>
13
+ <>
14
+ <PageTitle />
15
+ <ChatHeader />
16
+ <Flexbox flex={1} height={'calc(100vh - 64px)'} horizontal>
17
+ <Conversation chatInput={<ChatInput />} />
18
+ <SideBar />
19
+ </Flexbox>
20
+ </>
27
21
  ));
28
22
  export default DesktopPage;
@@ -1,18 +1,17 @@
1
- 'use client';
2
-
3
1
  import { PropsWithChildren, memo } from 'react';
4
2
  import { Flexbox } from 'react-layout-kit';
5
3
 
6
- import AppLayoutDesktop from '@/layout/AppLayout.desktop';
4
+ import AppLayout from '@/layout/AppLayout';
7
5
  import { useSwitchSideBarOnInit } from '@/store/global';
8
6
  import { SidebarTabKey } from '@/store/global/initialState';
9
7
 
10
- import ResponsiveSessionList from './features/SessionList';
8
+ import ResponsiveSessionList from '../features/SessionList';
11
9
 
12
- export default memo(({ children }: PropsWithChildren) => {
10
+ const Desktop = memo<PropsWithChildren>(({ children }) => {
13
11
  useSwitchSideBarOnInit(SidebarTabKey.Chat);
12
+
14
13
  return (
15
- <AppLayoutDesktop>
14
+ <AppLayout>
16
15
  <ResponsiveSessionList />
17
16
  <Flexbox
18
17
  flex={1}
@@ -22,6 +21,8 @@ export default memo(({ children }: PropsWithChildren) => {
22
21
  >
23
22
  {children}
24
23
  </Flexbox>
25
- </AppLayoutDesktop>
24
+ </AppLayout>
26
25
  );
27
26
  });
27
+
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;
@@ -1,54 +1 @@
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
+ export { default } from '../../components/ChatHeader/Mobile';
@@ -1,34 +1,14 @@
1
- import { createStyles } from 'antd-style';
2
1
  import { memo } from 'react';
3
2
 
4
- import SafeSpacing from '@/components/SafeSpacing';
5
- import { CHAT_TEXTAREA_HEIGHT_MOBILE } from '@/const/layoutTokens';
3
+ import { ChatInputContent } from '../../components/ChatInput';
4
+ import Mobile from '../../components/ChatInput/Mobile';
6
5
 
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();
6
+ const ChatInput = () => {
24
7
  return (
25
- <>
26
- <SafeSpacing height={CHAT_TEXTAREA_HEIGHT_MOBILE} mobile position={'bottom'} />
27
- <div className={styles}>
28
- <ChatInputContent mobile />
29
- </div>
30
- </>
8
+ <Mobile>
9
+ <ChatInputContent mobile />
10
+ </Mobile>
31
11
  );
32
- });
12
+ };
33
13
 
34
- export default ChatInputMobileLayout;
14
+ export default memo(ChatInput);
@@ -1,17 +1,12 @@
1
1
  import { memo } from 'react';
2
2
 
3
- import SessionListContent from '../../features/SessionListContent';
4
- import SessionSearchBar from '../../features/SessionSearchBar';
3
+ import { SessionListContent } from '../../components/SessionList';
4
+ import Wrapper from '../../components/SessionList/Mobile';
5
5
 
6
- const Sessions = memo(() => {
7
- return (
8
- <>
9
- <div style={{ padding: '8px 16px' }}>
10
- <SessionSearchBar />
11
- </div>
12
- <SessionListContent />
13
- </>
14
- );
15
- });
6
+ const SessionList = memo(() => (
7
+ <Wrapper>
8
+ <SessionListContent />
9
+ </Wrapper>
10
+ ));
16
11
 
17
- export default Sessions;
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;