@lobehub/chat 0.83.10 → 0.84.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +10 -0
- package/.github/workflows/release.yml +3 -0
- package/.releaserc.js +14 -1
- package/CHANGELOG.md +5 -17
- package/Dockerfile +46 -0
- package/next.config.mjs +3 -0
- package/package.json +4 -2
- package/src/app/chat/(desktop)/features/{ChatHeader.tsx → ChatHeader/Desktop.tsx} +2 -2
- package/src/app/chat/(desktop)/features/ChatHeader/index.tsx +14 -0
- package/src/app/chat/(desktop)/features/{ChatInput.tsx → ChatInput/Desktop.tsx} +7 -5
- package/src/app/chat/(desktop)/features/ChatInput/index.tsx +22 -0
- package/src/app/chat/(desktop)/features/{SessionHeader.tsx → SessionHeader/Desktop.tsx} +1 -1
- package/src/app/chat/(desktop)/features/SessionHeader/index.tsx +14 -0
- package/src/app/chat/(desktop)/features/{SessionList.tsx → SessionList/Desktop.tsx} +4 -5
- package/src/app/chat/(desktop)/features/SessionList/index.tsx +20 -0
- package/src/app/chat/(desktop)/features/{SideBar.tsx → SideBar/Desktop.tsx} +4 -5
- package/src/app/chat/(desktop)/features/SideBar/index.tsx +20 -0
- package/src/app/chat/(desktop)/index.tsx +8 -14
- package/src/app/chat/(desktop)/{layout.desktop.tsx → layout/Desktop.tsx} +8 -7
- package/src/app/chat/(desktop)/layout/index.tsx +25 -0
- package/src/app/chat/(mobile)/features/ChatHeader.tsx +1 -54
- package/src/app/chat/(mobile)/features/ChatInput.tsx +8 -28
- package/src/app/chat/(mobile)/features/SessionList.tsx +8 -13
- package/src/app/chat/(mobile)/features/Topics.tsx +12 -0
- package/src/app/chat/(mobile)/index.tsx +5 -3
- package/src/app/chat/(mobile)/layout.tsx +15 -0
- package/src/app/chat/(mobile)/mobile/page.tsx +20 -2
- package/src/app/chat/components/ChatHeader/Mobile.tsx +54 -0
- package/src/app/chat/{features → components}/ChatHeader/ShareButton/Preview.tsx +9 -25
- package/src/app/chat/{features → components}/ChatHeader/ShareButton/style.ts +7 -7
- package/src/app/chat/components/ChatInput/Mobile.tsx +35 -0
- package/src/app/chat/{features/ChatInputContent → components/ChatInput}/index.tsx +1 -3
- package/src/app/chat/{(mobile)/features/TopicList.tsx → components/Inspector/Mobile.tsx} +4 -6
- package/src/app/chat/{features/TopicListContent → components/Inspector}/index.tsx +1 -3
- package/src/app/chat/{features/SessionListContent → components/SessionList}/Inbox/index.tsx +5 -7
- package/src/app/chat/components/SessionList/Mobile.tsx +16 -0
- package/src/app/chat/{features/SessionListContent → components/SessionList}/index.tsx +1 -3
- package/src/app/chat/layout.tsx +15 -0
- package/src/app/chat/page.tsx +1 -3
- package/src/app/chat/settings/(desktop)/layout.desktop.tsx +15 -10
- package/src/app/chat/settings/(mobile)/layout.mobile.tsx +8 -4
- package/src/app/chat/settings/layout.tsx +14 -0
- package/src/app/chat/settings/page.tsx +33 -9
- package/src/app/market/(desktop)/{features/AgentDetail.tsx → AgentDetail/Desktop.tsx} +3 -5
- package/src/app/market/(desktop)/AgentDetail/index.tsx +16 -0
- package/src/app/market/(desktop)/Header/index.tsx +13 -0
- package/src/app/market/(desktop)/{layout.desktop.tsx → layout/Desktop.tsx} +5 -5
- package/src/app/market/(desktop)/layout/index.tsx +17 -0
- package/src/app/market/(mobile)/AgentDetail.tsx +12 -0
- package/src/app/market/(mobile)/layout.mobile.tsx +5 -5
- package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/Header.tsx +0 -1
- package/src/app/market/{(mobile)/features/AgentDetail.tsx → components/AgentDetail/Mobile.tsx} +4 -6
- package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/index.tsx +1 -3
- package/src/app/market/features/TagList/index.tsx +1 -2
- package/src/app/market/layout.tsx +13 -0
- package/src/app/market/page.tsx +5 -8
- package/src/app/settings/agent/page.tsx +31 -2
- package/src/app/settings/common/page.tsx +14 -2
- package/src/app/settings/{(desktop)/features/Header.tsx → features/Header/Desktop.tsx} +2 -2
- package/src/app/settings/{(mobile)/features/Header/index.tsx → features/Header/Mobile.tsx} +0 -1
- package/src/app/settings/features/Header/index.tsx +14 -0
- package/src/app/settings/{(desktop)/layout.desktop.tsx → layout.desktop/Desktop.tsx} +9 -10
- package/src/app/settings/layout.desktop/index.tsx +32 -0
- package/src/app/settings/layout.mobile.tsx +16 -0
- package/src/app/settings/layout.tsx +15 -0
- package/src/app/settings/llm/page.tsx +14 -2
- package/src/app/settings/{(mobile)/features → mobile}/ExtraList.tsx +1 -1
- package/src/app/settings/{(mobile)/mobile → mobile}/index.tsx +7 -7
- package/src/app/settings/mobile/page.tsx +7 -0
- package/src/app/settings/page.tsx +1 -14
- package/src/app/welcome/{(desktop)/layout.desktop.tsx → DesktopLayout/Desktop.tsx} +4 -4
- package/src/app/welcome/DesktopLayout/index.tsx +15 -0
- package/src/app/welcome/MobileLayout.tsx +23 -0
- package/src/app/welcome/features/Banner/Hero.tsx +3 -2
- package/src/app/welcome/features/Banner/index.tsx +31 -34
- package/src/app/welcome/features/Banner/style.ts +1 -10
- package/src/app/welcome/layout.tsx +22 -0
- package/src/app/welcome/page.tsx +7 -9
- package/src/{layout/ResponsiveLayout.server.tsx → components/ResponsiveLayout.tsx} +3 -4
- package/src/features/MobileTabBar/index.tsx +1 -1
- package/src/features/SideBar/BottomActions.tsx +1 -1
- package/src/layout/{AppLayout.desktop.tsx → AppLayout.tsx} +2 -2
- package/src/layout/{AppLayout.mobile.tsx → AppMobileLayout.tsx} +2 -2
- package/src/layout/GlobalLayout/StoreHydration.tsx +1 -15
- package/src/store/session/slices/session/initialState.ts +2 -2
- package/src/app/chat/(desktop)/layout.responsive.tsx +0 -12
- package/src/app/chat/(mobile)/layout.mobile.tsx +0 -17
- package/src/app/chat/(mobile)/mobile/index.tsx +0 -19
- package/src/app/chat/(mobile)/mobile/layout.mobile.tsx +0 -11
- package/src/app/chat/settings/(desktop)/index.tsx +0 -14
- package/src/app/chat/settings/(desktop)/layout.responsive.tsx +0 -12
- package/src/app/chat/settings/(mobile)/index.tsx +0 -14
- package/src/app/chat/settings/features/EditPage.tsx +0 -38
- package/src/app/market/(desktop)/index.tsx +0 -12
- package/src/app/market/(desktop)/layout.responsive.tsx +0 -16
- package/src/app/market/(mobile)/index.tsx +0 -12
- package/src/app/settings/(desktop)/index.tsx +0 -17
- package/src/app/settings/(desktop)/layout.responsive.tsx +0 -14
- package/src/app/settings/(mobile)/features/Header/Home.tsx +0 -8
- package/src/app/settings/(mobile)/index.tsx +0 -3
- package/src/app/settings/(mobile)/layout.mobile.tsx +0 -19
- package/src/app/settings/(mobile)/mobile/layout.mobile.tsx +0 -14
- package/src/app/settings/agent/Agent.tsx +0 -30
- package/src/app/settings/agent/index.tsx +0 -23
- package/src/app/settings/agent/layout.tsx +0 -1
- package/src/app/settings/common/index.tsx +0 -23
- package/src/app/settings/common/layout.tsx +0 -1
- package/src/app/settings/layout.server.tsx +0 -12
- package/src/app/settings/llm/index.tsx +0 -23
- package/src/app/settings/llm/layout.tsx +0 -1
- package/src/app/welcome/(desktop)/features/Showcase.tsx +0 -23
- package/src/app/welcome/(desktop)/index.tsx +0 -19
- package/src/app/welcome/(desktop)/layout.responsive.tsx +0 -14
- package/src/app/welcome/(mobile)/features/Header.tsx +0 -6
- package/src/app/welcome/(mobile)/features/Showcase.tsx +0 -16
- package/src/app/welcome/(mobile)/index.tsx +0 -10
- package/src/app/welcome/(mobile)/layout.mobile.tsx +0 -20
- package/src/components/ResponsiveIndex.tsx +0 -17
- package/src/layout/ResponsiveLayout.client.tsx +0 -18
- /package/src/app/chat/{features → components}/ChatHeader/PluginTag/PluginStatus.tsx +0 -0
- /package/src/app/chat/{features → components}/ChatHeader/PluginTag/index.tsx +0 -0
- /package/src/app/chat/{features → components}/ChatHeader/ShareButton/Inner.tsx +0 -0
- /package/src/app/chat/{features → components}/ChatHeader/ShareButton/index.tsx +0 -0
- /package/src/app/chat/{features/ChatInputContent → components/ChatInput}/ActionBar/ActionLeft.tsx +0 -0
- /package/src/app/chat/{features/ChatInputContent → components/ChatInput}/ActionBar/ActionRight.tsx +0 -0
- /package/src/app/chat/{features/ChatInputContent → components/ChatInput}/ActionBar/Token.tsx +0 -0
- /package/src/app/chat/{features/ChatInputContent → components/ChatInput}/Footer/SaveTopic.tsx +0 -0
- /package/src/app/chat/{features/ChatInputContent → components/ChatInput}/Footer/index.tsx +0 -0
- /package/src/app/chat/{features/TopicListContent → components/Inspector}/SystemRole/Header.tsx +0 -0
- /package/src/app/chat/{features/TopicListContent → components/Inspector}/SystemRole/index.tsx +0 -0
- /package/src/app/chat/{features/TopicListContent → components/Inspector}/SystemRole/style.ts +0 -0
- /package/src/app/chat/{features/TopicListContent → components/Inspector}/Topic/DefaultContent.tsx +0 -0
- /package/src/app/chat/{features/TopicListContent → components/Inspector}/Topic/SkeletonList.tsx +0 -0
- /package/src/app/chat/{features/TopicListContent → components/Inspector}/Topic/TopicContent.tsx +0 -0
- /package/src/app/chat/{features/TopicListContent → components/Inspector}/Topic/TopicItem.tsx +0 -0
- /package/src/app/chat/{features/TopicListContent → components/Inspector}/Topic/index.tsx +0 -0
- /package/src/app/chat/{features/TopicListContent → components/Inspector}/TopicSearchBar/index.tsx +0 -0
- /package/src/app/chat/{features/SessionListContent → components/SessionList}/CollapseGroup/index.tsx +0 -0
- /package/src/app/chat/{features/SessionListContent → components/SessionList}/List/AddButton.tsx +0 -0
- /package/src/app/chat/{features/SessionListContent → components/SessionList}/List/Item/Actions.tsx +0 -0
- /package/src/app/chat/{features/SessionListContent → components/SessionList}/List/Item/index.tsx +0 -0
- /package/src/app/chat/{features/SessionListContent → components/SessionList}/List/SkeletonList.tsx +0 -0
- /package/src/app/chat/{features/SessionListContent → components/SessionList}/List/index.tsx +0 -0
- /package/src/app/chat/features/{PageTitle/index.tsx → PageTitle.tsx} +0 -0
- /package/src/app/market/(desktop)/{features/Header.tsx → Header/Desktop.tsx} +0 -0
- /package/src/app/market/(mobile)/{features/Header.tsx → Header.tsx} +0 -0
- /package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/Comment.tsx +0 -0
- /package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/Loading.tsx +0 -0
- /package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/TokenTag.tsx +0 -0
- /package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/index.tsx +0 -0
- /package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/style.ts +0 -0
- /package/src/app/welcome/{(desktop)/features/Footer.tsx → features/Footer/index.tsx} +0 -0
package/.dockerignore
ADDED
|
@@ -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
|
-
|
|
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,22 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## [Version 0.84.0-beta.1](https://github.com/lobehub/lobe-chat/compare/v0.83.9...v0.84.0-beta.1)
|
|
6
6
|
|
|
7
7
|
<sup>Released on **2023-10-09**</sup>
|
|
8
8
|
|
|
9
|
-
####
|
|
10
|
-
|
|
11
|
-
- **layout**: Refactor layout, Refactor settings layout, Refactor ssc layout.
|
|
12
|
-
- **share**: Use modern-screenshot.
|
|
13
|
-
|
|
14
|
-
#### 🐛 Bug Fixes
|
|
9
|
+
#### ✨ Features
|
|
15
10
|
|
|
16
|
-
- **misc**:
|
|
11
|
+
- **misc**: Dockerize lobe-chat.
|
|
17
12
|
|
|
18
13
|
<br/>
|
|
19
14
|
|
|
20
15
|
<details>
|
|
21
16
|
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
22
17
|
|
|
23
|
-
####
|
|
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
|
|
18
|
+
#### What's improved
|
|
31
19
|
|
|
32
|
-
- **misc**:
|
|
20
|
+
- **misc**: Dockerize lobe-chat ([1b750f8](https://github.com/lobehub/lobe-chat/commit/1b750f8))
|
|
33
21
|
|
|
34
22
|
</details>
|
|
35
23
|
|
package/Dockerfile
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
# If you want to build docker in China
|
|
13
|
+
RUN npm config set registry https://registry.npmmirror.com/
|
|
14
|
+
RUN pnpm install
|
|
15
|
+
|
|
16
|
+
COPY . .
|
|
17
|
+
RUN pnpm run build:docker # run build standalone for docker version
|
|
18
|
+
|
|
19
|
+
## Production image, copy all the files and run next
|
|
20
|
+
FROM base AS runner
|
|
21
|
+
WORKDIR /app
|
|
22
|
+
|
|
23
|
+
ENV NODE_ENV production
|
|
24
|
+
|
|
25
|
+
RUN addgroup --system --gid 1001 nodejs
|
|
26
|
+
RUN adduser --system --uid 1001 nextjs
|
|
27
|
+
|
|
28
|
+
COPY --from=builder /app/public ./public
|
|
29
|
+
|
|
30
|
+
# Set the correct permission for prerender cache
|
|
31
|
+
RUN mkdir .next
|
|
32
|
+
RUN chown nextjs:nodejs .next
|
|
33
|
+
|
|
34
|
+
# Automatically leverage output traces to reduce image size
|
|
35
|
+
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
|
36
|
+
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
37
|
+
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
38
|
+
|
|
39
|
+
USER nextjs
|
|
40
|
+
|
|
41
|
+
EXPOSE 3000
|
|
42
|
+
|
|
43
|
+
# set hostname to localhost
|
|
44
|
+
ENV HOSTNAME "0.0.0.0"
|
|
45
|
+
|
|
46
|
+
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.
|
|
3
|
+
"version": "0.84.0-beta.1",
|
|
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 '
|
|
16
|
-
import ShareButton from '
|
|
15
|
+
import PluginTag from '../../../components/ChatHeader/PluginTag';
|
|
16
|
+
import ShareButton from '../../../components/ChatHeader/ShareButton';
|
|
17
17
|
|
|
18
18
|
const Header = memo(() => {
|
|
19
19
|
const init = useSessionChatInit();
|
|
@@ -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 {
|
|
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
|
-
|
|
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
|
-
|
|
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 '
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
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 '
|
|
8
|
+
import ResponsiveSessionList from '../features/SessionList';
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
const Desktop = memo<PropsWithChildren>(({ children }) => {
|
|
13
11
|
useSwitchSideBarOnInit(SidebarTabKey.Chat);
|
|
12
|
+
|
|
14
13
|
return (
|
|
15
|
-
<
|
|
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
|
-
</
|
|
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
|
-
|
|
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
|
|
5
|
-
import
|
|
3
|
+
import { ChatInputContent } from '../../components/ChatInput';
|
|
4
|
+
import Mobile from '../../components/ChatInput/Mobile';
|
|
6
5
|
|
|
7
|
-
|
|
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
|
-
<
|
|
27
|
-
|
|
28
|
-
<ChatInputContent mobile />
|
|
29
|
-
</div>
|
|
30
|
-
</>
|
|
8
|
+
<Mobile>
|
|
9
|
+
<ChatInputContent mobile />
|
|
10
|
+
</Mobile>
|
|
31
11
|
);
|
|
32
|
-
}
|
|
12
|
+
};
|
|
33
13
|
|
|
34
|
-
export default
|
|
14
|
+
export default memo(ChatInput);
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { memo } from 'react';
|
|
2
2
|
|
|
3
|
-
import SessionListContent from '../../
|
|
4
|
-
import
|
|
3
|
+
import { SessionListContent } from '../../components/SessionList';
|
|
4
|
+
import Wrapper from '../../components/SessionList/Mobile';
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
</div>
|
|
12
|
-
<SessionListContent />
|
|
13
|
-
</>
|
|
14
|
-
);
|
|
15
|
-
});
|
|
6
|
+
const SessionList = memo(() => (
|
|
7
|
+
<Wrapper>
|
|
8
|
+
<SessionListContent />
|
|
9
|
+
</Wrapper>
|
|
10
|
+
));
|
|
16
11
|
|
|
17
|
-
export default
|
|
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;
|
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
|
|
5
|
+
import AppMobileLayout from '@/layout/AppMobileLayout';
|
|
6
|
+
|
|
5
7
|
import PageTitle from '../features/PageTitle';
|
|
8
|
+
import SessionHeader from './features/SessionHeader';
|
|
6
9
|
import SessionList from './features/SessionList';
|
|
7
|
-
import Layout from './layout.mobile';
|
|
8
10
|
|
|
9
11
|
const ChatMobilePage = memo(() => {
|
|
10
12
|
return (
|
|
11
|
-
<
|
|
13
|
+
<AppMobileLayout navBar={<SessionHeader />} showTabBar>
|
|
12
14
|
<PageTitle />
|
|
13
15
|
<SessionList />
|
|
14
|
-
</
|
|
16
|
+
</AppMobileLayout>
|
|
15
17
|
);
|
|
16
18
|
});
|
|
17
19
|
|