@lobehub/chat 1.39.2 → 1.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/.env.example +19 -8
  2. package/.eslintignore +1 -1
  3. package/CHANGELOG.md +58 -0
  4. package/changelog/v1.json +21 -0
  5. package/docs/.cdn.cache.json +25 -0
  6. package/docs/changelog/2023-09-09-plugin-system.mdx +1 -1
  7. package/docs/changelog/2023-09-09-plugin-system.zh-CN.mdx +1 -1
  8. package/docs/changelog/2024-09-20-artifacts.mdx +1 -1
  9. package/docs/changelog/2024-09-20-artifacts.zh-CN.mdx +1 -1
  10. package/docs/changelog/2024-10-27-pin-assistant.mdx +2 -2
  11. package/docs/changelog/2024-10-27-pin-assistant.zh-CN.mdx +2 -2
  12. package/docs/changelog/2024-11-06-share-text-json.mdx +2 -2
  13. package/docs/changelog/2024-11-06-share-text-json.zh-CN.mdx +2 -2
  14. package/docs/changelog/index.json +16 -16
  15. package/locales/ar/changelog.json +18 -0
  16. package/locales/ar/common.json +1 -0
  17. package/locales/ar/metadata.json +4 -0
  18. package/locales/bg-BG/changelog.json +18 -0
  19. package/locales/bg-BG/common.json +1 -0
  20. package/locales/bg-BG/metadata.json +4 -0
  21. package/locales/de-DE/changelog.json +18 -0
  22. package/locales/de-DE/common.json +1 -0
  23. package/locales/de-DE/metadata.json +4 -0
  24. package/locales/en-US/changelog.json +18 -0
  25. package/locales/en-US/common.json +1 -0
  26. package/locales/en-US/metadata.json +4 -0
  27. package/locales/es-ES/changelog.json +18 -0
  28. package/locales/es-ES/common.json +1 -0
  29. package/locales/es-ES/metadata.json +4 -0
  30. package/locales/fa-IR/changelog.json +18 -0
  31. package/locales/fa-IR/common.json +1 -0
  32. package/locales/fa-IR/metadata.json +4 -0
  33. package/locales/fr-FR/changelog.json +18 -0
  34. package/locales/fr-FR/common.json +1 -0
  35. package/locales/fr-FR/metadata.json +4 -0
  36. package/locales/it-IT/changelog.json +18 -0
  37. package/locales/it-IT/common.json +1 -0
  38. package/locales/it-IT/metadata.json +4 -0
  39. package/locales/ja-JP/changelog.json +18 -0
  40. package/locales/ja-JP/common.json +1 -0
  41. package/locales/ja-JP/metadata.json +4 -0
  42. package/locales/ko-KR/changelog.json +18 -0
  43. package/locales/ko-KR/common.json +1 -0
  44. package/locales/ko-KR/metadata.json +4 -0
  45. package/locales/nl-NL/changelog.json +18 -0
  46. package/locales/nl-NL/common.json +1 -0
  47. package/locales/nl-NL/metadata.json +4 -0
  48. package/locales/pl-PL/changelog.json +18 -0
  49. package/locales/pl-PL/common.json +1 -0
  50. package/locales/pl-PL/metadata.json +4 -0
  51. package/locales/pt-BR/changelog.json +18 -0
  52. package/locales/pt-BR/common.json +1 -0
  53. package/locales/pt-BR/metadata.json +4 -0
  54. package/locales/ru-RU/changelog.json +18 -0
  55. package/locales/ru-RU/common.json +1 -0
  56. package/locales/ru-RU/metadata.json +4 -0
  57. package/locales/tr-TR/changelog.json +18 -0
  58. package/locales/tr-TR/common.json +1 -0
  59. package/locales/tr-TR/metadata.json +4 -0
  60. package/locales/vi-VN/changelog.json +18 -0
  61. package/locales/vi-VN/common.json +1 -0
  62. package/locales/vi-VN/metadata.json +4 -0
  63. package/locales/zh-CN/changelog.json +18 -0
  64. package/locales/zh-CN/common.json +1 -0
  65. package/locales/zh-CN/metadata.json +4 -0
  66. package/locales/zh-TW/changelog.json +18 -0
  67. package/locales/zh-TW/common.json +1 -0
  68. package/locales/zh-TW/metadata.json +4 -0
  69. package/package.json +6 -1
  70. package/scripts/cdnWorkflow/index.ts +217 -0
  71. package/scripts/cdnWorkflow/optimized.ts +21 -0
  72. package/scripts/cdnWorkflow/s3/index.ts +120 -0
  73. package/scripts/cdnWorkflow/s3/types.ts +25 -0
  74. package/scripts/cdnWorkflow/s3/utils.ts +106 -0
  75. package/scripts/cdnWorkflow/uploader.ts +73 -0
  76. package/scripts/cdnWorkflow/utils.ts +93 -0
  77. package/src/app/(main)/(mobile)/me/(home)/__tests__/useCategory.test.tsx +25 -12
  78. package/src/app/(main)/(mobile)/me/(home)/features/useCategory.tsx +19 -9
  79. package/src/app/(main)/(mobile)/me/(home)/loading.tsx +1 -1
  80. package/src/app/(main)/(mobile)/me/data/loading.tsx +1 -1
  81. package/src/app/(main)/(mobile)/me/profile/loading.tsx +1 -1
  82. package/src/app/(main)/(mobile)/me/settings/loading.tsx +1 -1
  83. package/src/app/(main)/_layout/Desktop.tsx +4 -1
  84. package/src/app/(main)/_layout/Mobile.tsx +2 -1
  85. package/src/app/(main)/changelog/_layout/Desktop.tsx +25 -0
  86. package/src/app/(main)/changelog/_layout/Mobile/Header.tsx +33 -0
  87. package/src/app/(main)/changelog/_layout/Mobile/index.tsx +21 -0
  88. package/src/app/(main)/changelog/error.tsx +5 -0
  89. package/src/app/(main)/changelog/features/GridLayout.tsx +22 -0
  90. package/src/app/(main)/changelog/features/Hero.tsx +40 -0
  91. package/src/app/(main)/changelog/features/Post.tsx +56 -0
  92. package/src/app/(main)/changelog/features/PublishedTime.tsx +50 -0
  93. package/src/app/(main)/changelog/features/VersionTag.tsx +27 -0
  94. package/src/app/(main)/changelog/layout.tsx +10 -0
  95. package/src/app/(main)/changelog/loading.tsx +3 -0
  96. package/src/app/(main)/changelog/modal/page.tsx +23 -0
  97. package/src/app/(main)/changelog/not-found.tsx +3 -0
  98. package/src/app/(main)/changelog/page.tsx +73 -0
  99. package/src/app/(main)/chat/(workspace)/@portal/default.tsx +1 -1
  100. package/src/app/(main)/chat/(workspace)/@portal/loading.tsx +1 -1
  101. package/src/app/(main)/chat/(workspace)/page.tsx +9 -2
  102. package/src/app/(main)/chat/@session/default.tsx +3 -2
  103. package/src/app/(main)/chat/loading.tsx +1 -1
  104. package/src/app/(main)/chat/settings/loading.tsx +1 -1
  105. package/src/app/(main)/discover/loading.tsx +1 -1
  106. package/src/app/(main)/files/loading.tsx +2 -22
  107. package/src/app/(main)/profile/loading.tsx +1 -1
  108. package/src/app/(main)/repos/[id]/evals/dataset/page.tsx +1 -1
  109. package/src/app/(main)/repos/[id]/evals/evaluation/page.tsx +1 -1
  110. package/src/app/(main)/settings/@category/default.tsx +6 -2
  111. package/src/app/(main)/settings/_layout/Desktop/SideBar.tsx +1 -1
  112. package/src/app/(main)/settings/about/features/Version.tsx +2 -2
  113. package/src/app/(main)/settings/loading.tsx +2 -8
  114. package/src/app/@modal/(.)changelog/modal/features/Cover.tsx +48 -0
  115. package/src/app/@modal/(.)changelog/modal/features/Hero.tsx +29 -0
  116. package/src/app/@modal/(.)changelog/modal/features/Pagination.tsx +54 -0
  117. package/src/app/@modal/(.)changelog/modal/features/Post.tsx +57 -0
  118. package/src/app/@modal/(.)changelog/modal/features/PublishedTime.tsx +50 -0
  119. package/src/app/@modal/(.)changelog/modal/features/ReadDetail.tsx +94 -0
  120. package/src/app/@modal/(.)changelog/modal/features/UpdateChangelogStatus.tsx +21 -0
  121. package/src/app/@modal/(.)changelog/modal/features/VersionTag.tsx +27 -0
  122. package/src/app/@modal/(.)changelog/modal/layout.tsx +39 -0
  123. package/src/app/@modal/(.)changelog/modal/loading.tsx +10 -0
  124. package/src/app/@modal/(.)changelog/modal/page.tsx +37 -0
  125. package/src/app/@modal/(.)settings/modal/layout.tsx +19 -16
  126. package/src/app/@modal/_layout/ModalLayout.tsx +63 -0
  127. package/src/app/@modal/chat/(.)settings/modal/layout.tsx +20 -17
  128. package/src/app/@modal/layout.tsx +5 -69
  129. package/src/app/loading/Client/Content.tsx +1 -1
  130. package/src/app/loading/Server/Content.tsx +1 -1
  131. package/src/components/Loading/BrandTextLoading/LobeChatText/SVG.tsx +44 -0
  132. package/src/components/Loading/BrandTextLoading/LobeChatText/index.tsx +6 -0
  133. package/src/components/Loading/BrandTextLoading/LobeChatText/style.css +32 -0
  134. package/src/components/Loading/BrandTextLoading/index.tsx +11 -0
  135. package/src/components/{SkeletonLoading → Loading/SkeletonLoading}/index.tsx +1 -1
  136. package/src/components/mdx/Image.tsx +50 -0
  137. package/src/components/mdx/index.tsx +2 -0
  138. package/src/const/url.ts +1 -0
  139. package/src/features/ChangelogModal/index.tsx +22 -0
  140. package/src/features/FileViewer/Renderer/TXT/index.tsx +1 -1
  141. package/src/features/Portal/FilePreview/Body/index.tsx +1 -1
  142. package/src/features/Portal/Home/Body/Files/FileList/index.tsx +1 -1
  143. package/src/features/Setting/Footer.tsx +3 -1
  144. package/src/features/Setting/SettingContainer.tsx +1 -0
  145. package/src/features/User/UserPanel/useMenu.tsx +50 -46
  146. package/src/features/User/__tests__/useMenu.test.tsx +7 -6
  147. package/src/hooks/useInterceptingRoutes.ts +1 -6
  148. package/src/hooks/useShare.tsx +1 -0
  149. package/src/locales/default/changelog.ts +18 -0
  150. package/src/locales/default/common.ts +1 -0
  151. package/src/locales/default/index.ts +2 -0
  152. package/src/locales/default/metadata.ts +4 -0
  153. package/src/server/metadata.ts +5 -3
  154. package/src/server/routers/edge/appStatus.ts +3 -0
  155. package/src/server/routers/edge/index.ts +2 -0
  156. package/src/server/routers/lambda/agent.ts +1 -1
  157. package/src/server/services/changelog/index.test.ts +310 -0
  158. package/src/server/services/changelog/index.ts +196 -0
  159. package/src/server/services/discover/index.test.ts +0 -1
  160. package/src/server/sitemap.ts +4 -1
  161. package/src/services/__tests__/chat.test.ts +1 -1
  162. package/src/services/__tests__/global.test.ts +5 -2
  163. package/src/services/_auth.ts +1 -1
  164. package/src/services/agent.ts +25 -21
  165. package/src/services/chat.ts +2 -2
  166. package/src/services/file/ClientS3/index.ts +6 -6
  167. package/src/services/file/client.ts +14 -15
  168. package/src/services/file/server.ts +20 -25
  169. package/src/services/global.ts +2 -2
  170. package/src/services/import/client.ts +6 -5
  171. package/src/services/import/server.ts +6 -5
  172. package/src/services/import/type.ts +7 -0
  173. package/src/services/knowledgeBase.ts +19 -19
  174. package/src/services/message/_deprecated.ts +5 -0
  175. package/src/services/message/client.ts +52 -48
  176. package/src/services/message/server.ts +50 -53
  177. package/src/services/message/type.ts +2 -2
  178. package/src/services/plugin/client.ts +16 -22
  179. package/src/services/plugin/server.ts +15 -19
  180. package/src/services/rag.ts +18 -18
  181. package/src/services/ragEval.ts +29 -26
  182. package/src/services/session/_deprecated.ts +2 -2
  183. package/src/services/session/client.ts +55 -81
  184. package/src/services/session/server.ts +50 -74
  185. package/src/services/session/type.ts +4 -6
  186. package/src/services/share.ts +4 -4
  187. package/src/services/textToImage.ts +5 -2
  188. package/src/services/thread/client.ts +9 -15
  189. package/src/services/thread/server.ts +10 -15
  190. package/src/services/topic/client.ts +25 -25
  191. package/src/services/topic/server.ts +25 -42
  192. package/src/services/trace.ts +4 -4
  193. package/src/services/user/client.ts +13 -17
  194. package/src/services/user/server.ts +9 -13
  195. package/src/services/user/type.ts +1 -1
  196. package/src/store/chat/slices/message/reducer.ts +3 -2
  197. package/src/store/global/action.ts +27 -22
  198. package/src/store/global/initialState.ts +1 -0
  199. package/src/types/changelog.ts +6 -0
  200. package/src/types/message/index.ts +10 -8
  201. package/src/app/@modal/features/InterceptingContext.tsx +0 -9
  202. /package/src/components/{CircleLoading → Loading/CircleLoading}/index.tsx +0 -0
  203. /package/src/components/{FullscreenLoading → Loading/FullscreenLoading}/index.tsx +0 -0
@@ -0,0 +1,27 @@
1
+ 'use client';
2
+
3
+ import { Tag } from '@lobehub/ui';
4
+ import { createStyles } from 'antd-style';
5
+ import { memo } from 'react';
6
+
7
+ const useStyles = createStyles(({ token, css }) => {
8
+ return {
9
+ tag: css`
10
+ margin: 0;
11
+ padding-block: 4px;
12
+ padding-inline: 12px;
13
+
14
+ color: ${token.colorTextSecondary};
15
+
16
+ border-radius: 16px;
17
+ `,
18
+ };
19
+ });
20
+
21
+ const VersionTag = memo<{ range: string[] }>(({ range }) => {
22
+ const { styles } = useStyles();
23
+
24
+ return <Tag className={styles.tag}>{range.map((v) => 'v' + v).join(' ~ ')}</Tag>;
25
+ });
26
+
27
+ export default VersionTag;
@@ -0,0 +1,39 @@
1
+ 'use client';
2
+
3
+ import { createStyles } from 'antd-style';
4
+ import { PropsWithChildren, memo } from 'react';
5
+ import { Flexbox } from 'react-layout-kit';
6
+
7
+ import ModalLayout from '../../_layout/ModalLayout';
8
+ import Hero from './features/Hero';
9
+ import Pagination from './features/Pagination';
10
+
11
+ const useStyles = createStyles(
12
+ ({ css, prefixCls, token }) => css`
13
+ .${prefixCls}-modal-close {
14
+ background: ${token.colorBgElevated} !important;
15
+ border: 1px solid ${token.colorBorderSecondary};
16
+ }
17
+ `,
18
+ );
19
+
20
+ const Layout = memo<PropsWithChildren>(({ children }) => {
21
+ const { styles } = useStyles();
22
+
23
+ return (
24
+ <ModalLayout centered className={styles} height={'min(90vh, 800px)'} width={'min(90vw, 600px)'}>
25
+ <Flexbox
26
+ style={{ overflowX: 'hidden', overflowY: 'auto', position: 'relative' }}
27
+ width={'100%'}
28
+ >
29
+ <Hero />
30
+ {children}
31
+ <Flexbox padding={24}>
32
+ <Pagination />
33
+ </Flexbox>
34
+ </Flexbox>
35
+ </ModalLayout>
36
+ );
37
+ });
38
+
39
+ export default Layout;
@@ -0,0 +1,10 @@
1
+ import { Skeleton } from 'antd';
2
+ import { Flexbox } from 'react-layout-kit';
3
+
4
+ export default () => {
5
+ return (
6
+ <Flexbox paddingBlock={12} paddingInline={24}>
7
+ <Skeleton active paragraph={{ rows: 5 }} title={false} />
8
+ </Flexbox>
9
+ );
10
+ };
@@ -0,0 +1,37 @@
1
+ import { notFound } from 'next/navigation';
2
+ import { Suspense } from 'react';
3
+
4
+ import { serverFeatureFlags } from '@/config/featureFlags';
5
+ import { ChangelogService } from '@/server/services/changelog';
6
+ import { getLocale } from '@/server/translation';
7
+ import { isMobileDevice } from '@/utils/server/responsive';
8
+
9
+ import Post from './features/Post';
10
+ import UpdateChangelogStatus from './features/UpdateChangelogStatus';
11
+ import Loading from './loading';
12
+
13
+ const Page = async () => {
14
+ const hideDocs = serverFeatureFlags().hideDocs;
15
+
16
+ if (hideDocs) return notFound();
17
+
18
+ const locale = await getLocale();
19
+ const mobile = await isMobileDevice();
20
+ const changelogService = new ChangelogService();
21
+ const data = await changelogService.getChangelogIndex();
22
+
23
+ return (
24
+ <>
25
+ {data.map((item) => (
26
+ <Suspense fallback={<Loading />} key={item.id}>
27
+ <Post locale={locale} mobile={mobile} {...item} />
28
+ </Suspense>
29
+ ))}
30
+ <UpdateChangelogStatus currentId={data[0]?.id} />
31
+ </>
32
+ );
33
+ };
34
+
35
+ Page.displayName = 'ChangelogModal';
36
+
37
+ export default Page;
@@ -8,6 +8,7 @@ import { useTranslation } from 'react-i18next';
8
8
  import { useActiveSettingsKey } from '@/hooks/useActiveSettingsKey';
9
9
  import { SettingsTabs } from '@/store/global/initialState';
10
10
 
11
+ import ModalLayout from '../../_layout/ModalLayout';
11
12
  import SettingModalLayout from '../../_layout/SettingModalLayout';
12
13
 
13
14
  const CategoryContent = dynamic(
@@ -22,22 +23,24 @@ const Layout = memo<PropsWithChildren>(({ children }) => {
22
23
  const { t } = useTranslation('setting');
23
24
  const activeKey = useActiveSettingsKey();
24
25
  return (
25
- <SettingModalLayout
26
- activeTitle={
27
- <>
28
- {t(`tab.${activeKey}`)}
29
- {activeKey === SettingsTabs.Sync && <Tag color={'gold'}>{t('tab.experiment')}</Tag>}
30
- </>
31
- }
32
- category={
33
- <>
34
- <CategoryContent modal />
35
- <UpgradeAlert />
36
- </>
37
- }
38
- >
39
- {children}
40
- </SettingModalLayout>
26
+ <ModalLayout>
27
+ <SettingModalLayout
28
+ activeTitle={
29
+ <>
30
+ {t(`tab.${activeKey}`)}
31
+ {activeKey === SettingsTabs.Sync && <Tag color={'gold'}>{t('tab.experiment')}</Tag>}
32
+ </>
33
+ }
34
+ category={
35
+ <>
36
+ <CategoryContent modal />
37
+ <UpgradeAlert />
38
+ </>
39
+ }
40
+ >
41
+ {children}
42
+ </SettingModalLayout>
43
+ </ModalLayout>
41
44
  );
42
45
  });
43
46
 
@@ -0,0 +1,63 @@
1
+ 'use client';
2
+
3
+ import { Modal, type ModalProps } from '@lobehub/ui';
4
+ import { useTheme } from 'antd-style';
5
+ import { useRouter } from 'next/navigation';
6
+ import { memo, useState } from 'react';
7
+
8
+ const ModalLayout = memo<ModalProps>(
9
+ ({
10
+ children,
11
+ height = 'min(80vh,750px)',
12
+ width = 'min(80vw, 1024px)',
13
+ onCancel,
14
+ afterClose,
15
+ styles,
16
+ ...rest
17
+ }) => {
18
+ const [open, setOpen] = useState(true);
19
+ const router = useRouter();
20
+ const theme = useTheme();
21
+
22
+ return (
23
+ <Modal
24
+ afterClose={() => {
25
+ afterClose?.();
26
+ router.back();
27
+ }}
28
+ enableResponsive={false}
29
+ footer={null}
30
+ height={height}
31
+ onCancel={(e) => {
32
+ onCancel?.(e);
33
+ setOpen(false);
34
+ router.back();
35
+ }}
36
+ open={open}
37
+ styles={{
38
+ ...styles,
39
+ body: {
40
+ display: 'flex',
41
+ height: height,
42
+ overflow: 'hidden',
43
+ padding: 0,
44
+ position: 'relative',
45
+ ...styles?.body,
46
+ },
47
+ content: {
48
+ border: 'none',
49
+ boxShadow: `0 0 0 1px ${theme.colorBorderSecondary}`,
50
+ ...styles?.content,
51
+ },
52
+ }}
53
+ title={false}
54
+ width={width}
55
+ {...rest}
56
+ >
57
+ {children}
58
+ </Modal>
59
+ );
60
+ },
61
+ );
62
+
63
+ export default ModalLayout;
@@ -6,6 +6,7 @@ import dynamic from 'next/dynamic';
6
6
  import { PropsWithChildren, memo } from 'react';
7
7
  import { useTranslation } from 'react-i18next';
8
8
 
9
+ import ModalLayout from '@/app/@modal/_layout/ModalLayout';
9
10
  import StoreUpdater from '@/features/AgentSetting/StoreUpdater';
10
11
  import { Provider, createStore } from '@/features/AgentSetting/store';
11
12
  import { useQuery } from '@/hooks/useQuery';
@@ -35,23 +36,25 @@ const Layout = memo<PropsWithChildren>(({ children }) => {
35
36
  ]);
36
37
 
37
38
  return (
38
- <SettingModalLayout
39
- activeTitle={t(`agentTab.${tab as ChatSettingsTabs}`)}
40
- category={<CategoryContent />}
41
- desc={t('header.sessionDesc')}
42
- title={t('header.session')}
43
- >
44
- <Provider createStore={createStore}>
45
- <StoreUpdater
46
- config={config}
47
- id={id}
48
- meta={meta}
49
- onConfigChange={updateAgentConfig}
50
- onMetaChange={updateAgentMeta}
51
- />
52
- {children}
53
- </Provider>
54
- </SettingModalLayout>
39
+ <ModalLayout>
40
+ <SettingModalLayout
41
+ activeTitle={t(`agentTab.${tab as ChatSettingsTabs}`)}
42
+ category={<CategoryContent />}
43
+ desc={t('header.sessionDesc')}
44
+ title={t('header.session')}
45
+ >
46
+ <Provider createStore={createStore}>
47
+ <StoreUpdater
48
+ config={config}
49
+ id={id}
50
+ meta={meta}
51
+ onConfigChange={updateAgentConfig}
52
+ onMetaChange={updateAgentMeta}
53
+ />
54
+ {children}
55
+ </Provider>
56
+ </SettingModalLayout>
57
+ </ModalLayout>
55
58
  );
56
59
  });
57
60
 
@@ -1,71 +1,7 @@
1
- 'use client';
1
+ import { FC, PropsWithChildren } from 'react';
2
2
 
3
- import { Modal } from '@lobehub/ui';
4
- import { useTheme } from 'antd-style';
5
- import { usePathname, useRouter } from 'next/navigation';
6
- import { PropsWithChildren, memo, useEffect, useState } from 'react';
3
+ const Layout: FC<PropsWithChildren> = ({ children }) => {
4
+ return <div style={{ position: 'absolute', zIndex: 0 }}>{children}</div>;
5
+ };
7
6
 
8
- import InterceptingLayout from './features/InterceptingContext';
9
-
10
- const InterceptingModal = memo<PropsWithChildren>(({ children }) => {
11
- const [open, setOpen] = useState(true);
12
- const router = useRouter();
13
- const pathname = usePathname();
14
- const isDiscover = pathname.startsWith('/discover');
15
- const theme = useTheme();
16
-
17
- const inModal =
18
- pathname.startsWith('/settings') ||
19
- pathname.startsWith('/chat/settings') ||
20
- pathname.startsWith('/discover/assistant/') ||
21
- pathname.startsWith('/discover/model/') ||
22
- pathname.startsWith('/discover/plugin/') ||
23
- pathname.startsWith('/discover/provider/');
24
-
25
- useEffect(() => {
26
- if (!inModal) {
27
- setOpen(false);
28
- } else {
29
- setOpen(true);
30
- }
31
- }, [inModal, router]);
32
-
33
- if (!inModal) return null;
34
-
35
- return (
36
- <InterceptingLayout>
37
- <Modal
38
- afterClose={() => {
39
- if (inModal) {
40
- router.back();
41
- } else {
42
- router.refresh();
43
- }
44
- }}
45
- enableResponsive={false}
46
- footer={null}
47
- onCancel={() => {
48
- setOpen(false);
49
- router.back();
50
- }}
51
- open={open}
52
- styles={{
53
- body: {
54
- display: 'flex',
55
- maxHeight: isDiscover ? '80vh' : undefined,
56
- minHeight: 750,
57
- overflow: 'hidden',
58
- padding: 0,
59
- },
60
- content: { border: 'none', boxShadow: `0 0 0 1px ${theme.colorBorderSecondary}` },
61
- }}
62
- title={false}
63
- width={isDiscover ? 'min(80vw, 1280px)' : 'min(80vw, 1024px)'}
64
- >
65
- {children}
66
- </Modal>
67
- </InterceptingLayout>
68
- );
69
- });
70
-
71
- export default InterceptingModal;
7
+ export default Layout;
@@ -2,7 +2,7 @@ import dynamic from 'next/dynamic';
2
2
  import React, { memo } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
 
5
- import FullscreenLoading from '@/components/FullscreenLoading';
5
+ import FullscreenLoading from '@/components/Loading/FullscreenLoading';
6
6
  import { useGlobalStore } from '@/store/global';
7
7
  import { systemStatusSelectors } from '@/store/global/selectors';
8
8
  import { DatabaseLoadingState } from '@/types/clientDB';
@@ -1,7 +1,7 @@
1
1
  import React, { memo } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
 
4
- import FullscreenLoading from '@/components/FullscreenLoading';
4
+ import FullscreenLoading from '@/components/Loading/FullscreenLoading';
5
5
 
6
6
  import { AppLoadingStage, SERVER_LOADING_STAGES } from '../stage';
7
7
 
@@ -0,0 +1,44 @@
1
+ import { memo } from 'react';
2
+
3
+ const LobeChatText = memo<{ size?: number }>(({ size = '1em' }) => (
4
+ <svg
5
+ fill="currentColor"
6
+ fillRule="evenodd"
7
+ height={size}
8
+ style={{ flex: 'none', lineHeight: 1, opacity: 0.6 }}
9
+ viewBox="0 0 980 320"
10
+ xmlns="http://www.w3.org/2000/svg"
11
+ >
12
+ <title>LobeChat</title>
13
+ <path
14
+ className="animate-draw"
15
+ d="M696.999 135.08c-.455.472-.895.949-1.32 1.434V77h-34.98v162.8h35.42v-69.52c0-2.933.514-5.573 1.54-7.92a18.279 18.279 0 014.4-6.16c2.054-1.907 4.4-3.3 7.04-4.18 2.64-1.027 5.5-1.54 8.58-1.54 3.96-.147 7.26.513 9.9 1.98 2.64 1.467 4.62 3.74 5.94 6.82 1.32 3.08 1.98 6.967 1.98 11.66v68.86h35.42v-71.5c0-10.413-1.54-19.14-4.62-26.18-2.933-7.187-7.406-12.54-13.42-16.06-6.013-3.667-13.42-5.5-22.22-5.5-6.453 0-12.613 1.32-18.48 3.96-5.866 2.64-10.926 6.16-15.18 10.56zM15 240.035V87.172h39.24V205.75h66.192v34.285H15z"
16
+ />
17
+ <path
18
+ className="animate-draw"
19
+ d="M183.731 242c-11.759 0-22.196-2.621-31.313-7.862-9.116-5.241-16.317-12.447-21.601-21.619-5.153-9.317-7.729-19.945-7.729-31.883 0-11.937 2.576-22.492 7.729-31.664 5.164-8.963 12.159-15.98 20.982-21.05l.619-.351c9.117-5.241 19.554-7.861 31.313-7.861s22.196 2.62 31.313 7.861c9.248 5.096 16.449 12.229 21.601 21.401 5.153 9.172 7.729 19.727 7.729 31.664 0 11.938-2.576 22.566-7.729 31.883-5.152 9.172-12.353 16.378-21.601 21.619-9.117 5.241-19.554 7.862-31.313 7.862zm0-32.975c4.36 0 8.191-1.092 11.494-3.275 3.436-2.184 6.144-5.387 8.126-9.609 1.982-4.367 2.973-9.536 2.973-15.505 0-5.968-.991-10.991-2.973-15.067-1.906-4.06-4.483-7.177-7.733-9.352l-.393-.257c-3.303-2.184-7.134-3.276-11.494-3.276-4.228 0-8.059 1.092-11.495 3.276-3.303 2.184-6.011 5.387-8.125 9.609-1.982 4.076-2.973 9.099-2.973 15.067 0 5.969.991 11.138 2.973 15.505 2.114 4.222 4.822 7.425 8.125 9.609 3.436 2.183 7.267 3.275 11.495 3.275z"
20
+ />
21
+ <path
22
+ className="animate-draw"
23
+ d="M295.508 78l-.001 54.042a34.071 34.071 0 016.541-5.781c6.474-4.367 14.269-6.551 23.385-6.551 9.777 0 18.629 2.475 26.557 7.424 7.872 4.835 14.105 11.684 18.7 20.546l.325.637c4.756 9.026 7.135 19.799 7.135 32.319 0 12.666-2.379 23.585-7.135 32.757-4.624 9.026-10.966 16.087-19.025 21.182-7.928 4.95-16.78 7.425-26.557 7.425-9.644 0-17.704-2.184-24.178-6.551-2.825-1.946-5.336-4.355-7.532-7.226l.001 11.812h-35.87V78h37.654zm21.998 74.684c-4.228 0-8.059 1.092-11.494 3.276-3.303 2.184-6.012 5.387-8.126 9.609-1.982 4.076-2.972 9.099-2.972 15.067 0 5.969.99 11.138 2.972 15.505 2.114 4.222 4.823 7.425 8.126 9.609 3.435 2.183 7.266 3.275 11.494 3.275s7.994-1.092 11.297-3.275c3.435-2.184 6.143-5.387 8.125-9.609 2.114-4.367 3.171-9.536 3.171-15.505 0-5.968-1.057-10.991-3.171-15.067-1.906-4.06-4.483-7.177-7.732-9.352l-.393-.257c-3.303-2.184-7.069-3.276-11.297-3.276z"
24
+ />
25
+ <path
26
+ className="animate-draw"
27
+ d="M422.841 191.337l.084.337a27.857 27.857 0 002.057 5.559c2.246 4.222 5.417 7.498 9.513 9.827 4.096 2.184 8.984 3.276 14.665 3.276 5.285 0 9.777-.801 13.477-2.403 3.579-1.632 7.1-4.025 10.564-7.182l.732-.679 19.818 22.711c-5.153 6.26-11.494 11.064-19.025 14.413-7.531 3.203-16.449 4.804-26.755 4.804-12.683 0-23.782-2.621-33.294-7.862-9.381-5.386-16.713-12.665-21.998-21.837-5.153-9.317-7.729-19.872-7.729-31.665 0-11.792 2.51-22.274 7.53-31.446 5.036-9.105 11.902-16.195 20.596-21.268l.61-.351c8.984-5.241 19.091-7.861 30.322-7.861 10.311 0 19.743 2.286 28.294 6.859l.64.347c8.72 4.659 15.656 11.574 20.809 20.746 5.153 9.172 7.729 20.309 7.729 33.411 0 1.294-.052 2.761-.156 4.4l-.042.623-.17 2.353c-.075 1.01-.151 1.973-.227 2.888h-78.044zm21.365-42.147c-4.492 0-8.456 1.092-11.891 3.276-3.303 2.184-5.879 5.314-7.729 9.39a26.04 26.04 0 00-1.117 2.79 30.164 30.164 0 00-1.121 4.499l-.058.354h43.96l-.015-.106c-.401-2.638-1.122-5.055-2.163-7.252l-.246-.503c-1.776-3.774-4.282-6.742-7.519-8.906l-.409-.266c-3.303-2.184-7.2-3.276-11.692-3.276z"
28
+ />
29
+ <path
30
+ className="animate-draw"
31
+ d="M846.763 155.12c3.373 2.786 5.06 7.186 5.06 13.2v2.64h-17.38c-8.654 0-16.28.806-22.88 2.42-6.454 1.466-11.88 3.74-16.28 6.82-4.254 2.933-7.48 6.673-9.68 11.22-2.2 4.546-3.3 9.826-3.3 15.84 0 7.04 1.686 13.2 5.06 18.48 3.52 5.133 8.213 9.166 14.08 12.1 6.013 2.933 12.686 4.4 20.02 4.4 5.573 0 10.853-1.1 15.84-3.3 5.133-2.2 9.826-5.207 14.08-9.02l.44-.385v10.505h34.1V161.5c0-9.24-1.98-16.867-5.94-22.88-3.96-6.014-9.534-10.487-16.72-13.42-7.187-2.934-15.694-4.4-25.52-4.4-10.707 0-20.607 2.053-29.7 6.16-9.094 4.106-17.16 9.753-24.2 16.94l21.12 20.46c4.106-4.84 8.36-8.287 12.76-10.34 4.546-2.2 9.68-3.3 15.4-3.3 5.866 0 10.413 1.466 13.64 4.4zm5.06 52.071V193.18h-16.5c-3.08 0-5.794.293-8.14.88-2.347.44-4.327 1.246-5.94 2.42-1.614 1.026-2.86 2.273-3.74 3.74-.734 1.466-1.1 3.226-1.1 5.28 0 2.2.586 4.106 1.76 5.72 1.173 1.613 2.713 2.86 4.62 3.74 2.053.88 4.4 1.32 7.04 1.32 3.813 0 7.406-.587 10.78-1.76 3.52-1.32 6.6-3.154 9.24-5.5a29.32 29.32 0 001.98-1.829z"
32
+ />
33
+ <path
34
+ className="animate-draw"
35
+ d="M592.64 242c-11.587 0-22.293-1.907-32.12-5.72-9.68-3.96-18.113-9.46-25.3-16.5-7.04-7.187-12.54-15.62-16.5-25.3-3.813-9.827-5.72-20.534-5.72-32.12 0-11.44 1.98-22 5.94-31.68 4.107-9.68 9.827-18.114 17.16-25.3 7.333-7.187 15.913-12.76 25.74-16.72 9.973-3.96 20.753-5.94 32.34-5.94 7.333 0 14.52.953 21.56 2.86 7.04 1.906 13.567 4.766 19.58 8.58 6.16 3.666 11.44 8.14 15.84 13.42l-23.1 26.18c-4.547-4.987-9.68-8.874-15.4-11.66-5.573-2.787-11.807-4.18-18.7-4.18-5.867 0-11.44 1.026-16.72 3.08-5.133 2.053-9.607 5.06-13.42 9.02-3.813 3.96-6.82 8.653-9.02 14.08-2.2 5.426-3.3 11.586-3.3 18.48 0 6.746 1.027 12.906 3.08 18.48 2.2 5.426 5.28 10.12 9.24 14.08 4.107 3.813 8.947 6.746 14.52 8.8 5.72 2.053 12.027 3.08 18.92 3.08 4.547 0 8.873-.587 12.98-1.76a48.746 48.746 0 0011.88-5.5c3.667-2.347 6.82-4.987 9.46-7.92l18.26 29.04c-3.52 3.96-8.36 7.553-14.52 10.78-6.013 3.226-12.76 5.793-20.24 7.7a95.814 95.814 0 01-22.44 2.64z"
36
+ />
37
+ <path
38
+ className="animate-draw"
39
+ d="M942.281 202.6v-48.59h27.14V123.4h-27.14V92.8h-33.58v30.6h-16.79v30.61h16.79v48.36c0 26.526 13.263 39.79 39.79 39.79 9.66 0 17.327-1.227 23-3.68v-27.83c-4.753 3.066-10.197 4.6-16.33 4.6-3.833 0-6.977-1.074-9.43-3.22-2.3-2.147-3.45-5.29-3.45-9.43z"
40
+ />
41
+ </svg>
42
+ ));
43
+
44
+ export default LobeChatText;
@@ -0,0 +1,6 @@
1
+ import LobeChatText from './SVG';
2
+ import './style.css';
3
+
4
+ const LobeChatTextLoading = () => <LobeChatText size={40} />;
5
+
6
+ export default LobeChatTextLoading;
@@ -0,0 +1,32 @@
1
+ @keyframes draw {
2
+ 0% {
3
+ stroke-dashoffset: 1000;
4
+ }
5
+
6
+ 100% {
7
+ stroke-dashoffset: 0;
8
+ }
9
+ }
10
+
11
+ @keyframes fill {
12
+ 30% {
13
+ fill-opacity: 0%;
14
+ }
15
+
16
+ 100% {
17
+ fill-opacity: 100%;
18
+ }
19
+ }
20
+
21
+ .animate-draw {
22
+ fill: currentcolor;
23
+ fill-opacity: 0%;
24
+ stroke: currentcolor;
25
+ stroke-dasharray: 1000;
26
+ stroke-dashoffset: 1000;
27
+ stroke-width: 1.5;
28
+
29
+ animation:
30
+ draw 2s cubic-bezier(0.4, 0, 0.2, 1) infinite,
31
+ fill 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
32
+ }
@@ -0,0 +1,11 @@
1
+ import { Center } from 'react-layout-kit';
2
+
3
+ import LobeChatText from './LobeChatText';
4
+
5
+ export default () => {
6
+ return (
7
+ <Center height={'100%'} width={'100%'}>
8
+ <LobeChatText />
9
+ </Center>
10
+ );
11
+ };
@@ -15,7 +15,7 @@ const useStyles = createStyles(
15
15
  const SkeletonLoading = memo<SkeletonProps>(({ className, ...rest }) => {
16
16
  const { cx, styles } = useStyles();
17
17
 
18
- return <Skeleton className={cx(styles, className)} paragraph={{ rows: 8 }} {...rest} />;
18
+ return <Skeleton active className={cx(styles, className)} paragraph={{ rows: 8 }} {...rest} />;
19
19
  });
20
20
 
21
21
  export default SkeletonLoading;
@@ -0,0 +1,50 @@
1
+ 'use server';
2
+
3
+ import { Image } from '@lobehub/ui/mdx';
4
+ import Img from 'next/image';
5
+ import { getPlaiceholder } from 'plaiceholder';
6
+ import { FC } from 'react';
7
+
8
+ const DEFAULT_WIDTH = 800;
9
+
10
+ const fetchImage = async (url: string) => {
11
+ const buffer = await fetch(url, { cache: 'force-cache' }).then(async (res) =>
12
+ Buffer.from(await res.arrayBuffer()),
13
+ );
14
+ const {
15
+ base64,
16
+ metadata: { height, width },
17
+ } = await getPlaiceholder(buffer, { format: ['webp'] });
18
+ return {
19
+ base64,
20
+ height: (DEFAULT_WIDTH / width) * height,
21
+ };
22
+ };
23
+
24
+ const ImageWrapper: FC<{ alt: string; src: string }> = async ({ alt, src, ...rest }) => {
25
+ try {
26
+ const { base64, height } = await fetchImage(src);
27
+ return (
28
+ <Image
29
+ alt={alt}
30
+ height={height}
31
+ // @ts-ignore
32
+ placeholder={
33
+ <Img
34
+ alt={alt}
35
+ height={height}
36
+ src={base64}
37
+ style={{ filter: 'blur(24px)', scale: 1.2 }}
38
+ width={DEFAULT_WIDTH}
39
+ />
40
+ }
41
+ src={src}
42
+ width={DEFAULT_WIDTH}
43
+ />
44
+ );
45
+ } catch {
46
+ return <Image alt={alt} src={src} {...rest} />;
47
+ }
48
+ };
49
+
50
+ export default ImageWrapper;
@@ -5,6 +5,7 @@ import { FC } from 'react';
5
5
  import remarkGfm from 'remark-gfm';
6
6
 
7
7
  import CodeBlock from './CodeBlock';
8
+ import Image from './Image';
8
9
  import Link from './Link';
9
10
 
10
11
  export const Typography = ({
@@ -31,6 +32,7 @@ export const CustomMDX: FC<MDXRemoteProps & { mobile?: boolean }> = ({ mobile, .
31
32
  const list: any = {};
32
33
  Object.entries({
33
34
  ...mdxComponents,
35
+ Image: Image,
34
36
  a: Link,
35
37
  pre: CodeBlock,
36
38
  ...rest.components,
package/src/const/url.ts CHANGED
@@ -73,3 +73,4 @@ export const mailTo = (email: string) => `mailto:${email}`;
73
73
  export const AES_GCM_URL = 'https://datatracker.ietf.org/doc/html/draft-ietf-avt-srtp-aes-gcm-01';
74
74
  export const BASE_PROVIDER_DOC_URL = 'https://lobehub.com/docs/usage/providers';
75
75
  export const SITEMAP_BASE_URL = isDev ? '/sitemap.xml/' : 'sitemap';
76
+ export const CHANGELOG_URL = urlJoin(OFFICIAL_SITE, 'changelog/versions');
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+
3
+ import { useTimeout } from 'ahooks';
4
+ import { useRouter } from 'next/navigation';
5
+ import { memo } from 'react';
6
+
7
+ import { useGlobalStore } from '@/store/global';
8
+
9
+ const ChangelogModal = memo<{ currentId?: string }>(({ currentId }) => {
10
+ const latestChangelogId = useGlobalStore((s) => s.status.latestChangelogId);
11
+ const router = useRouter();
12
+
13
+ useTimeout(() => {
14
+ if (latestChangelogId !== currentId) {
15
+ router.push('/changelog/modal');
16
+ }
17
+ }, 1000);
18
+
19
+ return null;
20
+ });
21
+
22
+ export default ChangelogModal;
@@ -4,7 +4,7 @@ import { createStyles } from 'antd-style';
4
4
  import React from 'react';
5
5
  import { Center, Flexbox } from 'react-layout-kit';
6
6
 
7
- import CircleLoading from '@/components/CircleLoading';
7
+ import CircleLoading from '@/components/Loading/CircleLoading';
8
8
 
9
9
  const useStyles = createStyles(({ css, token }) => ({
10
10
  page: css`
@@ -5,7 +5,7 @@ import { useState } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import { Flexbox } from 'react-layout-kit';
7
7
 
8
- import Loading from '@/components/CircleLoading';
8
+ import Loading from '@/components/Loading/CircleLoading';
9
9
  import FileViewer from '@/features/FileViewer';
10
10
  import { useChatStore } from '@/store/chat';
11
11
  import { chatPortalSelectors } from '@/store/chat/selectors';
@@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next';
7
7
  import { Center, Flexbox } from 'react-layout-kit';
8
8
  import Balancer from 'react-wrap-balancer';
9
9
 
10
- import SkeletonLoading from '@/components/SkeletonLoading';
10
+ import SkeletonLoading from '@/components/Loading/SkeletonLoading';
11
11
  import { useChatStore } from '@/store/chat';
12
12
  import { chatSelectors } from '@/store/chat/selectors';
13
13
 
@@ -32,7 +32,7 @@ const Footer = memo<PropsWithChildren>(() => {
32
32
 
33
33
  return hideGitHub ? null : (
34
34
  <>
35
- <Flexbox flex={1} justify={'flex-end'}>
35
+ <Flexbox justify={'flex-end'}>
36
36
  <Center
37
37
  as={'footer'}
38
38
  className={styles}
@@ -98,4 +98,6 @@ const Footer = memo<PropsWithChildren>(() => {
98
98
  );
99
99
  });
100
100
 
101
+ Footer.displayName = 'SettingFooter';
102
+
101
103
  export default Footer;
@@ -33,6 +33,7 @@ const SettingContainer = memo<PropsWithChildren<SettingContainerProps>>(
33
33
  >
34
34
  {addonBefore}
35
35
  <Flexbox
36
+ flex={1}
36
37
  gap={64}
37
38
  paddingInline={mobile ? undefined : 24}
38
39
  style={{