@lobehub/chat 1.35.12 → 1.35.14

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 CHANGED
@@ -2,6 +2,48 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.35.14](https://github.com/lobehub/lobe-chat/compare/v1.35.13...v1.35.14)
6
+
7
+ <sup>Released on **2024-12-06**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: Refactor page params to adapt next15 breaking change.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **misc**: Refactor page params to adapt next15 breaking change, closes [#4904](https://github.com/lobehub/lobe-chat/issues/4904) ([45ec7b4](https://github.com/lobehub/lobe-chat/commit/45ec7b4))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
30
+ ### [Version 1.35.13](https://github.com/lobehub/lobe-chat/compare/v1.35.12...v1.35.13)
31
+
32
+ <sup>Released on **2024-12-06**</sup>
33
+
34
+ <br/>
35
+
36
+ <details>
37
+ <summary><kbd>Improvements and Fixes</kbd></summary>
38
+
39
+ </details>
40
+
41
+ <div align="right">
42
+
43
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
44
+
45
+ </div>
46
+
5
47
  ### [Version 1.35.12](https://github.com/lobehub/lobe-chat/compare/v1.35.11...v1.35.12)
6
48
 
7
49
  <sup>Released on **2024-12-05**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,18 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "improvements": [
5
+ "Refactor page params to adapt next15 breaking change."
6
+ ]
7
+ },
8
+ "date": "2024-12-06",
9
+ "version": "1.35.14"
10
+ },
11
+ {
12
+ "children": {},
13
+ "date": "2024-12-06",
14
+ "version": "1.35.13"
15
+ },
2
16
  {
3
17
  "children": {
4
18
  "fixes": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.35.12",
3
+ "version": "1.35.14",
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",
@@ -259,7 +259,7 @@
259
259
  "@types/node": "^20.16.13",
260
260
  "@types/numeral": "^2.0.5",
261
261
  "@types/pg": "^8.11.10",
262
- "@types/react": "^18.3.11",
262
+ "@types/react": "18.3.13",
263
263
  "@types/react-dom": "^18.3.1",
264
264
  "@types/rtl-detect": "^1.0.3",
265
265
  "@types/semver": "^7.5.8",
@@ -12,6 +12,25 @@ docker run -p 5432:5432 -d --name pg -e POSTGRES_PASSWORD=mysecretpassword pgvec
12
12
  if you have any other question, please open issue here: https://github.com/lobehub/lobe-chat/issues
13
13
  `;
14
14
 
15
+ const DB_FAIL_INIT_HINT = `------------------------------------------------------------------------------------------
16
+ ⚠️ Database migrate failed due to not find the db instance.
17
+
18
+ 1) You might not switch to server db mode, please set the env blow and try again:
19
+
20
+ \`\`\`
21
+ NEXT_PUBLIC_SERVICE_MODE=server
22
+ \`\`\`
23
+
24
+ 2) if you are using docker postgres image, you may need to set DATABASE_DRIVER to node
25
+
26
+ \`\`\`
27
+ DATABASE_DRIVER=node
28
+ \`\`\`
29
+
30
+ if you have any other question, please open issue here: https://github.com/lobehub/lobe-chat/issues
31
+ `;
32
+
15
33
  module.exports = {
34
+ DB_FAIL_INIT_HINT,
16
35
  PGVECTOR_HINT,
17
36
  };
@@ -1,18 +1,24 @@
1
1
  import * as dotenv from 'dotenv';
2
- import * as migrator from 'drizzle-orm/neon-serverless/migrator';
2
+ import { migrate as neonMigrate } from 'drizzle-orm/neon-serverless/migrator';
3
+ import { migrate as nodeMigrate } from 'drizzle-orm/node-postgres/migrator';
3
4
  import { join } from 'node:path';
4
5
 
5
6
  import { serverDB } from '../../src/database/server/core/db';
6
- import { PGVECTOR_HINT } from './errorHint';
7
+ import { DB_FAIL_INIT_HINT, PGVECTOR_HINT } from './errorHint';
7
8
 
8
9
  // Read the `.env` file if it exists, or a file specified by the
9
10
  // dotenv_config_path parameter that's passed to Node.js
10
11
  dotenv.config();
11
12
 
13
+ const migrationsFolder = join(__dirname, '../../src/database/migrations');
14
+
12
15
  const runMigrations = async () => {
13
- await migrator.migrate(serverDB, {
14
- migrationsFolder: join(__dirname, '../../src/database/migrations'),
15
- });
16
+ if (process.env.DATABASE_DRIVER === 'node') {
17
+ await nodeMigrate(serverDB, { migrationsFolder });
18
+ } else {
19
+ await neonMigrate(serverDB, { migrationsFolder });
20
+ }
21
+
16
22
  console.log('✅ database migration pass.');
17
23
  // eslint-disable-next-line unicorn/no-process-exit
18
24
  process.exit(0);
@@ -26,8 +32,12 @@ if (connectionString) {
26
32
  runMigrations().catch((err) => {
27
33
  console.error('❌ Database migrate failed:', err);
28
34
 
29
- if ((err.message as string).includes('extension "vector" is not available')) {
35
+ const errMsg = err.message as string;
36
+
37
+ if (errMsg.includes('extension "vector" is not available')) {
30
38
  console.info(PGVECTOR_HINT);
39
+ } else if (errMsg.includes(`Cannot read properties of undefined (reading 'migrate')`)) {
40
+ console.info(DB_FAIL_INIT_HINT);
31
41
  }
32
42
 
33
43
  // eslint-disable-next-line unicorn/no-process-exit
@@ -8,6 +8,7 @@ import { metadataModule } from '@/server/metadata';
8
8
  import { DiscoverService } from '@/server/services/discover';
9
9
  import { translation } from '@/server/translation';
10
10
  import { DiscoverProviderItem } from '@/types/discover';
11
+ import { PageProps } from '@/types/next';
11
12
  import { isMobileDevice } from '@/utils/server/responsive';
12
13
 
13
14
  import DetailLayout from '../../features/DetailLayout';
@@ -17,9 +18,12 @@ import InfoSidebar from './features/InfoSidebar';
17
18
  import ParameterList from './features/ParameterList';
18
19
  import ProviderList from './features/ProviderList';
19
20
 
20
- type Props = { params: { slugs: string[] }; searchParams: { hl?: Locales } };
21
+ type Props = PageProps<{ slugs: string[] }, { hl?: Locales }>;
22
+
23
+ export const generateMetadata = async (props: Props) => {
24
+ const params = await props.params;
25
+ const searchParams = await props.searchParams;
21
26
 
22
- export const generateMetadata = async ({ params, searchParams }: Props) => {
23
27
  const { slugs } = params;
24
28
  const identifier = decodeURIComponent(slugs.join('/'));
25
29
  const { t, locale } = await translation('metadata', searchParams?.hl);
@@ -59,7 +63,10 @@ export const generateMetadata = async ({ params, searchParams }: Props) => {
59
63
  };
60
64
  };
61
65
 
62
- const Page = async ({ params, searchParams }: Props) => {
66
+ const Page = async (props: Props) => {
67
+ const params = await props.params;
68
+ const searchParams = await props.searchParams;
69
+
63
70
  const { slugs } = params;
64
71
 
65
72
  const identifier = decodeURIComponent(slugs.join('/'));
@@ -2,11 +2,11 @@ import { notFound } from 'next/navigation';
2
2
  import urlJoin from 'url-join';
3
3
 
4
4
  import StructuredData from '@/components/StructuredData';
5
- import { Locales } from '@/locales/resources';
6
5
  import { ldModule } from '@/server/ld';
7
6
  import { metadataModule } from '@/server/metadata';
8
7
  import { DiscoverService } from '@/server/services/discover';
9
8
  import { translation } from '@/server/translation';
9
+ import { DiscoverPageProps } from '@/types/discover';
10
10
  import { isMobileDevice } from '@/utils/server/responsive';
11
11
 
12
12
  import DetailLayout from '../../features/DetailLayout';
@@ -16,9 +16,10 @@ import InfoSidebar from './features/InfoSidebar';
16
16
  import ParameterList from './features/ParameterList';
17
17
  import Schema from './features/Schema';
18
18
 
19
- type Props = { params: { slug: string }; searchParams: { hl?: Locales } };
19
+ export const generateMetadata = async (props: DiscoverPageProps) => {
20
+ const params = await props.params;
21
+ const searchParams = await props.searchParams;
20
22
 
21
- export const generateMetadata = async ({ params, searchParams }: Props) => {
22
23
  const { slug: identifier } = params;
23
24
  const { t, locale } = await translation('metadata', searchParams?.hl);
24
25
 
@@ -57,7 +58,10 @@ export const generateMetadata = async ({ params, searchParams }: Props) => {
57
58
  };
58
59
  };
59
60
 
60
- const Page = async ({ params, searchParams }: Props) => {
61
+ const Page = async (props: DiscoverPageProps) => {
62
+ const params = await props.params;
63
+ const searchParams = await props.searchParams;
64
+
61
65
  const { slug: identifier } = params;
62
66
  const { t, locale } = await translation('metadata', searchParams?.hl);
63
67
  const mobile = isMobileDevice();
@@ -3,13 +3,12 @@ import urlJoin from 'url-join';
3
3
 
4
4
  import StructuredData from '@/components/StructuredData';
5
5
  import { CustomMDX } from '@/components/mdx';
6
- import { Locales } from '@/locales/resources';
7
6
  import { ldModule } from '@/server/ld';
8
7
  import { metadataModule } from '@/server/metadata';
9
8
  import { DiscoverService } from '@/server/services/discover';
10
9
  import { DocService } from '@/server/services/doc';
11
10
  import { translation } from '@/server/translation';
12
- import { DiscoverModelItem } from '@/types/discover';
11
+ import { DiscoverModelItem, DiscoverPageProps } from '@/types/discover';
13
12
  import { isMobileDevice } from '@/utils/server/responsive';
14
13
 
15
14
  import DetailLayout from '../../features/DetailLayout';
@@ -18,9 +17,10 @@ import Header from './features/Header';
18
17
  import InfoSidebar from './features/InfoSidebar';
19
18
  import ModelList from './features/ModelList';
20
19
 
21
- type Props = { params: { slug: string }; searchParams: { hl?: Locales } };
20
+ export const generateMetadata = async (props: DiscoverPageProps) => {
21
+ const params = await props.params;
22
+ const searchParams = await props.searchParams;
22
23
 
23
- export const generateMetadata = async ({ params, searchParams }: Props) => {
24
24
  const { slug: identifier } = params;
25
25
  const { t, locale } = await translation('metadata', searchParams?.hl);
26
26
  const { t: td } = await translation('models', searchParams?.hl);
@@ -55,7 +55,10 @@ export const generateMetadata = async ({ params, searchParams }: Props) => {
55
55
  };
56
56
  };
57
57
 
58
- const Page = async ({ params, searchParams }: Props) => {
58
+ const Page = async (props: DiscoverPageProps) => {
59
+ const params = await props.params;
60
+ const searchParams = await props.searchParams;
61
+
59
62
  const { slug: identifier } = params;
60
63
  const { t, locale } = await translation('metadata', searchParams?.hl);
61
64
  const { t: td } = await translation('models', searchParams?.hl);
@@ -1,19 +1,19 @@
1
1
  import urlJoin from 'url-join';
2
2
 
3
3
  import StructuredData from '@/components/StructuredData';
4
- import { Locales } from '@/locales/resources';
5
4
  import { ldModule } from '@/server/ld';
6
5
  import { metadataModule } from '@/server/metadata';
7
6
  import { DiscoverService } from '@/server/services/discover';
8
7
  import { translation } from '@/server/translation';
9
- import { AssistantCategory } from '@/types/discover';
8
+ import { AssistantCategory, DiscoverPageProps } from '@/types/discover';
10
9
  import { isMobileDevice } from '@/utils/server/responsive';
11
10
 
12
11
  import List from '../features/List';
13
12
 
14
- type Props = { params: { slug: AssistantCategory }; searchParams: { hl?: Locales } };
13
+ export const generateMetadata = async (props: DiscoverPageProps) => {
14
+ const params = await props.params;
15
+ const searchParams = await props.searchParams;
15
16
 
16
- export const generateMetadata = async ({ params, searchParams }: Props) => {
17
17
  const { t, locale } = await translation('metadata', searchParams?.hl);
18
18
  const { t: td } = await translation('discover', searchParams?.hl);
19
19
 
@@ -26,7 +26,10 @@ export const generateMetadata = async ({ params, searchParams }: Props) => {
26
26
  });
27
27
  };
28
28
 
29
- const Page = async ({ params, searchParams }: Props) => {
29
+ const Page = async (props: DiscoverPageProps<AssistantCategory>) => {
30
+ const params = await props.params;
31
+ const searchParams = await props.searchParams;
32
+
30
33
  const { t, locale } = await translation('metadata', searchParams?.hl);
31
34
  const { t: td } = await translation('discover', searchParams?.hl);
32
35
  const mobile = isMobileDevice();
@@ -2,19 +2,19 @@ import urlJoin from 'url-join';
2
2
 
3
3
  import StructuredData from '@/components/StructuredData';
4
4
  import { DEFAULT_LANG } from '@/const/locale';
5
- import { Locales } from '@/locales/resources';
6
5
  import { ldModule } from '@/server/ld';
7
6
  import { metadataModule } from '@/server/metadata';
8
7
  import { DiscoverService } from '@/server/services/discover';
9
8
  import { translation } from '@/server/translation';
10
- import { AssistantCategory } from '@/types/discover';
9
+ import { DiscoverPageProps } from '@/types/discover';
11
10
  import { isMobileDevice } from '@/utils/server/responsive';
12
11
 
13
12
  import List from '../features/List';
14
13
 
15
- type Props = { params: { slug: AssistantCategory }; searchParams: { hl?: Locales } };
14
+ export const generateMetadata = async (props: DiscoverPageProps) => {
15
+ const params = await props.params;
16
+ const searchParams = await props.searchParams;
16
17
 
17
- export const generateMetadata = async ({ params, searchParams }: Props) => {
18
18
  const { t, locale } = await translation('metadata', searchParams?.hl);
19
19
 
20
20
  const discoverService = new DiscoverService();
@@ -30,7 +30,10 @@ export const generateMetadata = async ({ params, searchParams }: Props) => {
30
30
  });
31
31
  };
32
32
 
33
- const Page = async ({ params, searchParams }: Props) => {
33
+ const Page = async (props: DiscoverPageProps) => {
34
+ const params = await props.params;
35
+ const searchParams = await props.searchParams;
36
+
34
37
  const { t, locale } = await translation('metadata', searchParams?.hl);
35
38
  const mobile = isMobileDevice();
36
39
 
@@ -1,19 +1,19 @@
1
1
  import urlJoin from 'url-join';
2
2
 
3
3
  import StructuredData from '@/components/StructuredData';
4
- import { Locales } from '@/locales/resources';
5
4
  import { ldModule } from '@/server/ld';
6
5
  import { metadataModule } from '@/server/metadata';
7
6
  import { DiscoverService } from '@/server/services/discover';
8
7
  import { translation } from '@/server/translation';
9
- import { PluginCategory } from '@/types/discover';
8
+ import { DiscoverPageProps, PluginCategory } from '@/types/discover';
10
9
  import { isMobileDevice } from '@/utils/server/responsive';
11
10
 
12
11
  import List from '../features/List';
13
12
 
14
- type Props = { params: { slug: PluginCategory }; searchParams: { hl?: Locales } };
13
+ export const generateMetadata = async (props: DiscoverPageProps) => {
14
+ const params = await props.params;
15
+ const searchParams = await props.searchParams;
15
16
 
16
- export const generateMetadata = async ({ params, searchParams }: Props) => {
17
17
  const { t, locale } = await translation('metadata', searchParams?.hl);
18
18
  const { t: td } = await translation('discover', searchParams?.hl);
19
19
 
@@ -26,7 +26,10 @@ export const generateMetadata = async ({ params, searchParams }: Props) => {
26
26
  });
27
27
  };
28
28
 
29
- const Page = async ({ params, searchParams }: Props) => {
29
+ const Page = async (props: DiscoverPageProps<PluginCategory>) => {
30
+ const params = await props.params;
31
+ const searchParams = await props.searchParams;
32
+
30
33
  const { t, locale } = await translation('metadata', searchParams?.hl);
31
34
  const { t: td } = await translation('discover', searchParams?.hl);
32
35
  const mobile = isMobileDevice();
@@ -7,6 +7,7 @@ import { Locales } from '@/locales/resources';
7
7
  import { ldModule } from '@/server/ld';
8
8
  import { metadataModule } from '@/server/metadata';
9
9
  import { translation } from '@/server/translation';
10
+ import { PageProps } from '@/types/next';
10
11
  import { isMobileDevice } from '@/utils/server/responsive';
11
12
 
12
13
  import { ListLoadingWithoutBanner } from '../components/ListLoading';
@@ -24,15 +25,18 @@ const ProvidersResult = dynamic(() => import('./features/ProvidersResult'), {
24
25
  loading: () => <ListLoadingWithoutBanner />,
25
26
  });
26
27
 
27
- type Props = {
28
- searchParams: {
28
+ type Props = PageProps<
29
+ undefined,
30
+ {
29
31
  hl?: Locales;
30
32
  q?: string;
31
33
  type?: 'assistants' | 'plugins' | 'models' | 'providers';
32
- };
33
- };
34
+ }
35
+ >;
36
+
37
+ export const generateMetadata = async (props: Props) => {
38
+ const searchParams = await props.searchParams;
34
39
 
35
- export const generateMetadata = async ({ searchParams }: Props) => {
36
40
  const { t, locale } = await translation('metadata', searchParams?.hl);
37
41
 
38
42
  return metadataModule.generate({
@@ -44,7 +48,9 @@ export const generateMetadata = async ({ searchParams }: Props) => {
44
48
  });
45
49
  };
46
50
 
47
- const Page = async ({ searchParams }: Props) => {
51
+ const Page = async (props: Props) => {
52
+ const searchParams = await props.searchParams;
53
+
48
54
  const { q, type = 'assistants' } = searchParams;
49
55
  if (!q) redirect(urlJoin(`/discover`, type));
50
56
  const keywords = decodeURIComponent(q);
@@ -1,14 +1,12 @@
1
+ import { PagePropsWithId } from '@/types/next';
2
+
1
3
  import FileDetail from './FileDetail';
2
4
  import FilePreview from './FilePreview';
3
5
  import FullscreenModal from './FullscreenModal';
4
6
 
5
- interface Params {
6
- id: string;
7
- }
8
-
9
- type Props = { params: Params };
7
+ const Page = async (props: PagePropsWithId) => {
8
+ const params = await props.params;
10
9
 
11
- const Page = ({ params }: Props) => {
12
10
  return (
13
11
  <FullscreenModal detail={<FileDetail id={params.id} />}>
14
12
  <FilePreview id={params.id} />
@@ -5,19 +5,16 @@ import FileDetail from '@/app/(main)/files/features/FileDetail';
5
5
  import FileViewer from '@/features/FileViewer';
6
6
  import { createCallerFactory } from '@/libs/trpc';
7
7
  import { lambdaRouter } from '@/server/routers/lambda';
8
+ import { PagePropsWithId } from '@/types/next';
8
9
  import { getUserAuth } from '@/utils/server/auth';
9
10
 
10
11
  import Header from './Header';
11
12
 
12
- interface Params {
13
- id: string;
14
- }
15
-
16
- type Props = { params: Params };
17
-
18
13
  const createCaller = createCallerFactory(lambdaRouter);
19
14
 
20
- const FilePage = async ({ params }: Props) => {
15
+ const FilePage = async (props: PagePropsWithId) => {
16
+ const params = await props.params;
17
+
21
18
  const { userId } = await getUserAuth();
22
19
 
23
20
  const caller = createCaller({ userId });
@@ -6,7 +6,6 @@ import { Flexbox } from 'react-layout-kit';
6
6
  import CircleLoading from '@/components/CircleLoading';
7
7
  import { useKnowledgeBaseStore } from '@/store/knowledgeBase';
8
8
 
9
- import { PageProps } from '../type';
10
9
  import DatasetDetail from './DatasetDetail';
11
10
  import DatasetList from './DatasetList';
12
11
  import EmptyGuide from './EmptyGuide';
@@ -18,7 +17,13 @@ const useStyles = createStyles(({ css, token }) => ({
18
17
  `,
19
18
  }));
20
19
 
21
- const Dataset = ({ params }: PageProps) => {
20
+ interface Params {
21
+ id: string;
22
+ }
23
+
24
+ type Props = { params: Params & Promise<Params> };
25
+
26
+ const Dataset = ({ params }: Props) => {
22
27
  const { styles } = useStyles();
23
28
  const knowledgeBaseId = params.id;
24
29
 
@@ -5,11 +5,16 @@ import { Flexbox } from 'react-layout-kit';
5
5
  import CircleLoading from '@/components/CircleLoading';
6
6
  import { useKnowledgeBaseStore } from '@/store/knowledgeBase';
7
7
 
8
- import { PageProps } from '../type';
9
8
  import EmptyGuide from './EmptyGuide';
10
9
  import EvaluationList from './EvaluationList';
11
10
 
12
- const Evaluation = ({ params }: PageProps) => {
11
+ interface Params {
12
+ id: string;
13
+ }
14
+
15
+ type Props = { params: Params };
16
+
17
+ const Evaluation = ({ params }: Props) => {
13
18
  const knowledgeBaseId = params.id;
14
19
 
15
20
  const useFetchEvaluation = useKnowledgeBaseStore((s) => s.useFetchEvaluationList);
@@ -3,20 +3,21 @@ import { PropsWithChildren } from 'react';
3
3
  import { Flexbox } from 'react-layout-kit';
4
4
 
5
5
  import { serverFeatureFlags } from '@/config/featureFlags';
6
+ import { PagePropsWithId } from '@/types/next';
6
7
 
7
8
  import Container from './components/Container';
8
9
  import { Tabs } from './components/Tabs';
9
- import { PageProps } from './type';
10
10
 
11
- export default ({ children, params }: PropsWithChildren<PageProps>) => {
11
+ export default async (props: PropsWithChildren<PagePropsWithId>) => {
12
12
  const enableRAGEval = serverFeatureFlags().enableRAGEval;
13
+ const params = await props.params;
13
14
 
14
15
  if (!enableRAGEval) return notFound();
15
16
 
16
17
  return (
17
18
  <Flexbox gap={24} height={'100%'} padding={24} style={{ paddingTop: 0 }}>
18
19
  <Tabs knowledgeBaseId={params.id} />
19
- <Container>{children}</Container>
20
+ <Container>{props.children}</Container>
20
21
  </Flexbox>
21
22
  );
22
23
  };
@@ -1,9 +1,9 @@
1
1
  import { redirect } from 'next/navigation';
2
2
 
3
- interface Params {
4
- id: string;
5
- }
3
+ import { PagePropsWithId } from '@/types/next';
6
4
 
7
- type Props = { params: Params };
5
+ export default async (props: PagePropsWithId) => {
6
+ const params = await props.params;
8
7
 
9
- export default ({ params }: Props) => redirect(`/repos/${params.id}/evals/dataset`);
8
+ return redirect(`/repos/${params.id}/evals/dataset`);
9
+ };
@@ -8,6 +8,4 @@ const Layout = ServerLayout<LayoutProps>({ Desktop, Mobile });
8
8
 
9
9
  Layout.displayName = 'RepoLayout';
10
10
 
11
- export default (props: LayoutProps) => {
12
- return <Layout {...props} />;
13
- };
11
+ export default (props: LayoutProps) => <Layout {...props} />;
@@ -3,14 +3,11 @@ import { redirect } from 'next/navigation';
3
3
  import { serverDB } from '@/database/server';
4
4
  import { KnowledgeBaseModel } from '@/database/server/models/knowledgeBase';
5
5
  import FileManager from '@/features/FileManager';
6
+ import { PagePropsWithId } from '@/types/next';
6
7
 
7
- interface Params {
8
- id: string;
9
- }
8
+ export default async (props: PagePropsWithId) => {
9
+ const params = await props.params;
10
10
 
11
- type Props = { params: Params };
12
-
13
- export default async ({ params }: Props) => {
14
11
  const item = await KnowledgeBaseModel.findById(serverDB, params.id);
15
12
 
16
13
  if (!item) return redirect('/repos');
@@ -4,12 +4,10 @@ import { LobeChatPluginMeta, Meta } from '@lobehub/chat-plugin-sdk/lib/types/mar
4
4
  import { Locales } from '@/locales/resources';
5
5
  import { ChatModelCard, ModelProviderCard } from '@/types/llm';
6
6
  import { MetaData } from '@/types/meta';
7
+ import { PageProps } from '@/types/next';
7
8
  import { LobeAgentSettings } from '@/types/session';
8
9
 
9
- export interface DiscoverPageProps {
10
- params: Promise<{ slug: string }>;
11
- searchParams: Promise<{ hl?: Locales }>;
12
- }
10
+ export type DiscoverPageProps<T = string> = PageProps<{ slug: T }, { hl?: Locales }>;
13
11
 
14
12
  export enum AssistantCategory {
15
13
  Academic = 'academic',
@@ -0,0 +1,6 @@
1
+ export interface PageProps<Params, SearchParams = undefined> {
2
+ params: Promise<Params>;
3
+ searchParams: Promise<SearchParams>;
4
+ }
5
+
6
+ export type PagePropsWithId = PageProps<{ id: string }>;
@@ -1,5 +0,0 @@
1
- interface Params {
2
- id: string;
3
- }
4
-
5
- export type PageProps = { params: Params };