@lobehub/chat 0.155.3 → 0.155.5

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 (136) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +2 -2
  3. package/README.zh-CN.md +8 -8
  4. package/package.json +1 -1
  5. package/src/app/(main)/(mobile)/me/features/Header.tsx +2 -9
  6. package/src/app/(main)/(mobile)/me/loading.tsx +1 -12
  7. package/src/app/(main)/(mobile)/me/page.tsx +2 -5
  8. package/src/app/(main)/@nav/_layout/Mobile.tsx +1 -1
  9. package/src/app/(main)/_layout/Mobile.tsx +5 -1
  10. package/src/app/(main)/chat/(workspace)/@conversation/default.tsx +23 -0
  11. package/src/app/(main)/chat/{(desktop)/features/ChatInput → (workspace)/@conversation/features/ChatInput/Desktop}/index.tsx +6 -2
  12. package/src/app/(main)/chat/{(mobile)/features/ChatInput → (workspace)/@conversation/features/ChatInput/Mobile}/index.tsx +9 -4
  13. package/src/app/(main)/chat/(workspace)/@topic/default.tsx +19 -0
  14. package/src/app/(main)/chat/{(desktop)/features/SideBar/SystemRole/index.tsx → (workspace)/@topic/features/SystemRole/SystemRoleContent.tsx} +2 -0
  15. package/src/app/(main)/chat/(workspace)/@topic/features/SystemRole/index.tsx +18 -0
  16. package/src/app/(main)/chat/{features → (workspace)/@topic/features}/TopicListContent/Header.tsx +2 -0
  17. package/src/app/(main)/chat/{features → (workspace)/@topic/features}/TopicListContent/Topic/index.tsx +26 -28
  18. package/src/app/(main)/chat/{features → (workspace)/@topic/features}/TopicListContent/TopicSearchBar/index.tsx +4 -2
  19. package/src/app/(main)/chat/{features → (workspace)/@topic/features}/TopicListContent/index.tsx +3 -4
  20. package/src/app/(main)/chat/{(desktop)/features → (workspace)/_layout/Desktop}/ChatHeader/HeaderAction.tsx +2 -0
  21. package/src/app/(main)/chat/{(desktop)/features → (workspace)/_layout/Desktop}/ChatHeader/Main.tsx +3 -1
  22. package/src/app/(main)/chat/{(desktop)/features → (workspace)/_layout/Desktop}/ChatHeader/Tags.tsx +1 -1
  23. package/src/app/(main)/chat/{(desktop)/features → (workspace)/_layout/Desktop}/ChatHeader/index.tsx +1 -2
  24. package/src/app/(main)/chat/{(desktop)/features → (workspace)/_layout/Desktop}/HotKeys.tsx +2 -0
  25. package/src/app/(main)/chat/{(desktop)/features/SideBar/index.tsx → (workspace)/_layout/Desktop/TopicPanel.tsx} +23 -20
  26. package/src/app/(main)/chat/(workspace)/_layout/Desktop/index.tsx +35 -0
  27. package/src/app/(main)/chat/(workspace)/_layout/Mobile/ChatHeader/index.tsx +35 -0
  28. package/src/app/(main)/chat/(workspace)/_layout/Mobile/TopicModal.tsx +26 -0
  29. package/src/app/(main)/chat/(workspace)/_layout/Mobile/index.tsx +21 -0
  30. package/src/app/(main)/chat/(workspace)/_layout/type.ts +7 -0
  31. package/src/app/(main)/chat/{features → (workspace)/features}/PluginTag/index.tsx +2 -0
  32. package/src/app/(main)/chat/{features → (workspace)/features}/SettingButton.tsx +3 -1
  33. package/src/app/(main)/chat/{features → (workspace)/features}/ShareButton/index.tsx +5 -6
  34. package/src/app/(main)/chat/{features/TelemetryNotification/index.tsx → (workspace)/features/TelemetryNotification.tsx} +2 -0
  35. package/src/app/(main)/chat/(workspace)/features/useWorkspaceModal.tsx +27 -0
  36. package/src/app/(main)/chat/(workspace)/layout.ts +11 -0
  37. package/src/app/(main)/chat/(workspace)/page.tsx +19 -0
  38. package/src/app/(main)/chat/@session/_layout/Desktop/PanelBody.tsx +22 -0
  39. package/src/app/(main)/chat/{_layout → @session/_layout}/Desktop/SessionHeader.tsx +2 -0
  40. package/src/app/(main)/chat/@session/_layout/Desktop/index.tsx +15 -0
  41. package/src/app/(main)/chat/{(mobile)/features → @session/_layout/Mobile}/SessionHeader.tsx +7 -20
  42. package/src/app/(main)/chat/@session/_layout/Mobile/index.tsx +19 -0
  43. package/src/app/(main)/chat/@session/default.tsx +23 -0
  44. package/src/app/(main)/chat/{components/SessionHydration/index.tsx → @session/features/SessionHydration.tsx} +1 -0
  45. package/src/app/(main)/chat/{features → @session/features}/SessionListContent/DefaultMode.tsx +3 -3
  46. package/src/app/(main)/chat/{features → @session/features}/SessionListContent/Inbox/index.tsx +2 -2
  47. package/src/app/(main)/chat/{features → @session/features}/SessionListContent/List/index.tsx +3 -4
  48. package/src/app/(main)/chat/{features → @session/features}/SessionListContent/ListItem/index.tsx +12 -10
  49. package/src/app/(main)/chat/{features → @session/features}/SessionListContent/SearchMode.tsx +4 -2
  50. package/src/app/(main)/chat/{features → @session/features}/SessionListContent/index.tsx +2 -0
  51. package/src/app/(main)/chat/{features/SessionSearchBar/index.tsx → @session/features/SessionSearchBar.tsx} +3 -5
  52. package/src/app/(main)/chat/_layout/Desktop/SessionPanel.tsx +79 -0
  53. package/src/app/(main)/chat/_layout/Desktop/index.tsx +11 -7
  54. package/src/app/(main)/chat/_layout/Mobile.tsx +52 -0
  55. package/src/app/(main)/chat/_layout/type.ts +1 -0
  56. package/src/app/(main)/chat/error.tsx +5 -0
  57. package/src/app/(main)/chat/features/Migration/index.tsx +3 -8
  58. package/src/app/(main)/chat/not-found.tsx +3 -0
  59. package/src/app/(main)/chat/settings/_layout/Mobile/Header.tsx +3 -4
  60. package/src/app/(main)/chat/settings/features/HeaderContent.tsx +2 -2
  61. package/src/app/(main)/chat/settings/features/SubmitAgentButton/index.tsx +2 -2
  62. package/src/app/(main)/market/@detail/features/Header.tsx +2 -2
  63. package/src/components/Cell/Divider.tsx +2 -2
  64. package/src/components/Cell/index.tsx +2 -2
  65. package/src/components/StoreHydration/ChatHydration/index.tsx +2 -2
  66. package/src/const/session.ts +2 -0
  67. package/src/const/url.ts +5 -1
  68. package/src/features/AgentSetting/AgentChat/index.tsx +3 -5
  69. package/src/features/AgentSetting/AgentMeta/index.tsx +51 -54
  70. package/src/features/AgentSetting/AgentModal/index.tsx +2 -2
  71. package/src/features/AgentSetting/AgentTTS/index.tsx +18 -16
  72. package/src/features/AgentSetting/useSyncAgemtSettings.ts +14 -0
  73. package/src/features/ChatInput/ActionBar/Tools/index.tsx +3 -2
  74. package/src/features/Conversation/components/InboxWelcome/AgentsSuggest.tsx +1 -1
  75. package/src/features/Conversation/components/InboxWelcome/index.tsx +2 -2
  76. package/src/features/Conversation/components/SkeletonList.tsx +21 -8
  77. package/src/features/Conversation/components/VirtualizedList/index.tsx +19 -17
  78. package/src/features/Conversation/index.tsx +12 -31
  79. package/src/features/PluginStore/InstalledPluginList.tsx +28 -21
  80. package/src/features/PluginStore/OnlineList.tsx +4 -10
  81. package/src/features/PluginStore/PluginItem/Action.tsx +3 -2
  82. package/src/features/PluginStore/PluginItem/index.tsx +2 -0
  83. package/src/features/PluginStore/index.tsx +4 -2
  84. package/src/features/User/UserAvatar.tsx +2 -1
  85. package/src/features/User/UserPanel/useMenu.tsx +1 -1
  86. package/src/layout/GlobalProvider/AppTheme.tsx +7 -17
  87. package/src/store/global/action.ts +2 -0
  88. package/src/store/global/initialState.ts +2 -0
  89. package/src/styles/global.ts +12 -9
  90. package/src/styles/mobileHeader.ts +1 -1
  91. package/src/app/(main)/(mobile)/me/features/AvatarBanner.tsx +0 -27
  92. package/src/app/(main)/(mobile)/me/features/style.ts +0 -29
  93. package/src/app/(main)/chat/(desktop)/features/Conversation.tsx +0 -19
  94. package/src/app/(main)/chat/(desktop)/index.tsx +0 -22
  95. package/src/app/(main)/chat/(mobile)/features/SessionList.tsx +0 -17
  96. package/src/app/(main)/chat/(mobile)/features/TopicList.tsx +0 -29
  97. package/src/app/(main)/chat/(mobile)/index.tsx +0 -26
  98. package/src/app/(main)/chat/(mobile)/mobile/ChatHeader/index.tsx +0 -56
  99. package/src/app/(main)/chat/(mobile)/mobile/page.tsx +0 -26
  100. package/src/app/(main)/chat/_layout/Desktop/SessionList.tsx +0 -39
  101. package/src/app/(main)/chat/_layout/Mobile/index.tsx +0 -9
  102. package/src/app/(main)/chat/page.tsx +0 -25
  103. package/src/features/FolderPanel/index.tsx +0 -60
  104. package/src/utils/screen.ts +0 -14
  105. /package/src/app/(main)/chat/{(desktop)/features/ChatInput → (workspace)/@conversation/features/ChatInput/Desktop}/Footer/DragUpload.tsx +0 -0
  106. /package/src/app/(main)/chat/{(desktop)/features/ChatInput → (workspace)/@conversation/features/ChatInput/Desktop}/Footer/LocalFiles.tsx +0 -0
  107. /package/src/app/(main)/chat/{(desktop)/features/ChatInput → (workspace)/@conversation/features/ChatInput/Desktop}/Footer/SendMore.tsx +0 -0
  108. /package/src/app/(main)/chat/{(desktop)/features/ChatInput → (workspace)/@conversation/features/ChatInput/Desktop}/Footer/index.tsx +0 -0
  109. /package/src/app/(main)/chat/{(desktop)/features/ChatInput → (workspace)/@conversation/features/ChatInput/Desktop}/Header/index.tsx +0 -0
  110. /package/src/app/(main)/chat/{(desktop)/features/ChatInput → (workspace)/@conversation/features/ChatInput/Desktop}/TextArea.test.tsx +0 -0
  111. /package/src/app/(main)/chat/{(desktop)/features/ChatInput → (workspace)/@conversation/features/ChatInput/Desktop}/TextArea.tsx +0 -0
  112. /package/src/app/(main)/chat/{(desktop)/features/ChatInput → (workspace)/@conversation/features/ChatInput/Desktop}/__tests__/useAutoFocus.test.ts +0 -0
  113. /package/src/app/(main)/chat/{(desktop)/features/ChatInput → (workspace)/@conversation/features/ChatInput/Desktop}/useAutoFocus.ts +0 -0
  114. /package/src/app/(main)/chat/{(mobile)/features/ChatInput → (workspace)/@conversation/features/ChatInput/Mobile}/Files.tsx +0 -0
  115. /package/src/app/(main)/chat/{(desktop)/features/SideBar → (workspace)/@topic/features}/SystemRole/style.ts +0 -0
  116. /package/src/app/(main)/chat/{features → (workspace)/@topic/features}/TopicListContent/Topic/DefaultContent.tsx +0 -0
  117. /package/src/app/(main)/chat/{features → (workspace)/@topic/features}/TopicListContent/Topic/SkeletonList.tsx +0 -0
  118. /package/src/app/(main)/chat/{features → (workspace)/@topic/features}/TopicListContent/Topic/TopicContent.tsx +0 -0
  119. /package/src/app/(main)/chat/{features → (workspace)/@topic/features}/TopicListContent/Topic/TopicItem.tsx +0 -0
  120. /package/src/app/(main)/chat/{(mobile)/mobile → (workspace)/_layout/Mobile}/ChatHeader/ChatHeaderTitle.tsx +0 -0
  121. /package/src/app/(main)/chat/{features → (workspace)/features}/PluginTag/PluginStatus.tsx +0 -0
  122. /package/src/app/(main)/chat/{features → (workspace)/features}/ShareButton/Preview.tsx +0 -0
  123. /package/src/app/(main)/chat/{features → (workspace)/features}/ShareButton/ShareModal.tsx +0 -0
  124. /package/src/app/(main)/chat/{features → (workspace)/features}/ShareButton/style.ts +0 -0
  125. /package/src/app/(main)/chat/{features → (workspace)/features}/ShareButton/type.ts +0 -0
  126. /package/src/app/(main)/chat/{features → (workspace)/features}/ShareButton/useScreenshot.ts +0 -0
  127. /package/src/app/(main)/chat/{features → @session/features}/SessionListContent/CollapseGroup/Actions.tsx +0 -0
  128. /package/src/app/(main)/chat/{features → @session/features}/SessionListContent/CollapseGroup/index.tsx +0 -0
  129. /package/src/app/(main)/chat/{features → @session/features}/SessionListContent/List/AddButton.tsx +0 -0
  130. /package/src/app/(main)/chat/{features → @session/features}/SessionListContent/List/Item/Actions.tsx +0 -0
  131. /package/src/app/(main)/chat/{features → @session/features}/SessionListContent/List/Item/index.tsx +0 -0
  132. /package/src/app/(main)/chat/{features → @session/features}/SessionListContent/Modals/ConfigGroupModal/GroupItem.tsx +0 -0
  133. /package/src/app/(main)/chat/{features → @session/features}/SessionListContent/Modals/ConfigGroupModal/index.tsx +0 -0
  134. /package/src/app/(main)/chat/{features → @session/features}/SessionListContent/Modals/CreateGroupModal.tsx +0 -0
  135. /package/src/app/(main)/chat/{features → @session/features}/SessionListContent/Modals/RenameGroupModal.tsx +0 -0
  136. /package/src/app/(main)/chat/{features → @session/features}/SessionListContent/SkeletonList.tsx +0 -0
@@ -1,17 +0,0 @@
1
- import { memo } from 'react';
2
-
3
- import SessionListContent from '../../features/SessionListContent';
4
- import SessionSearchBar from '../../features/SessionSearchBar';
5
-
6
- const Sessions = memo(() => {
7
- return (
8
- <>
9
- <div style={{ padding: '8px 16px' }}>
10
- <SessionSearchBar mobile />
11
- </div>
12
- <SessionListContent />
13
- </>
14
- );
15
- });
16
-
17
- export default Sessions;
@@ -1,29 +0,0 @@
1
- import { Modal } from '@lobehub/ui';
2
- import { memo } from 'react';
3
- import { useTranslation } from 'react-i18next';
4
-
5
- import { useGlobalStore } from '@/store/global';
6
-
7
- import TopicListContent from '../../features/TopicListContent';
8
-
9
- const Topics = memo(() => {
10
- const [showAgentSettings, toggleConfig] = useGlobalStore((s) => [
11
- s.preference.mobileShowTopic,
12
- s.toggleMobileTopic,
13
- ]);
14
-
15
- const { t } = useTranslation('chat');
16
-
17
- return (
18
- <Modal
19
- allowFullscreen
20
- onCancel={() => toggleConfig(false)}
21
- open={showAgentSettings}
22
- title={t('topic.title')}
23
- >
24
- <TopicListContent mobile />
25
- </Modal>
26
- );
27
- });
28
-
29
- export default Topics;
@@ -1,26 +0,0 @@
1
- 'use client';
2
-
3
- import { useRouter } from 'next/navigation';
4
- import { memo, useEffect } from 'react';
5
-
6
- import MobileContentLayout from '@/components/server/MobileNavLayout';
7
-
8
- import SessionHeader from './features/SessionHeader';
9
- import SessionList from './features/SessionList';
10
-
11
- const ChatMobilePage = memo(() => {
12
- const router = useRouter();
13
-
14
- useEffect(() => {
15
- router.prefetch('/chat/mobile');
16
- router.prefetch('/settings');
17
- }, []);
18
-
19
- return (
20
- <MobileContentLayout header={<SessionHeader />} withNav>
21
- <SessionList />
22
- </MobileContentLayout>
23
- );
24
- });
25
-
26
- export default ChatMobilePage;
@@ -1,56 +0,0 @@
1
- import { MobileNavBar } from '@lobehub/ui';
2
- import { useRouter } from 'next/navigation';
3
- import { memo, useState } from 'react';
4
-
5
- import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
6
-
7
- import SettingButton from '../../../features/SettingButton';
8
- import ShareButton from '../../../features/ShareButton';
9
- import ChatHeaderTitle from './ChatHeaderTitle';
10
-
11
- const MobileHeader = memo(() => {
12
- const router = useRouter();
13
- const [open, setOpen] = useState(false);
14
-
15
- const { isAgentEditable } = useServerConfigStore(featureFlagsSelectors);
16
-
17
- // const items: MenuProps['items'] = [
18
- // {
19
- // icon: <Icon icon={Share2} />,
20
- // key: 'share',
21
- // label: t('share', { ns: 'common' }),
22
- // onClick: () => setOpen(true),
23
- // },
24
- // !isInbox && {
25
- // icon: <Icon icon={Settings} />,
26
- // key: 'settings',
27
- // label: t('header.session', { ns: 'setting' }),
28
- // onClick: () => router.push(pathString('/chat/settings', { hash: location.hash })),
29
- // },
30
- // ].filter(Boolean) as MenuProps['items'];
31
-
32
- return (
33
- <MobileNavBar
34
- center={<ChatHeaderTitle />}
35
- onBackClick={() => router.push('/chat')}
36
- right={
37
- <>
38
- <ShareButton mobile open={open} setOpen={setOpen} />
39
- {isAgentEditable && <SettingButton mobile />}
40
- {/*<Dropdown*/}
41
- {/* menu={{*/}
42
- {/* items,*/}
43
- {/* }}*/}
44
- {/* trigger={['click']}*/}
45
- {/*>*/}
46
- {/* <ActionIcon icon={MoreHorizontal} />*/}
47
- {/*</Dropdown>*/}
48
- </>
49
- }
50
- showBackButton
51
- style={{ width: '100%' }}
52
- />
53
- );
54
- });
55
-
56
- export default MobileHeader;
@@ -1,26 +0,0 @@
1
- 'use client';
2
-
3
- import dynamic from 'next/dynamic';
4
- import { memo } from 'react';
5
-
6
- import MobileContentLayout from '@/components/server/MobileNavLayout';
7
- import Conversation from '@/features/Conversation';
8
-
9
- import SessionHydration from '../../components/SessionHydration';
10
- import TelemetryNotification from '../../features/TelemetryNotification';
11
- import ChatInput from '../features/ChatInput';
12
- import ChatHeader from './ChatHeader';
13
-
14
- const TopicList = dynamic(() => import('../features/TopicList'));
15
-
16
- const Chat = memo(() => {
17
- return (
18
- <MobileContentLayout header={<ChatHeader />}>
19
- <Conversation chatInput={<ChatInput />} mobile />
20
- <TopicList />
21
- <TelemetryNotification mobile />
22
- <SessionHydration />
23
- </MobileContentLayout>
24
- );
25
- });
26
- export default Chat;
@@ -1,39 +0,0 @@
1
- 'use client';
2
-
3
- import { DraggablePanelBody } from '@lobehub/ui';
4
- import { createStyles } from 'antd-style';
5
- import { memo } from 'react';
6
-
7
- import FolderPanel from '@/features/FolderPanel';
8
-
9
- import SessionListContent from '../../features/SessionListContent';
10
- import Header from './SessionHeader';
11
-
12
- const useStyles = createStyles(({ stylish, css, cx }) =>
13
- cx(
14
- stylish.noScrollbar,
15
- css`
16
- display: flex;
17
- flex-direction: column;
18
- gap: 2px;
19
- padding: 8px 8px 0;
20
- `,
21
- ),
22
- );
23
-
24
- const Sessions = memo(() => {
25
- const { styles } = useStyles();
26
-
27
- return (
28
- <FolderPanel>
29
- <Header />
30
- <DraggablePanelBody className={styles}>
31
- <SessionListContent />
32
- </DraggablePanelBody>
33
- </FolderPanel>
34
- );
35
- });
36
-
37
- Sessions.displayName = 'SessionsList';
38
-
39
- export default Sessions;
@@ -1,9 +0,0 @@
1
- import { LayoutProps } from '../type';
2
-
3
- const Layout = ({ children }: LayoutProps) => {
4
- return children;
5
- };
6
-
7
- Layout.displayName = 'MobileChatLayout';
8
-
9
- export default Layout;
@@ -1,25 +0,0 @@
1
- import { isMobileDevice } from '@/utils/responsive';
2
-
3
- import DesktopPage from './(desktop)';
4
- import MobilePage from './(mobile)';
5
- import SessionHydration from './components/SessionHydration';
6
- import Migration from './features/Migration';
7
- import PageTitle from './features/PageTitle';
8
-
9
- const Page = () => {
10
- const mobile = isMobileDevice();
11
-
12
- const Page = mobile ? MobilePage : DesktopPage;
13
-
14
- return (
15
- <>
16
- <Migration>
17
- <PageTitle />
18
- <Page />
19
- </Migration>
20
- <SessionHydration />
21
- </>
22
- );
23
- };
24
-
25
- export default Page;
@@ -1,60 +0,0 @@
1
- import { DraggablePanel, DraggablePanelContainer } from '@lobehub/ui';
2
- import { createStyles } from 'antd-style';
3
- import isEqual from 'fast-deep-equal';
4
- import { PropsWithChildren, memo, useState } from 'react';
5
-
6
- import { FOLDER_WIDTH } from '@/const/layoutTokens';
7
- import { useGlobalStore } from '@/store/global';
8
-
9
- export const useStyles = createStyles(({ css, token }) => ({
10
- panel: css`
11
- height: 100%;
12
- color: ${token.colorTextSecondary};
13
- background: ${token.colorBgContainer};
14
- `,
15
- }));
16
-
17
- const FolderPanel = memo<PropsWithChildren>(({ children }) => {
18
- const { styles } = useStyles();
19
- const [sessionsWidth, sessionExpandable, updatePreference] = useGlobalStore((s) => [
20
- s.preference.sessionsWidth,
21
- s.preference.showSessionPanel,
22
- s.updatePreference,
23
- ]);
24
- const [tmpWidth, setWidth] = useState(sessionsWidth);
25
- if (tmpWidth !== sessionsWidth) setWidth(sessionsWidth);
26
-
27
- return (
28
- <DraggablePanel
29
- className={styles.panel}
30
- defaultSize={{ width: tmpWidth }}
31
- expand={sessionExpandable}
32
- maxWidth={400}
33
- minWidth={FOLDER_WIDTH}
34
- onExpandChange={(expand) => {
35
- updatePreference({
36
- sessionsWidth: expand ? 320 : 0,
37
- showSessionPanel: expand,
38
- });
39
- }}
40
- onSizeChange={(_, size) => {
41
- if (!size) return;
42
-
43
- const nextWidth = typeof size.width === 'string' ? Number.parseInt(size.width) : size.width;
44
-
45
- if (isEqual(nextWidth, sessionsWidth)) return;
46
-
47
- setWidth(nextWidth);
48
- updatePreference({ sessionsWidth: nextWidth });
49
- }}
50
- placement="left"
51
- size={{ height: '100%', width: sessionsWidth }}
52
- >
53
- <DraggablePanelContainer style={{ flex: 'none', height: '100%', minWidth: FOLDER_WIDTH }}>
54
- {children}
55
- </DraggablePanelContainer>
56
- </DraggablePanel>
57
- );
58
- });
59
-
60
- export default FolderPanel;
@@ -1,14 +0,0 @@
1
- // mobile 设备宽度
2
- // https://github.com/ant-design/ant-design/blob/master/components/theme/util/alias.ts#L28
3
- export const screenSM = 576;
4
-
5
- /**
6
- * check mobile device in browser
7
- */
8
- export const isMobileScreen = () => {
9
- if (typeof window === 'undefined') {
10
- return false;
11
- }
12
-
13
- return window.innerWidth <= screenSM;
14
- };