@lobehub/chat 1.35.13 → 1.36.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 (33) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/Dockerfile +3 -1
  3. package/changelog/v1.json +18 -0
  4. package/package.json +1 -1
  5. package/scripts/migrateServerDB/errorHint.js +19 -0
  6. package/scripts/migrateServerDB/index.ts +16 -6
  7. package/src/app/(main)/discover/(detail)/model/[...slugs]/page.tsx +10 -3
  8. package/src/app/(main)/discover/(detail)/plugin/[slug]/page.tsx +8 -4
  9. package/src/app/(main)/discover/(detail)/provider/[slug]/page.tsx +8 -5
  10. package/src/app/(main)/discover/(list)/assistants/[slug]/page.tsx +8 -5
  11. package/src/app/(main)/discover/(list)/models/[slug]/page.tsx +8 -5
  12. package/src/app/(main)/discover/(list)/plugins/[slug]/page.tsx +8 -5
  13. package/src/app/(main)/discover/search/page.tsx +12 -6
  14. package/src/app/(main)/files/(content)/@modal/(.)[id]/page.tsx +4 -6
  15. package/src/app/(main)/files/[id]/page.tsx +4 -7
  16. package/src/app/(main)/repos/[id]/evals/dataset/page.tsx +7 -2
  17. package/src/app/(main)/repos/[id]/evals/evaluation/page.tsx +7 -2
  18. package/src/app/(main)/repos/[id]/evals/layout.tsx +4 -3
  19. package/src/app/(main)/repos/[id]/evals/page.tsx +5 -5
  20. package/src/app/(main)/repos/[id]/layout.tsx +1 -3
  21. package/src/app/(main)/repos/[id]/page.tsx +3 -6
  22. package/src/app/(main)/settings/llm/ProviderList/providers.tsx +3 -1
  23. package/src/config/llm.ts +8 -1
  24. package/src/config/modelProviders/higress.ts +2503 -0
  25. package/src/config/modelProviders/index.ts +4 -0
  26. package/src/const/settings/llm.ts +1 -2
  27. package/src/libs/agent-runtime/AgentRuntime.ts +7 -0
  28. package/src/libs/agent-runtime/higress/index.ts +45 -0
  29. package/src/libs/agent-runtime/types/type.ts +1 -0
  30. package/src/types/discover.ts +2 -4
  31. package/src/types/next.ts +6 -0
  32. package/src/types/user/settings/keyVaults.ts +1 -0
  33. package/src/app/(main)/repos/[id]/evals/type.ts +0 -5
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 1.36.0](https://github.com/lobehub/lobe-chat/compare/v1.35.14...v1.36.0)
6
+
7
+ <sup>Released on **2024-12-06**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **misc**: Add Higress ai model provider.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **misc**: Add Higress ai model provider, closes [#4755](https://github.com/lobehub/lobe-chat/issues/4755) ([835bbf6](https://github.com/lobehub/lobe-chat/commit/835bbf6))
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.14](https://github.com/lobehub/lobe-chat/compare/v1.35.13...v1.35.14)
31
+
32
+ <sup>Released on **2024-12-06**</sup>
33
+
34
+ #### ♻ Code Refactoring
35
+
36
+ - **misc**: Refactor page params to adapt next15 breaking change.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### Code refactoring
44
+
45
+ - **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))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ### [Version 1.35.13](https://github.com/lobehub/lobe-chat/compare/v1.35.12...v1.35.13)
6
56
 
7
57
  <sup>Released on **2024-12-06**</sup>
package/Dockerfile CHANGED
@@ -211,7 +211,9 @@ ENV \
211
211
  # 01.AI
212
212
  ZEROONE_API_KEY="" ZEROONE_MODEL_LIST="" \
213
213
  # Zhipu
214
- ZHIPU_API_KEY="" ZHIPU_MODEL_LIST=""
214
+ ZHIPU_API_KEY="" ZHIPU_MODEL_LIST="" \
215
+ # Higress
216
+ HIGRESS_API_KEY="" HIGRESS_MODEL_LIST=""
215
217
 
216
218
  USER nextjs
217
219
 
package/changelog/v1.json CHANGED
@@ -1,4 +1,22 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "features": [
5
+ "Add Higress ai model provider."
6
+ ]
7
+ },
8
+ "date": "2024-12-06",
9
+ "version": "1.36.0"
10
+ },
11
+ {
12
+ "children": {
13
+ "improvements": [
14
+ "Refactor page params to adapt next15 breaking change."
15
+ ]
16
+ },
17
+ "date": "2024-12-06",
18
+ "version": "1.35.14"
19
+ },
2
20
  {
3
21
  "children": {},
4
22
  "date": "2024-12-06",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.35.13",
3
+ "version": "1.36.0",
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",
@@ -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');
@@ -10,6 +10,7 @@ import {
10
10
  GiteeAIProviderCard,
11
11
  GoogleProviderCard,
12
12
  GroqProviderCard,
13
+ HigressProviderCard,
13
14
  HunyuanProviderCard,
14
15
  InternLMProviderCard,
15
16
  MinimaxProviderCard,
@@ -38,8 +39,8 @@ import { useGithubProvider } from './Github';
38
39
  import { useHuggingFaceProvider } from './HuggingFace';
39
40
  import { useOllamaProvider } from './Ollama';
40
41
  import { useOpenAIProvider } from './OpenAI';
41
- import { useWenxinProvider } from './Wenxin';
42
42
  import { useSenseNovaProvider } from './SenseNova';
43
+ import { useWenxinProvider } from './Wenxin';
43
44
 
44
45
  export const useProviderList = (): ProviderItem[] => {
45
46
  const AzureProvider = useAzureProvider();
@@ -89,6 +90,7 @@ export const useProviderList = (): ProviderItem[] => {
89
90
  TaichuProviderCard,
90
91
  InternLMProviderCard,
91
92
  SiliconCloudProviderCard,
93
+ HigressProviderCard,
92
94
  GiteeAIProviderCard,
93
95
  ],
94
96
  [
package/src/config/llm.ts CHANGED
@@ -121,6 +121,9 @@ export const getLLMConfig = () => {
121
121
 
122
122
  ENABLED_INTERNLM: z.boolean(),
123
123
  INTERNLM_API_KEY: z.string().optional(),
124
+
125
+ ENABLED_HIGRESS: z.boolean(),
126
+ HIGRESS_API_KEY: z.string().optional(),
124
127
  },
125
128
  runtimeEnv: {
126
129
  API_KEY_SELECT_MODE: process.env.API_KEY_SELECT_MODE,
@@ -231,7 +234,8 @@ export const getLLMConfig = () => {
231
234
  ENABLED_HUGGINGFACE: !!process.env.HUGGINGFACE_API_KEY,
232
235
  HUGGINGFACE_API_KEY: process.env.HUGGINGFACE_API_KEY,
233
236
 
234
- ENABLED_SENSENOVA: !!process.env.SENSENOVA_ACCESS_KEY_ID && !!process.env.SENSENOVA_ACCESS_KEY_SECRET,
237
+ ENABLED_SENSENOVA:
238
+ !!process.env.SENSENOVA_ACCESS_KEY_ID && !!process.env.SENSENOVA_ACCESS_KEY_SECRET,
235
239
  SENSENOVA_ACCESS_KEY_ID: process.env.SENSENOVA_ACCESS_KEY_ID,
236
240
  SENSENOVA_ACCESS_KEY_SECRET: process.env.SENSENOVA_ACCESS_KEY_SECRET,
237
241
 
@@ -240,6 +244,9 @@ export const getLLMConfig = () => {
240
244
 
241
245
  ENABLED_INTERNLM: !!process.env.INTERNLM_API_KEY,
242
246
  INTERNLM_API_KEY: process.env.INTERNLM_API_KEY,
247
+
248
+ ENABLED_HIGRESS: !!process.env.HIGRESS_API_KEY,
249
+ HIGRESS_API_KEY: process.env.HIGRESS_API_KEY,
243
250
  },
244
251
  });
245
252
  };