@lobehub/chat 0.147.14 → 0.147.16
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/package.json +1 -1
- package/src/app/api/auth/[...nextauth]/route.ts +1 -1
- package/src/app/chat/(desktop)/features/ChatInput/Footer/index.tsx +7 -1
- package/src/app/chat/(desktop)/features/ChatInput/TextArea.tsx +7 -1
- package/src/app/layout.tsx +2 -2
- package/src/config/modelProviders/openai.ts +1 -1
- package/src/config/server/app.ts +0 -18
- package/src/config/server/auth.ts +71 -0
- package/src/config/server/index.ts +3 -1
- package/src/layout/AuthProvider/NextAuth/index.tsx +10 -0
- package/src/layout/AuthProvider/index.tsx +3 -7
- package/src/layout/DefaultLayout/Desktop/SideBar/Avatar.tsx +11 -0
- package/src/layout/{GlobalLayout → DefaultLayout}/Desktop/SideBar/index.tsx +2 -2
- package/src/layout/{GlobalLayout/Mobile/Client.tsx → DefaultLayout/Mobile/index.tsx} +2 -0
- package/src/layout/DefaultLayout/index.ts +2 -0
- package/src/layout/{GlobalLayout/Desktop/index.tsx → routes/Desktop.tsx} +5 -3
- package/src/layout/{GlobalLayout/Mobile/index.tsx → routes/Mobile.tsx} +3 -4
- package/src/layout/{GlobalLayout → routes}/index.tsx +2 -2
- package/src/{app/api/auth/next-auth.ts → libs/next-auth/index.ts} +1 -1
- package/src/middleware.ts +1 -1
- package/src/store/tool/selectors/tool.test.ts +27 -1
- package/src/store/tool/selectors/tool.ts +2 -1
- /package/src/layout/{GlobalLayout → DefaultLayout}/Desktop/SideBar/BottomActions.tsx +0 -0
- /package/src/layout/{GlobalLayout → DefaultLayout}/Desktop/SideBar/TopActions.tsx +0 -0
- /package/src/layout/{GlobalLayout/Desktop/Client.tsx → DefaultLayout/Desktop/index.tsx} +0 -0
- /package/src/{app/api/auth → libs/next-auth}/sso-providers/auth0.ts +0 -0
- /package/src/{app/api/auth → libs/next-auth}/sso-providers/authentik.ts +0 -0
- /package/src/{app/api/auth → libs/next-auth}/sso-providers/azure-ad.ts +0 -0
- /package/src/{app/api/auth → libs/next-auth}/sso-providers/github.ts +0 -0
- /package/src/{app/api/auth → libs/next-auth}/sso-providers/index.ts +0 -0
- /package/src/{app/api/auth → libs/next-auth}/sso-providers/zitadel.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.147.16](https://github.com/lobehub/lobe-chat/compare/v0.147.15...v0.147.16)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2024-04-14**</sup>
|
|
8
|
+
|
|
9
|
+
#### ♻ Code Refactoring
|
|
10
|
+
|
|
11
|
+
- **misc**: Refactor the auth.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### Code refactoring
|
|
19
|
+
|
|
20
|
+
- **misc**: Refactor the auth, closes [#2043](https://github.com/lobehub/lobe-chat/issues/2043) ([37ecb41](https://github.com/lobehub/lobe-chat/commit/37ecb41))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
### [Version 0.147.15](https://github.com/lobehub/lobe-chat/compare/v0.147.14...v0.147.15)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2024-04-14**</sup>
|
|
33
|
+
|
|
34
|
+
#### 🐛 Bug Fixes
|
|
35
|
+
|
|
36
|
+
- **misc**: Fix tool call error with gpt-4-turbo.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### What's fixed
|
|
44
|
+
|
|
45
|
+
- **misc**: Fix tool call error with gpt-4-turbo, closes [#2042](https://github.com/lobehub/lobe-chat/issues/2042) ([63d91b8](https://github.com/lobehub/lobe-chat/commit/63d91b8))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
### [Version 0.147.14](https://github.com/lobehub/lobe-chat/compare/v0.147.13...v0.147.14)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2024-04-14**</sup>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.147.
|
|
3
|
+
"version": "0.147.16",
|
|
4
4
|
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -56,7 +56,11 @@ const useStyles = createStyles(({ css, prefixCls, token }) => {
|
|
|
56
56
|
|
|
57
57
|
const isMac = isMacOS();
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
interface FooterProps {
|
|
60
|
+
setExpand?: (expand: boolean) => void;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const Footer = memo<FooterProps>(({ setExpand }) => {
|
|
60
64
|
const { t } = useTranslation('chat');
|
|
61
65
|
|
|
62
66
|
const { theme, styles } = useStyles();
|
|
@@ -193,4 +197,6 @@ const Footer = memo<{ setExpand?: (expand: boolean) => void }>(({ setExpand }) =
|
|
|
193
197
|
);
|
|
194
198
|
});
|
|
195
199
|
|
|
200
|
+
Footer.displayName = 'Footer';
|
|
201
|
+
|
|
196
202
|
export default Footer;
|
|
@@ -31,7 +31,11 @@ const useStyles = createStyles(({ css }) => {
|
|
|
31
31
|
};
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
interface InputAreaProps {
|
|
35
|
+
setExpand?: (expand: boolean) => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const InputArea = memo<InputAreaProps>(({ setExpand }) => {
|
|
35
39
|
const { t } = useTranslation('chat');
|
|
36
40
|
const { styles } = useStyles();
|
|
37
41
|
const ref = useRef<TextAreaRef>(null);
|
|
@@ -119,4 +123,6 @@ const InputArea = memo<{ setExpand?: (expand: boolean) => void }>(({ setExpand }
|
|
|
119
123
|
);
|
|
120
124
|
});
|
|
121
125
|
|
|
126
|
+
InputArea.displayName = 'InputArea';
|
|
127
|
+
|
|
122
128
|
export default InputArea;
|
package/src/app/layout.tsx
CHANGED
|
@@ -7,8 +7,8 @@ import { isRtlLang } from 'rtl-detect';
|
|
|
7
7
|
import Analytics from '@/components/Analytics';
|
|
8
8
|
import { DEFAULT_LANG, LOBE_LOCALE_COOKIE } from '@/const/locale';
|
|
9
9
|
import AuthProvider from '@/layout/AuthProvider';
|
|
10
|
-
import GlobalLayout from '@/layout/GlobalLayout';
|
|
11
10
|
import GlobalProvider from '@/layout/GlobalProvider';
|
|
11
|
+
import LayoutRoutes from '@/layout/routes';
|
|
12
12
|
import { isMobileDevice } from '@/utils/responsive';
|
|
13
13
|
|
|
14
14
|
const RootLayout = async ({ children }: PropsWithChildren) => {
|
|
@@ -22,7 +22,7 @@ const RootLayout = async ({ children }: PropsWithChildren) => {
|
|
|
22
22
|
<body>
|
|
23
23
|
<GlobalProvider>
|
|
24
24
|
<AuthProvider>
|
|
25
|
-
<
|
|
25
|
+
<LayoutRoutes>{children}</LayoutRoutes>
|
|
26
26
|
</AuthProvider>
|
|
27
27
|
</GlobalProvider>
|
|
28
28
|
<Analytics />
|
package/src/config/server/app.ts
CHANGED
|
@@ -57,24 +57,6 @@ export const getAppConfig = () => {
|
|
|
57
57
|
|
|
58
58
|
PLUGIN_SETTINGS: process.env.PLUGIN_SETTINGS,
|
|
59
59
|
|
|
60
|
-
ENABLE_OAUTH_SSO: !!process.env.ENABLE_OAUTH_SSO,
|
|
61
|
-
SSO_PROVIDERS: process.env.SSO_PROVIDERS || 'auth0',
|
|
62
|
-
AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID || '',
|
|
63
|
-
AUTH0_CLIENT_SECRET: process.env.AUTH0_CLIENT_SECRET || '',
|
|
64
|
-
AUTH0_ISSUER: process.env.AUTH0_ISSUER || '',
|
|
65
|
-
GITHUB_CLIENT_ID: process.env.GITHUB_CLIENT_ID || '',
|
|
66
|
-
GITHUB_CLIENT_SECRET: process.env.GITHUB_CLIENT_SECRET || '',
|
|
67
|
-
AZURE_AD_CLIENT_ID: process.env.AZURE_AD_CLIENT_ID || '',
|
|
68
|
-
AZURE_AD_CLIENT_SECRET: process.env.AZURE_AD_CLIENT_SECRET || '',
|
|
69
|
-
AZURE_AD_TENANT_ID: process.env.AZURE_AD_TENANT_ID || '',
|
|
70
|
-
AUTHENTIK_CLIENT_ID: process.env.AUTHENTIK_CLIENT_ID || '',
|
|
71
|
-
AUTHENTIK_CLIENT_SECRET: process.env.AUTHENTIK_CLIENT_SECRET || '',
|
|
72
|
-
AUTHENTIK_ISSUER: process.env.AUTHENTIK_ISSUER || '',
|
|
73
|
-
ZITADEL_CLIENT_ID: process.env.ZITADEL_CLIENT_ID || '',
|
|
74
|
-
ZITADEL_CLIENT_SECRET: process.env.ZITADEL_CLIENT_SECRET || '',
|
|
75
|
-
ZITADEL_ISSUER: process.env.ZITADEL_ISSUER || '',
|
|
76
|
-
NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET || '',
|
|
77
|
-
|
|
78
60
|
ENABLE_LANGFUSE: process.env.ENABLE_LANGFUSE === '1',
|
|
79
61
|
LANGFUSE_SECRET_KEY: process.env.LANGFUSE_SECRET_KEY || '',
|
|
80
62
|
LANGFUSE_PUBLIC_KEY: process.env.LANGFUSE_PUBLIC_KEY || '',
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* eslint-disable sort-keys-fix/sort-keys-fix , typescript-sort-keys/interface */
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
5
|
+
namespace NodeJS {
|
|
6
|
+
interface ProcessEnv {
|
|
7
|
+
ENABLE_OAUTH_SSO?: string;
|
|
8
|
+
SSO_PROVIDERS?: string;
|
|
9
|
+
|
|
10
|
+
AUTH0_CLIENT_ID?: string;
|
|
11
|
+
AUTH0_CLIENT_SECRET?: string;
|
|
12
|
+
AUTH0_ISSUER?: string;
|
|
13
|
+
|
|
14
|
+
// Github
|
|
15
|
+
GITHUB_CLIENT_ID?: string;
|
|
16
|
+
GITHUB_CLIENT_SECRET?: string;
|
|
17
|
+
|
|
18
|
+
// Azure AD
|
|
19
|
+
AZURE_AD_CLIENT_ID?: string;
|
|
20
|
+
AZURE_AD_CLIENT_SECRET?: string;
|
|
21
|
+
AZURE_AD_TENANT_ID?: string;
|
|
22
|
+
|
|
23
|
+
// AUTHENTIK
|
|
24
|
+
AUTHENTIK_CLIENT_ID?: string;
|
|
25
|
+
AUTHENTIK_CLIENT_SECRET?: string;
|
|
26
|
+
AUTHENTIK_ISSUER?: string;
|
|
27
|
+
|
|
28
|
+
// ZITADEL
|
|
29
|
+
ZITADEL_CLIENT_ID?: string;
|
|
30
|
+
ZITADEL_CLIENT_SECRET?: string;
|
|
31
|
+
ZITADEL_ISSUER?: string;
|
|
32
|
+
NEXTAUTH_SECRET?: string;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const getAuthConfig = () => {
|
|
38
|
+
if (typeof process === 'undefined') {
|
|
39
|
+
throw new Error('[Server Config] you are importing a server-only module outside of server');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
ENABLE_OAUTH_SSO: !!process.env.ENABLE_OAUTH_SSO,
|
|
44
|
+
SSO_PROVIDERS: process.env.SSO_PROVIDERS || 'auth0',
|
|
45
|
+
|
|
46
|
+
// Auth0
|
|
47
|
+
AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID || '',
|
|
48
|
+
AUTH0_CLIENT_SECRET: process.env.AUTH0_CLIENT_SECRET || '',
|
|
49
|
+
AUTH0_ISSUER: process.env.AUTH0_ISSUER || '',
|
|
50
|
+
|
|
51
|
+
// Github
|
|
52
|
+
GITHUB_CLIENT_ID: process.env.GITHUB_CLIENT_ID || '',
|
|
53
|
+
GITHUB_CLIENT_SECRET: process.env.GITHUB_CLIENT_SECRET || '',
|
|
54
|
+
|
|
55
|
+
// Azure AD
|
|
56
|
+
AZURE_AD_CLIENT_ID: process.env.AZURE_AD_CLIENT_ID || '',
|
|
57
|
+
AZURE_AD_CLIENT_SECRET: process.env.AZURE_AD_CLIENT_SECRET || '',
|
|
58
|
+
AZURE_AD_TENANT_ID: process.env.AZURE_AD_TENANT_ID || '',
|
|
59
|
+
|
|
60
|
+
// AUTHENTIK
|
|
61
|
+
AUTHENTIK_CLIENT_ID: process.env.AUTHENTIK_CLIENT_ID || '',
|
|
62
|
+
AUTHENTIK_CLIENT_SECRET: process.env.AUTHENTIK_CLIENT_SECRET || '',
|
|
63
|
+
AUTHENTIK_ISSUER: process.env.AUTHENTIK_ISSUER || '',
|
|
64
|
+
|
|
65
|
+
// ZITADEL
|
|
66
|
+
ZITADEL_CLIENT_ID: process.env.ZITADEL_CLIENT_ID || '',
|
|
67
|
+
ZITADEL_CLIENT_SECRET: process.env.ZITADEL_CLIENT_SECRET || '',
|
|
68
|
+
ZITADEL_ISSUER: process.env.ZITADEL_ISSUER || '',
|
|
69
|
+
NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET || '',
|
|
70
|
+
};
|
|
71
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getAnalyticsConfig } from './analytics';
|
|
2
2
|
import { getAppConfig } from './app';
|
|
3
|
+
import { getAuthConfig } from './auth';
|
|
3
4
|
import { getProviderConfig } from './provider';
|
|
4
5
|
|
|
5
6
|
export const getServerConfig = () => {
|
|
@@ -9,7 +10,8 @@ export const getServerConfig = () => {
|
|
|
9
10
|
|
|
10
11
|
const provider = getProviderConfig();
|
|
11
12
|
const app = getAppConfig();
|
|
13
|
+
const auth = getAuthConfig();
|
|
12
14
|
const analytics = getAnalyticsConfig();
|
|
13
15
|
|
|
14
|
-
return { ...provider, ...app, ...analytics };
|
|
16
|
+
return { ...provider, ...app, ...analytics, ...auth };
|
|
15
17
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SessionProvider } from 'next-auth/react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
|
|
4
|
+
import { API_ENDPOINTS } from '@/services/_url';
|
|
5
|
+
|
|
6
|
+
const NextAuth = ({ children }: PropsWithChildren) => {
|
|
7
|
+
return <SessionProvider basePath={API_ENDPOINTS.oauth}>{children}</SessionProvider>;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default NextAuth;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { SessionProvider } from 'next-auth/react';
|
|
2
1
|
import { PropsWithChildren } from 'react';
|
|
3
2
|
|
|
4
3
|
import { getServerConfig } from '@/config/server';
|
|
5
|
-
|
|
4
|
+
|
|
5
|
+
import NextAuth from './NextAuth';
|
|
6
6
|
|
|
7
7
|
const { ENABLE_OAUTH_SSO = false } = getServerConfig();
|
|
8
8
|
|
|
9
9
|
const AuthProvider = ({ children }: PropsWithChildren) =>
|
|
10
|
-
ENABLE_OAUTH_SSO ?
|
|
11
|
-
<SessionProvider basePath={API_ENDPOINTS.oauth}>{children}</SessionProvider>
|
|
12
|
-
) : (
|
|
13
|
-
children
|
|
14
|
-
);
|
|
10
|
+
ENABLE_OAUTH_SSO ? <NextAuth>{children}</NextAuth> : children;
|
|
15
11
|
|
|
16
12
|
export default AuthProvider;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SideNav } from '@lobehub/ui';
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
|
|
4
|
-
import AvatarWithUpload from '@/features/AvatarWithUpload';
|
|
5
4
|
import { SidebarTabKey } from '@/store/global/initialState';
|
|
6
5
|
|
|
6
|
+
import Avatar from './Avatar';
|
|
7
7
|
import BottomActions from './BottomActions';
|
|
8
8
|
import TopActions from './TopActions';
|
|
9
9
|
|
|
@@ -14,7 +14,7 @@ interface Props {
|
|
|
14
14
|
export default memo<Props>(({ sidebarKey }) => {
|
|
15
15
|
return (
|
|
16
16
|
<SideNav
|
|
17
|
-
avatar={<
|
|
17
|
+
avatar={<Avatar />}
|
|
18
18
|
bottomActions={<BottomActions tab={sidebarKey} />}
|
|
19
19
|
style={{ height: '100%' }}
|
|
20
20
|
topActions={<TopActions tab={sidebarKey} />}
|
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
import { usePathname } from 'next/navigation';
|
|
4
4
|
import { PropsWithChildren, memo } from 'react';
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import { DefaultLayoutDesktop } from '@/layout/DefaultLayout';
|
|
7
|
+
|
|
8
|
+
const defaultLayoutRoutes = new Set(['/']);
|
|
7
9
|
|
|
8
10
|
const DesktopLayout = memo<PropsWithChildren>(({ children }) => {
|
|
9
11
|
const pathname = usePathname();
|
|
10
12
|
|
|
11
|
-
if (pathname
|
|
13
|
+
if (defaultLayoutRoutes.has(pathname)) return children;
|
|
12
14
|
|
|
13
|
-
return <
|
|
15
|
+
return <DefaultLayoutDesktop>{children}</DefaultLayoutDesktop>;
|
|
14
16
|
});
|
|
15
17
|
|
|
16
18
|
export default DesktopLayout;
|
|
@@ -5,8 +5,7 @@ import { PropsWithChildren, memo } from 'react';
|
|
|
5
5
|
|
|
6
6
|
import { useActiveTabKey } from '@/hooks/useActiveTabKey';
|
|
7
7
|
import { useIsSubSlug } from '@/hooks/useIsSubSlug';
|
|
8
|
-
|
|
9
|
-
import Layout from './Client';
|
|
8
|
+
import { DefaultLayoutMobile } from '@/layout/DefaultLayout';
|
|
10
9
|
|
|
11
10
|
const MobileLayout = memo<PropsWithChildren>(({ children }) => {
|
|
12
11
|
const pathname = usePathname();
|
|
@@ -16,9 +15,9 @@ const MobileLayout = memo<PropsWithChildren>(({ children }) => {
|
|
|
16
15
|
if (pathname === '/') return children;
|
|
17
16
|
|
|
18
17
|
return (
|
|
19
|
-
<
|
|
18
|
+
<DefaultLayoutMobile showTabBar={!isSubPath} tabBarKey={tabBarKey}>
|
|
20
19
|
{children}
|
|
21
|
-
</
|
|
20
|
+
</DefaultLayoutMobile>
|
|
22
21
|
);
|
|
23
22
|
});
|
|
24
23
|
|
|
@@ -3,6 +3,6 @@ import ServerLayout from '@/components/server/ServerLayout';
|
|
|
3
3
|
import Desktop from './Desktop';
|
|
4
4
|
import Mobile from './Mobile';
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const LayoutRoutes = ServerLayout({ Desktop, Mobile });
|
|
7
7
|
|
|
8
|
-
export default
|
|
8
|
+
export default LayoutRoutes;
|
|
@@ -32,7 +32,7 @@ const nextAuth = NextAuth({
|
|
|
32
32
|
async session({ session, token }) {
|
|
33
33
|
// Pick userid from token
|
|
34
34
|
if (session.user) {
|
|
35
|
-
session.user.id = token.userId ?? session.user.id;
|
|
35
|
+
session.user.id = (token.userId ?? session.user.id) as string;
|
|
36
36
|
}
|
|
37
37
|
return session;
|
|
38
38
|
},
|
package/src/middleware.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { NextResponse } from 'next/server';
|
|
2
2
|
|
|
3
3
|
import { getServerConfig } from '@/config/server';
|
|
4
|
+
import { auth } from '@/libs/next-auth';
|
|
4
5
|
|
|
5
|
-
import { auth } from './app/api/auth/next-auth';
|
|
6
6
|
import { OAUTH_AUTHORIZED } from './const/auth';
|
|
7
7
|
|
|
8
8
|
export const config = {
|
|
@@ -34,7 +34,14 @@ const mockState = {
|
|
|
34
34
|
identifier: 'plugin-3',
|
|
35
35
|
manifest: {
|
|
36
36
|
identifier: 'plugin-3',
|
|
37
|
-
api: [
|
|
37
|
+
api: [
|
|
38
|
+
{
|
|
39
|
+
name: 'api-3',
|
|
40
|
+
url: 'bac',
|
|
41
|
+
description: '123123',
|
|
42
|
+
parameters: { type: 'object', properties: { a: { type: 'string' } } },
|
|
43
|
+
},
|
|
44
|
+
],
|
|
38
45
|
},
|
|
39
46
|
type: 'customPlugin',
|
|
40
47
|
},
|
|
@@ -132,6 +139,25 @@ describe('toolSelectors', () => {
|
|
|
132
139
|
const result = toolSelectors.enabledSchema([])(mockState);
|
|
133
140
|
expect(result).toEqual([]);
|
|
134
141
|
});
|
|
142
|
+
|
|
143
|
+
// fix https://github.com/lobehub/lobe-chat/issues/2036
|
|
144
|
+
it('should not contain url', () => {
|
|
145
|
+
const result = toolSelectors.enabledSchema(['plugin-3'])(mockState);
|
|
146
|
+
expect(result[0].function).toEqual({
|
|
147
|
+
description: '123123',
|
|
148
|
+
name: 'plugin-3____api-3',
|
|
149
|
+
parameters: {
|
|
150
|
+
properties: {
|
|
151
|
+
a: {
|
|
152
|
+
type: 'string',
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
type: 'object',
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
expect(result[0].function).not.toHaveProperty('url');
|
|
160
|
+
});
|
|
135
161
|
});
|
|
136
162
|
|
|
137
163
|
describe('getPluginManifestLoadingStatus', () => {
|
|
@@ -40,8 +40,9 @@ const enabledSchema =
|
|
|
40
40
|
.filter((m) => tools.includes(m?.identifier))
|
|
41
41
|
.flatMap((manifest) =>
|
|
42
42
|
manifest.api.map((m) => ({
|
|
43
|
-
|
|
43
|
+
description: m.description,
|
|
44
44
|
name: getAPIName(manifest.identifier, m.name, manifest.type),
|
|
45
|
+
parameters: m.parameters,
|
|
45
46
|
})),
|
|
46
47
|
);
|
|
47
48
|
|
|
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
|