@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.
- package/CHANGELOG.md +50 -0
- package/README.md +13 -7
- package/README.zh-CN.md +13 -7
- package/docs/Deploy-with-Azure-OpenAI.md +14 -10
- package/docs/Environment-Variable.md +109 -0
- package/docs/Environment-Variable.zh-CN.md +109 -0
- package/docs/Home.md +1 -0
- package/docs/_Sidebar.md +1 -0
- package/locales/en_US/common.json +1 -1
- package/locales/ru_RU/common.json +1 -1
- package/locales/zh_CN/common.json +1 -1
- package/locales/zh_TW/common.json +1 -1
- package/next.config.mjs +8 -6
- package/package.json +5 -6
- package/src/{pages → app}/chat/features/Header/Desktop.tsx +2 -1
- package/src/{pages → app}/chat/features/Header/Mobile.tsx +3 -2
- package/src/{pages → app}/chat/index.tsx +1 -1
- package/src/{pages → app}/chat/mobile/index.tsx +1 -1
- package/src/app/chat/{page.page.tsx → mobile/page.tsx} +1 -1
- package/src/app/{page.page.tsx → chat/page.tsx} +1 -1
- package/src/{pages/chat/setting → app/chat/settings}/features/Header/Desktop.tsx +3 -1
- package/src/{pages/chat/setting → app/chat/settings}/features/Header/Mobile.tsx +3 -1
- package/src/{pages/chat/setting → app/chat/settings}/index.tsx +1 -1
- package/src/{pages/chat/setting/layout.tsx → app/chat/settings/layout.pc.tsx} +1 -1
- package/src/app/{market/page.page.tsx → chat/settings/page.tsx} +1 -1
- package/src/{pages → app}/home/index.tsx +1 -1
- package/src/app/{layout.page.tsx → layout.tsx} +1 -1
- package/src/{pages → app}/market/features/SideBar/AgentInfo/index.tsx +1 -1
- package/src/{pages → app}/market/index.tsx +1 -1
- package/src/{pages → app}/market/layout.mobile.tsx +1 -1
- package/src/app/{welcome/page.page.tsx → market/page.tsx} +1 -1
- package/src/app/page.tsx +7 -0
- package/src/{pages → app}/settings/index.tsx +1 -1
- package/src/app/settings/page.tsx +7 -0
- package/src/{pages → app}/welcome/index.tsx +1 -1
- package/src/app/welcome/page.tsx +7 -0
- package/src/components/Analytics/index.tsx +7 -0
- package/src/features/MobileTabBar/index.tsx +1 -1
- package/src/locales/default/common.ts +1 -1
- package/src/store/session/slices/session/initialState.ts +1 -1
- package/src/utils/url.test.ts +51 -0
- package/src/utils/url.ts +23 -0
- package/.github/dependabot.yml +0 -17
- package/src/app/chat/mobile/page.page.tsx +0 -7
- package/src/app/chat/settings/page.page.tsx +0 -7
- package/src/app/settings/page.page.tsx +0 -7
- /package/src/{pages → app}/chat/features/Conversation/ChatList/Error/ApiKeyForm.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/Error/ErrorActionContainer.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/Error/InvalidAccess.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/Error/OpenAiBizError.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/Error/Plugin/PluginError.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/Error/Plugin/PluginSettings.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/Error/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/Error/style.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/MessageExtra.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/OTPInput.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/FunctionCall.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/IFrameRender/hooks.ts +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/IFrameRender/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/IFrameRender/utils.ts +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/PluginMessage.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/PluginResultRender.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/SystemJsRender/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/SystemJsRender/utils.ts +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/style.ts +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/SkeletonList.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ChatList/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/Input/ActionBar/ActionLeft.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/Input/ActionBar/ActionRight.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/Input/ActionBar/Token.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/Input/Desktop.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/Input/Footer/SaveTopic.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/Input/Footer/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/Input/Mobile.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/Input/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ScrollAnchor/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/Conversation/ScrollAnchor/useAtBottom.ts +0 -0
- /package/src/{pages → app}/chat/features/Conversation/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/Header/PluginTag/PluginStatus.tsx +0 -0
- /package/src/{pages → app}/chat/features/Header/PluginTag/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/Header/ShareButton/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/Header/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/SessionList/CollapseGroup/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/SessionList/Desktop.tsx +0 -0
- /package/src/{pages → app}/chat/features/SessionList/Header/Desktop.tsx +0 -0
- /package/src/{pages → app}/chat/features/SessionList/Header/Mobile.tsx +0 -0
- /package/src/{pages → app}/chat/features/SessionList/Header/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/SessionList/Inbox/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/SessionList/List/AddButton.tsx +0 -0
- /package/src/{pages → app}/chat/features/SessionList/List/Item/Actions.tsx +0 -0
- /package/src/{pages → app}/chat/features/SessionList/List/Item/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/SessionList/List/SkeletonList.tsx +0 -0
- /package/src/{pages → app}/chat/features/SessionList/List/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/SessionList/Mobile.tsx +0 -0
- /package/src/{pages → app}/chat/features/SessionList/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/SessionSearchBar/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/Sidebar/Desktop.tsx +0 -0
- /package/src/{pages → app}/chat/features/Sidebar/Mobile.tsx +0 -0
- /package/src/{pages → app}/chat/features/Sidebar/SystemRole/Header.tsx +0 -0
- /package/src/{pages → app}/chat/features/Sidebar/SystemRole/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/Sidebar/SystemRole/style.ts +0 -0
- /package/src/{pages → app}/chat/features/Sidebar/Topic/DefaultContent.tsx +0 -0
- /package/src/{pages → app}/chat/features/Sidebar/Topic/SkeletonList.tsx +0 -0
- /package/src/{pages → app}/chat/features/Sidebar/Topic/TopicContent.tsx +0 -0
- /package/src/{pages → app}/chat/features/Sidebar/Topic/TopicItem.tsx +0 -0
- /package/src/{pages → app}/chat/features/Sidebar/Topic/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/Sidebar/TopicSearchBar/index.tsx +0 -0
- /package/src/{pages → app}/chat/features/Sidebar/index.tsx +0 -0
- /package/src/{pages → app}/chat/layout.mobile.tsx +0 -0
- /package/src/{pages/chat/layout.tsx → app/chat/layout.pc.tsx} +0 -0
- /package/src/{pages/chat/setting → app/chat/settings}/features/Header/index.tsx +0 -0
- /package/src/{pages/chat/setting → app/chat/settings}/layout.mobile.tsx +0 -0
- /package/src/{pages → app}/home/Loading.tsx +0 -0
- /package/src/{pages → app}/market/features/AgentCard/AgentCardBanner.tsx +0 -0
- /package/src/{pages → app}/market/features/AgentCard/AgentCardItem.tsx +0 -0
- /package/src/{pages → app}/market/features/AgentCard/Loading.tsx +0 -0
- /package/src/{pages → app}/market/features/AgentCard/index.tsx +0 -0
- /package/src/{pages → app}/market/features/AgentCard/style.ts +0 -0
- /package/src/{pages → app}/market/features/AgentSearchBar/index.tsx +0 -0
- /package/src/{pages → app}/market/features/Header/Desktop.tsx +0 -0
- /package/src/{pages → app}/market/features/Header/Mobile.tsx +0 -0
- /package/src/{pages → app}/market/features/Header/index.tsx +0 -0
- /package/src/{pages → app}/market/features/SideBar/AgentInfo/Comment.tsx +0 -0
- /package/src/{pages → app}/market/features/SideBar/AgentInfo/Header.tsx +0 -0
- /package/src/{pages → app}/market/features/SideBar/AgentInfo/Loading.tsx +0 -0
- /package/src/{pages → app}/market/features/SideBar/AgentInfo/TokenTag.tsx +0 -0
- /package/src/{pages → app}/market/features/SideBar/AgentInfo/style.ts +0 -0
- /package/src/{pages → app}/market/features/SideBar/Desktop.tsx +0 -0
- /package/src/{pages → app}/market/features/SideBar/Mobile.tsx +0 -0
- /package/src/{pages → app}/market/features/SideBar/index.tsx +0 -0
- /package/src/{pages → app}/market/features/TagList/index.tsx +0 -0
- /package/src/{pages/market/layout.tsx → app/market/layout.pc.tsx} +0 -0
- /package/src/{pages → app}/settings/features/Banner/index.tsx +0 -0
- /package/src/{pages → app}/settings/features/Header/Desktop.tsx +0 -0
- /package/src/{pages → app}/settings/features/Header/Mobile.tsx +0 -0
- /package/src/{pages → app}/settings/features/Header/index.tsx +0 -0
- /package/src/{pages → app}/settings/features/Settings/Agent.tsx +0 -0
- /package/src/{pages → app}/settings/features/Settings/Common.tsx +0 -0
- /package/src/{pages → app}/settings/features/Settings/LLM/Checker.tsx +0 -0
- /package/src/{pages → app}/settings/features/Settings/LLM/ModelList.tsx +0 -0
- /package/src/{pages → app}/settings/features/Settings/LLM/getModelList.ts +0 -0
- /package/src/{pages → app}/settings/features/Settings/LLM/index.tsx +0 -0
- /package/src/{pages → app}/settings/features/Settings/index.tsx +0 -0
- /package/src/{pages → app}/settings/features/ThemeSwatches/ThemeSwatchesNeutral.tsx +0 -0
- /package/src/{pages → app}/settings/features/ThemeSwatches/ThemeSwatchesPrimary.tsx +0 -0
- /package/src/{pages → app}/settings/features/ThemeSwatches/index.ts +0 -0
- /package/src/{pages → app}/settings/layout.mobile.tsx +0 -0
- /package/src/{pages/settings/layout.tsx → app/settings/layout.pc.tsx} +0 -0
- /package/src/{pages → app}/welcome/features/Banner/AgentCard.tsx +0 -0
- /package/src/{pages → app}/welcome/features/Banner/AgentTemplate.tsx +0 -0
- /package/src/{pages → app}/welcome/features/Banner/Hero.tsx +0 -0
- /package/src/{pages → app}/welcome/features/Banner/index.tsx +0 -0
- /package/src/{pages → app}/welcome/features/Banner/style.ts +0 -0
- /package/src/{pages → app}/welcome/features/Footer/index.tsx +0 -0
- /package/src/{pages → app}/welcome/layout.mobile.tsx +0 -0
- /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(() => {
|
|
@@ -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 }) => {
|
|
@@ -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();
|
|
@@ -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');
|
package/src/app/page.tsx
ADDED
|
@@ -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();
|
|
@@ -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();
|
|
@@ -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'
|
|
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/
|
|
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
|
+
});
|
package/src/utils/url.ts
ADDED
|
@@ -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
|
+
};
|
package/.github/dependabot.yml
DELETED
|
@@ -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'
|
|
File without changes
|
/package/src/{pages → app}/chat/features/Conversation/ChatList/Error/ErrorActionContainer.tsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{pages → app}/chat/features/Conversation/ChatList/Error/Plugin/PluginSettings.tsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/IFrameRender/hooks.ts
RENAMED
|
File without changes
|
/package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/IFrameRender/index.tsx
RENAMED
|
File without changes
|
/package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/IFrameRender/utils.ts
RENAMED
|
File without changes
|
|
File without changes
|
/package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/PluginResultRender.tsx
RENAMED
|
File without changes
|
/package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/SystemJsRender/index.tsx
RENAMED
|
File without changes
|
/package/src/{pages → app}/chat/features/Conversation/ChatList/Plugins/SystemJsRender/utils.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|