@lobehub/chat 0.79.3 → 0.79.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 (156) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +13 -7
  3. package/README.zh-CN.md +13 -7
  4. package/docs/Deploy-with-Azure-OpenAI.md +14 -10
  5. package/docs/Environment-Variable.md +109 -0
  6. package/docs/Environment-Variable.zh-CN.md +109 -0
  7. package/docs/Home.md +1 -0
  8. package/docs/_Sidebar.md +1 -0
  9. package/locales/en_US/common.json +1 -1
  10. package/locales/ru_RU/common.json +1 -1
  11. package/locales/zh_CN/common.json +1 -1
  12. package/locales/zh_TW/common.json +1 -1
  13. package/next.config.mjs +8 -6
  14. package/package.json +5 -6
  15. package/src/{pages → app}/chat/features/Header/Desktop.tsx +2 -1
  16. package/src/{pages → app}/chat/features/Header/Mobile.tsx +3 -2
  17. package/src/{pages → app}/chat/index.tsx +1 -1
  18. package/src/{pages → app}/chat/mobile/index.tsx +1 -1
  19. package/src/app/chat/{page.page.tsx → mobile/page.tsx} +1 -1
  20. package/src/app/{page.page.tsx → chat/page.tsx} +1 -1
  21. package/src/{pages/chat/setting → app/chat/settings}/features/Header/Desktop.tsx +3 -1
  22. package/src/{pages/chat/setting → app/chat/settings}/features/Header/Mobile.tsx +3 -1
  23. package/src/{pages/chat/setting → app/chat/settings}/index.tsx +1 -1
  24. package/src/{pages/chat/setting/layout.tsx → app/chat/settings/layout.pc.tsx} +1 -1
  25. package/src/app/{market/page.page.tsx → chat/settings/page.tsx} +1 -1
  26. package/src/{pages → app}/home/index.tsx +1 -1
  27. package/src/app/{layout.page.tsx → layout.tsx} +1 -1
  28. package/src/{pages → app}/market/features/SideBar/AgentInfo/index.tsx +1 -1
  29. package/src/{pages → app}/market/index.tsx +1 -1
  30. package/src/{pages → app}/market/layout.mobile.tsx +1 -1
  31. package/src/app/{welcome/page.page.tsx → market/page.tsx} +1 -1
  32. package/src/app/page.tsx +7 -0
  33. package/src/{pages → app}/settings/index.tsx +1 -1
  34. package/src/app/settings/page.tsx +7 -0
  35. package/src/{pages → app}/welcome/index.tsx +1 -1
  36. package/src/app/welcome/page.tsx +7 -0
  37. package/src/components/Analytics/index.tsx +7 -0
  38. package/src/features/MobileTabBar/index.tsx +1 -1
  39. package/src/locales/default/common.ts +1 -1
  40. package/src/store/session/slices/session/initialState.ts +1 -1
  41. package/src/utils/url.test.ts +51 -0
  42. package/src/utils/url.ts +23 -0
  43. package/.github/dependabot.yml +0 -17
  44. package/src/app/chat/mobile/page.page.tsx +0 -7
  45. package/src/app/chat/settings/page.page.tsx +0 -7
  46. package/src/app/settings/page.page.tsx +0 -7
  47. /package/src/{pages → app}/chat/features/Conversation/ChatList/Error/ApiKeyForm.tsx +0 -0
  48. /package/src/{pages → app}/chat/features/Conversation/ChatList/Error/ErrorActionContainer.tsx +0 -0
  49. /package/src/{pages → app}/chat/features/Conversation/ChatList/Error/InvalidAccess.tsx +0 -0
  50. /package/src/{pages → app}/chat/features/Conversation/ChatList/Error/OpenAiBizError.tsx +0 -0
  51. /package/src/{pages → app}/chat/features/Conversation/ChatList/Error/Plugin/PluginError.tsx +0 -0
  52. /package/src/{pages → app}/chat/features/Conversation/ChatList/Error/Plugin/PluginSettings.tsx +0 -0
  53. /package/src/{pages → app}/chat/features/Conversation/ChatList/Error/index.tsx +0 -0
  54. /package/src/{pages → app}/chat/features/Conversation/ChatList/Error/style.tsx +0 -0
  55. /package/src/{pages → app}/chat/features/Conversation/ChatList/MessageExtra.tsx +0 -0
  56. /package/src/{pages → app}/chat/features/Conversation/ChatList/OTPInput.tsx +0 -0
  57. /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/FunctionCall.tsx +0 -0
  58. /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/IFrameRender/hooks.ts +0 -0
  59. /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/IFrameRender/index.tsx +0 -0
  60. /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/IFrameRender/utils.ts +0 -0
  61. /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/PluginMessage.tsx +0 -0
  62. /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/PluginResultRender.tsx +0 -0
  63. /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/SystemJsRender/index.tsx +0 -0
  64. /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/SystemJsRender/utils.ts +0 -0
  65. /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/style.ts +0 -0
  66. /package/src/{pages → app}/chat/features/Conversation/ChatList/SkeletonList.tsx +0 -0
  67. /package/src/{pages → app}/chat/features/Conversation/ChatList/index.tsx +0 -0
  68. /package/src/{pages → app}/chat/features/Conversation/Input/ActionBar/ActionLeft.tsx +0 -0
  69. /package/src/{pages → app}/chat/features/Conversation/Input/ActionBar/ActionRight.tsx +0 -0
  70. /package/src/{pages → app}/chat/features/Conversation/Input/ActionBar/Token.tsx +0 -0
  71. /package/src/{pages → app}/chat/features/Conversation/Input/Desktop.tsx +0 -0
  72. /package/src/{pages → app}/chat/features/Conversation/Input/Footer/SaveTopic.tsx +0 -0
  73. /package/src/{pages → app}/chat/features/Conversation/Input/Footer/index.tsx +0 -0
  74. /package/src/{pages → app}/chat/features/Conversation/Input/Mobile.tsx +0 -0
  75. /package/src/{pages → app}/chat/features/Conversation/Input/index.tsx +0 -0
  76. /package/src/{pages → app}/chat/features/Conversation/ScrollAnchor/index.tsx +0 -0
  77. /package/src/{pages → app}/chat/features/Conversation/ScrollAnchor/useAtBottom.ts +0 -0
  78. /package/src/{pages → app}/chat/features/Conversation/index.tsx +0 -0
  79. /package/src/{pages → app}/chat/features/Header/PluginTag/PluginStatus.tsx +0 -0
  80. /package/src/{pages → app}/chat/features/Header/PluginTag/index.tsx +0 -0
  81. /package/src/{pages → app}/chat/features/Header/ShareButton/index.tsx +0 -0
  82. /package/src/{pages → app}/chat/features/Header/index.tsx +0 -0
  83. /package/src/{pages → app}/chat/features/SessionList/CollapseGroup/index.tsx +0 -0
  84. /package/src/{pages → app}/chat/features/SessionList/Desktop.tsx +0 -0
  85. /package/src/{pages → app}/chat/features/SessionList/Header/Desktop.tsx +0 -0
  86. /package/src/{pages → app}/chat/features/SessionList/Header/Mobile.tsx +0 -0
  87. /package/src/{pages → app}/chat/features/SessionList/Header/index.tsx +0 -0
  88. /package/src/{pages → app}/chat/features/SessionList/Inbox/index.tsx +0 -0
  89. /package/src/{pages → app}/chat/features/SessionList/List/AddButton.tsx +0 -0
  90. /package/src/{pages → app}/chat/features/SessionList/List/Item/Actions.tsx +0 -0
  91. /package/src/{pages → app}/chat/features/SessionList/List/Item/index.tsx +0 -0
  92. /package/src/{pages → app}/chat/features/SessionList/List/SkeletonList.tsx +0 -0
  93. /package/src/{pages → app}/chat/features/SessionList/List/index.tsx +0 -0
  94. /package/src/{pages → app}/chat/features/SessionList/Mobile.tsx +0 -0
  95. /package/src/{pages → app}/chat/features/SessionList/index.tsx +0 -0
  96. /package/src/{pages → app}/chat/features/SessionSearchBar/index.tsx +0 -0
  97. /package/src/{pages → app}/chat/features/Sidebar/Desktop.tsx +0 -0
  98. /package/src/{pages → app}/chat/features/Sidebar/Mobile.tsx +0 -0
  99. /package/src/{pages → app}/chat/features/Sidebar/SystemRole/Header.tsx +0 -0
  100. /package/src/{pages → app}/chat/features/Sidebar/SystemRole/index.tsx +0 -0
  101. /package/src/{pages → app}/chat/features/Sidebar/SystemRole/style.ts +0 -0
  102. /package/src/{pages → app}/chat/features/Sidebar/Topic/DefaultContent.tsx +0 -0
  103. /package/src/{pages → app}/chat/features/Sidebar/Topic/SkeletonList.tsx +0 -0
  104. /package/src/{pages → app}/chat/features/Sidebar/Topic/TopicContent.tsx +0 -0
  105. /package/src/{pages → app}/chat/features/Sidebar/Topic/TopicItem.tsx +0 -0
  106. /package/src/{pages → app}/chat/features/Sidebar/Topic/index.tsx +0 -0
  107. /package/src/{pages → app}/chat/features/Sidebar/TopicSearchBar/index.tsx +0 -0
  108. /package/src/{pages → app}/chat/features/Sidebar/index.tsx +0 -0
  109. /package/src/{pages → app}/chat/layout.mobile.tsx +0 -0
  110. /package/src/{pages/chat/layout.tsx → app/chat/layout.pc.tsx} +0 -0
  111. /package/src/{pages/chat/setting → app/chat/settings}/features/Header/index.tsx +0 -0
  112. /package/src/{pages/chat/setting → app/chat/settings}/layout.mobile.tsx +0 -0
  113. /package/src/{pages → app}/home/Loading.tsx +0 -0
  114. /package/src/{pages → app}/market/features/AgentCard/AgentCardBanner.tsx +0 -0
  115. /package/src/{pages → app}/market/features/AgentCard/AgentCardItem.tsx +0 -0
  116. /package/src/{pages → app}/market/features/AgentCard/Loading.tsx +0 -0
  117. /package/src/{pages → app}/market/features/AgentCard/index.tsx +0 -0
  118. /package/src/{pages → app}/market/features/AgentCard/style.ts +0 -0
  119. /package/src/{pages → app}/market/features/AgentSearchBar/index.tsx +0 -0
  120. /package/src/{pages → app}/market/features/Header/Desktop.tsx +0 -0
  121. /package/src/{pages → app}/market/features/Header/Mobile.tsx +0 -0
  122. /package/src/{pages → app}/market/features/Header/index.tsx +0 -0
  123. /package/src/{pages → app}/market/features/SideBar/AgentInfo/Comment.tsx +0 -0
  124. /package/src/{pages → app}/market/features/SideBar/AgentInfo/Header.tsx +0 -0
  125. /package/src/{pages → app}/market/features/SideBar/AgentInfo/Loading.tsx +0 -0
  126. /package/src/{pages → app}/market/features/SideBar/AgentInfo/TokenTag.tsx +0 -0
  127. /package/src/{pages → app}/market/features/SideBar/AgentInfo/style.ts +0 -0
  128. /package/src/{pages → app}/market/features/SideBar/Desktop.tsx +0 -0
  129. /package/src/{pages → app}/market/features/SideBar/Mobile.tsx +0 -0
  130. /package/src/{pages → app}/market/features/SideBar/index.tsx +0 -0
  131. /package/src/{pages → app}/market/features/TagList/index.tsx +0 -0
  132. /package/src/{pages/market/layout.tsx → app/market/layout.pc.tsx} +0 -0
  133. /package/src/{pages → app}/settings/features/Banner/index.tsx +0 -0
  134. /package/src/{pages → app}/settings/features/Header/Desktop.tsx +0 -0
  135. /package/src/{pages → app}/settings/features/Header/Mobile.tsx +0 -0
  136. /package/src/{pages → app}/settings/features/Header/index.tsx +0 -0
  137. /package/src/{pages → app}/settings/features/Settings/Agent.tsx +0 -0
  138. /package/src/{pages → app}/settings/features/Settings/Common.tsx +0 -0
  139. /package/src/{pages → app}/settings/features/Settings/LLM/Checker.tsx +0 -0
  140. /package/src/{pages → app}/settings/features/Settings/LLM/ModelList.tsx +0 -0
  141. /package/src/{pages → app}/settings/features/Settings/LLM/getModelList.ts +0 -0
  142. /package/src/{pages → app}/settings/features/Settings/LLM/index.tsx +0 -0
  143. /package/src/{pages → app}/settings/features/Settings/index.tsx +0 -0
  144. /package/src/{pages → app}/settings/features/ThemeSwatches/ThemeSwatchesNeutral.tsx +0 -0
  145. /package/src/{pages → app}/settings/features/ThemeSwatches/ThemeSwatchesPrimary.tsx +0 -0
  146. /package/src/{pages → app}/settings/features/ThemeSwatches/index.ts +0 -0
  147. /package/src/{pages → app}/settings/layout.mobile.tsx +0 -0
  148. /package/src/{pages/settings/layout.tsx → app/settings/layout.pc.tsx} +0 -0
  149. /package/src/{pages → app}/welcome/features/Banner/AgentCard.tsx +0 -0
  150. /package/src/{pages → app}/welcome/features/Banner/AgentTemplate.tsx +0 -0
  151. /package/src/{pages → app}/welcome/features/Banner/Hero.tsx +0 -0
  152. /package/src/{pages → app}/welcome/features/Banner/index.tsx +0 -0
  153. /package/src/{pages → app}/welcome/features/Banner/style.ts +0 -0
  154. /package/src/{pages → app}/welcome/features/Footer/index.tsx +0 -0
  155. /package/src/{pages → app}/welcome/layout.mobile.tsx +0 -0
  156. /package/src/{pages/welcome/layout.tsx → app/welcome/layout.pc.tsx} +0 -0
@@ -5,12 +5,12 @@ import { memo } from 'react';
5
5
  import { Flexbox } from 'react-layout-kit';
6
6
 
7
7
  import AppMobileLayout from '@/layout/AppMobileLayout';
8
- import Header from '@/pages/chat/features/Header';
9
8
  import { useSessionStore } from '@/store/session';
10
9
  import { agentSelectors } from '@/store/session/selectors';
11
10
  import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';
12
11
 
13
12
  import Conversation from '../features/Conversation';
13
+ import Header from '../features/Header';
14
14
  import SideBar from '../features/Sidebar';
15
15
 
16
16
  const Chat = memo(() => {
@@ -1,4 +1,4 @@
1
- import Page from '@/pages/chat';
1
+ import Page from './index';
2
2
 
3
3
  const Index = () => {
4
4
  return <Page />;
@@ -1,4 +1,4 @@
1
- import Page from '@/pages/home';
1
+ import Page from './index';
2
2
 
3
3
  const Index = () => {
4
4
  return <Page />;
@@ -3,6 +3,8 @@ import { useRouter } from 'next/navigation';
3
3
  import { ReactNode, memo } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
5
 
6
+ import { pathString } from '@/utils/url';
7
+
6
8
  const Header = memo<{ children: ReactNode }>(({ children }) => {
7
9
  const { t } = useTranslation('setting');
8
10
  const router = useRouter();
@@ -10,7 +12,7 @@ const Header = memo<{ children: ReactNode }>(({ children }) => {
10
12
  return (
11
13
  <ChatHeader
12
14
  left={<ChatHeaderTitle title={t('header.session')} />}
13
- onBackClick={() => router.push('/chat', { hash: location.hash })}
15
+ onBackClick={() => router.push(pathString('/chat', { hash: location.hash }))}
14
16
  right={children}
15
17
  showBackButton
16
18
  />
@@ -3,6 +3,8 @@ import { useRouter } from 'next/navigation';
3
3
  import { type ReactNode, memo } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
5
 
6
+ import { pathString } from '@/utils/url';
7
+
6
8
  const Header = memo<{ children: ReactNode }>(({ children }) => {
7
9
  const { t } = useTranslation('setting');
8
10
  const router = useRouter();
@@ -10,7 +12,7 @@ const Header = memo<{ children: ReactNode }>(({ children }) => {
10
12
  return (
11
13
  <MobileNavBar
12
14
  center={<MobileNavBarTitle title={t('header.session')} />}
13
- onBackClick={() => router.push('/chat/mobile', { hash: location.hash })}
15
+ onBackClick={() => router.push(pathString('/chat/mobile', { hash: location.hash }))}
14
16
  right={children}
15
17
  showBackButton
16
18
  />
@@ -11,8 +11,8 @@ import { useSessionStore } from '@/store/session';
11
11
  import { agentSelectors } from '@/store/session/selectors';
12
12
  import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';
13
13
 
14
- import DesktopLayout from './layout';
15
14
  import MobileLayout from './layout.mobile';
15
+ import DesktopLayout from './layout.pc';
16
16
 
17
17
  const EditPage = memo(() => {
18
18
  const { mobile } = useResponsive();
@@ -4,7 +4,7 @@ import { Flexbox } from 'react-layout-kit';
4
4
  import SafeSpacing from '@/components/SafeSpacing';
5
5
  import { HEADER_HEIGHT } from '@/const/layoutTokens';
6
6
 
7
- import ChatLayout from '../layout';
7
+ import ChatLayout from '../layout.pc';
8
8
  import Header from './features/Header';
9
9
 
10
10
  const DesktopLayout = memo<PropsWithChildren>(({ children }) => {
@@ -1,4 +1,4 @@
1
- import Page from '@/pages/market';
1
+ import Page from './index';
2
2
 
3
3
  const Index = () => {
4
4
  return <Page />;
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { memo } from 'react';
4
4
 
5
- import Loading from '@/pages/home/Loading';
6
5
  import {
7
6
  useEffectAfterSessionHydrated,
8
7
  useSessionHydrated,
@@ -11,6 +10,7 @@ import {
11
10
  import { sessionSelectors } from '@/store/session/selectors';
12
11
 
13
12
  import Welcome from '../welcome';
13
+ import Loading from './Loading';
14
14
 
15
15
  const Home = memo(() => {
16
16
  const hydrated = useSessionHydrated();
@@ -1,7 +1,7 @@
1
- import { Analytics } from '@vercel/analytics/react';
2
1
  import { cookies } from 'next/headers';
3
2
  import { PropsWithChildren } from 'react';
4
3
 
4
+ import Analytics from '@/components/Analytics';
5
5
  import {
6
6
  LOBE_THEME_APPEARANCE,
7
7
  LOBE_THEME_NEUTRAL_COLOR,
@@ -3,13 +3,13 @@ import { memo, useState } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { Flexbox } from 'react-layout-kit';
5
5
 
6
- import TokenTag from '@/pages/market/features/SideBar/AgentInfo/TokenTag';
7
6
  import { useMarketStore } from '@/store/market';
8
7
 
9
8
  import AgentCardBanner from '../../AgentCard/AgentCardBanner';
10
9
  import Comment from './Comment';
11
10
  import Header from './Header';
12
11
  import Loading from './Loading';
12
+ import TokenTag from './TokenTag';
13
13
  import { useStyles } from './style';
14
14
 
15
15
  enum InfoTabs {
@@ -10,8 +10,8 @@ import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';
10
10
 
11
11
  import AgentCard from './features/AgentCard';
12
12
  import AgentSearchBar from './features/AgentSearchBar';
13
- import DesktopLayout from './layout';
14
13
  import MobileLayout from './layout.mobile';
14
+ import DesktopLayout from './layout.pc';
15
15
 
16
16
  const Market = memo(() => {
17
17
  const { t } = useTranslation('common');
@@ -2,10 +2,10 @@ import { ReactNode, memo } from 'react';
2
2
  import { Flexbox } from 'react-layout-kit';
3
3
 
4
4
  import AppMobileLayout from '@/layout/AppMobileLayout';
5
- import SideBar from '@/pages/market/features/SideBar';
6
5
  import { useSwitchSideBarOnInit } from '@/store/global';
7
6
 
8
7
  import Header from './features/Header';
8
+ import SideBar from './features/SideBar';
9
9
 
10
10
  const MarketLayout = memo<{ children: ReactNode }>(({ children }) => {
11
11
  useSwitchSideBarOnInit('market');
@@ -1,4 +1,4 @@
1
- import Page from '@/pages/welcome';
1
+ import Page from './index';
2
2
 
3
3
  const Index = () => {
4
4
  return <Page />;
@@ -0,0 +1,7 @@
1
+ import Page from './home';
2
+
3
+ const Index = () => {
4
+ return <Page />;
5
+ };
6
+
7
+ export default Index;
@@ -9,8 +9,8 @@ import { useSwitchSideBarOnInit } from '@/store/global';
9
9
  import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';
10
10
 
11
11
  import Settings from './features/Settings';
12
- import DesktopLayout from './layout';
13
12
  import MobileLayout from './layout.mobile';
13
+ import DesktopLayout from './layout.pc';
14
14
 
15
15
  const Setting = memo(() => {
16
16
  const { mobile } = useResponsive();
@@ -0,0 +1,7 @@
1
+ import Page from './index';
2
+
3
+ const Index = () => {
4
+ return <Page />;
5
+ };
6
+
7
+ export default Index;
@@ -9,8 +9,8 @@ import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';
9
9
 
10
10
  import Banner from './features/Banner';
11
11
  import Footer from './features/Footer';
12
- import Layout from './layout';
13
12
  import Mobile from './layout.mobile';
13
+ import Layout from './layout.pc';
14
14
 
15
15
  const Welcome = memo(() => {
16
16
  const { mobile } = useResponsive();
@@ -0,0 +1,7 @@
1
+ import Page from './index';
2
+
3
+ const Index = () => {
4
+ return <Page />;
5
+ };
6
+
7
+ export default Index;
@@ -0,0 +1,7 @@
1
+ import { Analytics as VercelAnalytics } from '@vercel/analytics/react';
2
+
3
+ const Analytics = () => {
4
+ return <VercelAnalytics />;
5
+ };
6
+
7
+ export default Analytics;
@@ -37,7 +37,7 @@ export default memo<{ className?: string }>(({ className }) => {
37
37
  icon: (active) => <Icon className={active ? styles.active : undefined} icon={Bot} />,
38
38
  key: 'market',
39
39
  onClick: () => {
40
- router.push('/market', { hash: '' });
40
+ router.push('/market');
41
41
  },
42
42
  title: t('tab.market'),
43
43
  },
@@ -2,7 +2,7 @@ export default {
2
2
  about: '关于',
3
3
  advanceSettings: '高级设置',
4
4
  agentDefaultMessage:
5
- '你好,我是 **{{name}}**,你可以立即与我开始对话,也可以前往 [助手设置](/chat/setting#session={{id}}) 完善我的信息。',
5
+ '你好,我是 **{{name}}**,你可以立即与我开始对话,也可以前往 [助手设置](/chat/settings#session={{id}}) 完善我的信息。',
6
6
  agentDefaultMessageWithSystemRole: '你好,我是 **{{name}}**,{{systemRole}},让我们开始对话吧!',
7
7
  agentMaxToken: '会话最大长度',
8
8
  agentModel: '模型',
@@ -1,5 +1,5 @@
1
1
  import { merge } from 'lodash-es';
2
- import { AppRouterInstance } from 'next/dist/shared/lib/app-router-context';
2
+ import { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime';
3
3
 
4
4
  import { DEFAULT_AGENT_META, DEFAULT_INBOX_AVATAR } from '@/const/meta';
5
5
  import { LobeAgentConfig, LobeAgentSession, LobeSessionType } from '@/types/session';
@@ -0,0 +1,51 @@
1
+ import { pathString } from './url';
2
+
3
+ describe('pathString', () => {
4
+ it('基本情况', () => {
5
+ const result = pathString('/home');
6
+ expect(result).toBe('/home');
7
+ });
8
+
9
+ it('包含查询参数的情况', () => {
10
+ const result = pathString('/home', { search: 'id=1&name=test' });
11
+ expect(result).toBe('/home?id=1&name=test');
12
+ });
13
+
14
+ it('包含哈希值的情况', () => {
15
+ const result = pathString('/home', { hash: 'top' });
16
+ expect(result).toBe('/home#top');
17
+
18
+ const result2 = pathString('/home', { hash: '#hash=abc' });
19
+ expect(result2).toBe('/home#hash=abc');
20
+ });
21
+
22
+ it('path 参数包含相对路径的情况', () => {
23
+ const result = pathString('./home');
24
+ expect(result).toBe('/home');
25
+ });
26
+
27
+ it('path 参数包含绝对路径的情况', () => {
28
+ const result = pathString('/home');
29
+ expect(result).toBe('/home');
30
+ });
31
+
32
+ it('path 参数包含协议的情况', () => {
33
+ const result = pathString('https://www.example.com/home');
34
+ expect(result).toBe('https://www.example.com/home');
35
+ });
36
+
37
+ it('path 参数包含主机名的情况', () => {
38
+ const result = pathString('//www.example.com/home');
39
+ expect(result).toBe('https://www.example.com/home');
40
+ });
41
+
42
+ it('path 参数包含端口号的情况', () => {
43
+ const result = pathString('//www.example.com:8080/home');
44
+ expect(result).toBe('https://www.example.com:8080/home');
45
+ });
46
+
47
+ it('path 参数包含特殊字符的情况', () => {
48
+ const result = pathString('/home/测试');
49
+ expect(result).toBe('/home/%E6%B5%8B%E8%AF%95');
50
+ });
51
+ });
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Build a path string from a path and a hash/search object
3
+ * @param path
4
+ * @param hash
5
+ * @param search
6
+ */
7
+ export const pathString = (
8
+ path: string,
9
+ {
10
+ hash = '',
11
+ search = '',
12
+ }: {
13
+ hash?: string;
14
+ search?: string;
15
+ } = {},
16
+ ) => {
17
+ const tempBase = 'https://a.com';
18
+ const url = new URL(path, tempBase);
19
+
20
+ if (hash) url.hash = hash;
21
+ if (search) url.search = search;
22
+ return url.toString().replace(tempBase, '');
23
+ };
@@ -1,17 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: npm
4
- directory: '/'
5
- schedule:
6
- interval: weekly
7
- time: '19:00'
8
- timezone: 'Asia/Shanghai'
9
- open-pull-requests-limit: 10
10
- versioning-strategy: increase
11
-
12
- - package-ecosystem: 'github-actions'
13
- directory: '/'
14
- schedule:
15
- interval: monthly
16
- time: '19:00'
17
- timezone: 'Asia/Shanghai'
@@ -1,7 +0,0 @@
1
- import Page from '@/pages/chat/mobile';
2
-
3
- const Index = () => {
4
- return <Page />;
5
- };
6
-
7
- export default Index;
@@ -1,7 +0,0 @@
1
- import Page from '@/pages/chat/setting';
2
-
3
- const Index = () => {
4
- return <Page />;
5
- };
6
-
7
- export default Index;
@@ -1,7 +0,0 @@
1
- import Page from '@/pages/settings';
2
-
3
- const Index = () => {
4
- return <Page />;
5
- };
6
-
7
- export default Index;
File without changes
File without changes