@lobehub/lobehub 2.0.0-next.63 → 2.0.0-next.64

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 (40) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/changelog/v1.json +9 -0
  3. package/package.json +1 -2
  4. package/packages/agent-runtime/src/types/event.ts +2 -1
  5. package/packages/conversation-flow/src/transformation/__tests__/MessageTransformer.test.ts +1 -2
  6. package/packages/database/src/client/db.test.ts +1 -2
  7. package/packages/database/src/client/db.ts +6 -6
  8. package/packages/database/src/core/electron.ts +1 -1
  9. package/packages/database/src/models/__tests__/asyncTask.test.ts +1 -2
  10. package/packages/database/src/models/__tests__/file.test.ts +1 -2
  11. package/packages/database/src/models/__tests__/generation.test.ts +1 -2
  12. package/packages/database/src/models/__tests__/generationBatch.test.ts +1 -2
  13. package/packages/database/src/models/aiProvider.ts +7 -7
  14. package/packages/database/src/repositories/aiInfra/index.test.ts +6 -6
  15. package/packages/database/src/repositories/aiInfra/index.ts +7 -7
  16. package/packages/database/src/repositories/dataImporter/__tests__/index.test.ts +1 -2
  17. package/packages/database/src/repositories/dataImporter/deprecated/__tests__/index.test.ts +1 -1
  18. package/packages/database/src/repositories/dataImporter/deprecated/index.ts +1 -1
  19. package/packages/database/src/repositories/dataImporter/index.ts +1 -2
  20. package/packages/database/src/repositories/tableViewer/index.ts +4 -5
  21. package/packages/database/src/schemas/agent.ts +1 -2
  22. package/packages/database/src/schemas/aiInfra.ts +1 -2
  23. package/packages/database/src/schemas/document.ts +1 -2
  24. package/packages/database/src/schemas/file.ts +1 -2
  25. package/packages/database/src/schemas/topic.ts +1 -2
  26. package/packages/database/src/schemas/user.ts +1 -1
  27. package/packages/database/src/server/models/__tests__/user.test.ts +1 -1
  28. package/packages/model-runtime/src/core/streams/vertex-ai.ts +1 -2
  29. package/packages/model-runtime/src/providers/comfyui/__tests__/index.test.ts +1 -2
  30. package/packages/model-runtime/src/providers/comfyui/auth/AuthManager.ts +1 -2
  31. package/packages/model-runtime/src/providers/comfyui/index.ts +2 -7
  32. package/packages/types/src/files/list.ts +1 -1
  33. package/packages/types/src/files/upload.ts +1 -1
  34. package/packages/types/src/importer.ts +2 -2
  35. package/packages/types/src/index.ts +4 -0
  36. package/packages/types/src/openai/image.ts +1 -1
  37. package/packages/types/src/topic/topic.ts +1 -1
  38. package/packages/types/src/user/settings/hotkey.ts +1 -1
  39. package/src/features/DataImporter/index.tsx +2 -2
  40. package/Dockerfile.lite +0 -272
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 2.0.0-next.64](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.63...v2.0.0-next.64)
6
+
7
+ <sup>Released on **2025-11-15**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: Refactor package types.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **misc**: Refactor package types, closes [#10233](https://github.com/lobehub/lobe-chat/issues/10233) ([9872409](https://github.com/lobehub/lobe-chat/commit/9872409))
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
+
5
30
  ## [Version 2.0.0-next.63](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.62...v2.0.0-next.63)
6
31
 
7
32
  <sup>Released on **2025-11-15**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,13 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "improvements": [
5
+ "Refactor package types."
6
+ ]
7
+ },
8
+ "date": "2025-11-15",
9
+ "version": "2.0.0-next.64"
10
+ },
2
11
  {
3
12
  "children": {
4
13
  "features": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/lobehub",
3
- "version": "2.0.0-next.63",
3
+ "version": "2.0.0-next.64",
4
4
  "description": "LobeHub - an open-source,comprehensive AI Agent 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",
@@ -75,7 +75,6 @@
75
75
  "release": "semantic-release",
76
76
  "self-hosting:docker": "docker build -t lobehub:local .",
77
77
  "self-hosting:docker-cn": "docker build -t lobehub-local --build-arg USE_CN_MIRROR=true .",
78
- "self-hosting:docker-cn@lite": "docker build -t lobehub-lite-local -f Dockerfile.lite --build-arg USE_CN_MIRROR=true .",
79
78
  "start": "next start -p 3210",
80
79
  "stylelint": "stylelint \"src/**/*.{js,jsx,ts,tsx}\" --fix",
81
80
  "test": "npm run test-app && npm run test-server",
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
2
+ import { ChatToolPayload } from '@lobechat/types';
3
+
2
4
  import type { AgentState, ToolsCalling } from './state';
3
- import { ChatToolPayload } from '@/types/message';
4
5
 
5
6
  export interface AgentEventInit {
6
7
  type: 'init';
@@ -1,7 +1,6 @@
1
+ import type { AssistantContentBlock } from '@lobechat/types';
1
2
  import { describe, expect, it } from 'vitest';
2
3
 
3
- import type { AssistantContentBlock } from '@/types/index';
4
-
5
4
  import type { Message } from '../../types';
6
5
  import { MessageTransformer } from '../MessageTransformer';
7
6
 
@@ -1,7 +1,6 @@
1
+ import { ClientDBLoadingProgress, DatabaseLoadingState } from '@lobechat/types';
1
2
  import { beforeEach, describe, expect, it, vi } from 'vitest';
2
3
 
3
- import { ClientDBLoadingProgress, DatabaseLoadingState } from '@/types/clientDB';
4
-
5
4
  import { DatabaseManager } from './db';
6
5
 
7
6
  // Mock 所有外部依赖
@@ -1,13 +1,13 @@
1
+ import {
2
+ type ClientDBLoadingProgress,
3
+ DatabaseLoadingState,
4
+ type MigrationSQL,
5
+ type MigrationTableItem,
6
+ } from '@lobechat/types';
1
7
  import { sql } from 'drizzle-orm';
2
8
  import { PgliteDatabase, drizzle } from 'drizzle-orm/pglite';
3
9
  import { Md5 } from 'ts-md5';
4
10
 
5
- import {
6
- ClientDBLoadingProgress,
7
- DatabaseLoadingState,
8
- MigrationSQL,
9
- MigrationTableItem,
10
- } from '@/types/clientDB';
11
11
  import { sleep } from '@/utils/sleep';
12
12
 
13
13
  import migrations from '../core/migrations.json';
@@ -1,11 +1,11 @@
1
1
  import { PGlite } from '@electric-sql/pglite';
2
2
  import { vector } from '@electric-sql/pglite/vector';
3
+ import type { MigrationTableItem } from '@lobechat/types';
3
4
  import { drizzle as pgliteDrizzle } from 'drizzle-orm/pglite';
4
5
  import fs from 'node:fs';
5
6
  import { Md5 } from 'ts-md5';
6
7
 
7
8
  import { electronIpcClient } from '@/server/modules/ElectronIPCClient';
8
- import { MigrationTableItem } from '@/types/clientDB';
9
9
 
10
10
  import { DrizzleMigrationModel } from '../models/drizzleMigration';
11
11
  import * as schema from '../schemas';
@@ -1,9 +1,8 @@
1
1
  // @vitest-environment node
2
+ import { AsyncTaskStatus, AsyncTaskType } from '@lobechat/types';
2
3
  import { eq } from 'drizzle-orm';
3
4
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
4
5
 
5
- import { AsyncTaskStatus, AsyncTaskType } from '@/types/asyncTask';
6
-
7
6
  import { asyncTasks, users } from '../../schemas';
8
7
  import { LobeChatDatabase } from '../../type';
9
8
  import { ASYNC_TASK_TIMEOUT, AsyncTaskModel } from '../asyncTask';
@@ -1,9 +1,8 @@
1
1
  // @vitest-environment node
2
+ import { FilesTabs, SortType } from '@lobechat/types';
2
3
  import { eq, inArray } from 'drizzle-orm';
3
4
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
4
5
 
5
- import { FilesTabs, SortType } from '@/types/files';
6
-
7
6
  import {
8
7
  chunks,
9
8
  embeddings,
@@ -1,10 +1,9 @@
1
1
  // @vitest-environment node
2
2
  import { AsyncTaskStatus, ImageGenerationAsset } from '@lobechat/types';
3
+ import { FileSource } from '@lobechat/types';
3
4
  import { eq } from 'drizzle-orm';
4
5
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
5
6
 
6
- import { FileSource } from '@/types/files';
7
-
8
7
  import {
9
8
  NewGeneration,
10
9
  asyncTasks,
@@ -1,10 +1,9 @@
1
1
  // @vitest-environment node
2
2
  import { GenerationConfig } from '@lobechat/types';
3
+ import { AsyncTaskStatus } from '@lobechat/types';
3
4
  import { eq } from 'drizzle-orm';
4
5
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
5
6
 
6
- import { AsyncTaskStatus } from '@/types/asyncTask';
7
-
8
7
  import {
9
8
  NewGenerationBatch,
10
9
  generationBatches,
@@ -1,15 +1,15 @@
1
- import { and, asc, desc, eq } from 'drizzle-orm';
2
- import { isEmpty } from 'lodash-es';
3
- import { ModelProvider } from 'model-bank';
4
-
5
- import { DEFAULT_MODEL_PROVIDER_LIST } from '@/config/modelProviders';
6
- import {
1
+ import type {
7
2
  AiProviderDetailItem,
8
3
  AiProviderListItem,
9
4
  AiProviderRuntimeConfig,
10
5
  CreateAiProviderParams,
11
6
  UpdateAiProviderConfigParams,
12
- } from '@/types/aiProvider';
7
+ } from '@lobechat/types';
8
+ import { and, asc, desc, eq } from 'drizzle-orm';
9
+ import { isEmpty } from 'lodash-es';
10
+ import { ModelProvider } from 'model-bank';
11
+
12
+ import { DEFAULT_MODEL_PROVIDER_LIST } from '@/config/modelProviders';
13
13
  import { merge } from '@/utils/merge';
14
14
 
15
15
  import { AiProviderSelectItem, aiModels, aiProviders } from '../schemas';
@@ -1,14 +1,14 @@
1
+ import type {
2
+ AiProviderDetailItem,
3
+ AiProviderListItem,
4
+ AiProviderRuntimeConfig,
5
+ EnabledProvider,
6
+ } from '@lobechat/types';
1
7
  import { AiProviderModelListItem, EnabledAiModel } from 'model-bank';
2
8
  import { beforeEach, describe, expect, it, vi } from 'vitest';
3
9
 
4
10
  import { DEFAULT_MODEL_PROVIDER_LIST } from '@/config/modelProviders';
5
11
  import { clientDB, initializeDB } from '@/database/client/db';
6
- import {
7
- AiProviderDetailItem,
8
- AiProviderListItem,
9
- AiProviderRuntimeConfig,
10
- EnabledProvider,
11
- } from '@/types/aiProvider';
12
12
 
13
13
  import { AiInfraRepos } from './index';
14
14
 
@@ -1,3 +1,10 @@
1
+ import type {
2
+ AiProviderDetailItem,
3
+ AiProviderListItem,
4
+ AiProviderRuntimeState,
5
+ EnabledProvider,
6
+ ProviderConfig,
7
+ } from '@lobechat/types';
1
8
  import { isEmpty } from 'lodash-es';
2
9
  import {
3
10
  AIChatModelCard,
@@ -8,13 +15,6 @@ import {
8
15
  import pMap from 'p-map';
9
16
 
10
17
  import { DEFAULT_MODEL_PROVIDER_LIST } from '@/config/modelProviders';
11
- import {
12
- AiProviderDetailItem,
13
- AiProviderListItem,
14
- AiProviderRuntimeState,
15
- EnabledProvider,
16
- } from '@/types/aiProvider';
17
- import { ProviderConfig } from '@/types/user/settings';
18
18
  import { merge, mergeArrayById } from '@/utils/merge';
19
19
 
20
20
  import { AiModelModel } from '../../models/aiModel';
@@ -1,8 +1,7 @@
1
+ import type { ImportPgDataStructure } from '@lobechat/types';
1
2
  import { eq, inArray } from 'drizzle-orm';
2
3
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
3
4
 
4
- import { ImportPgDataStructure } from '@/types/export';
5
-
6
5
  import { getTestDB } from '../../../models/__tests__/_util';
7
6
  import * as Schema from '../../../schemas';
8
7
  import { DataImporterRepos } from '../index';
@@ -1,4 +1,5 @@
1
1
  // @vitest-environment node
2
+ import type { ImporterEntryData } from '@lobechat/types';
2
3
  import { eq, inArray } from 'drizzle-orm';
3
4
  import { beforeEach, describe, expect, it, vi } from 'vitest';
4
5
 
@@ -12,7 +13,6 @@ import {
12
13
  topics,
13
14
  users,
14
15
  } from '@/database/schemas';
15
- import { ImporterEntryData } from '@/types/importer';
16
16
 
17
17
  import { DeprecatedDataImporterRepos as DataImporterRepos } from '../index';
18
18
  import mockImportData from './fixtures/messages.json';
@@ -1,6 +1,6 @@
1
+ import type { ImporterEntryData } from '@lobechat/types';
1
2
  import { and, eq, inArray, sql } from 'drizzle-orm';
2
3
 
3
- import { ImporterEntryData } from '@/types/importer';
4
4
  import { sanitizeUTF8 } from '@/utils/sanitizeUTF8';
5
5
 
6
6
  import {
@@ -1,7 +1,6 @@
1
+ import type { ImportPgDataStructure, ImportResultData, ImporterEntryData } from '@lobechat/types';
1
2
  import { and, eq, inArray } from 'drizzle-orm';
2
3
 
3
- import { ImportPgDataStructure } from '@/types/export';
4
- import { ImportResultData, ImporterEntryData } from '@/types/importer';
5
4
  import { uuid } from '@/utils/uuid';
6
5
 
7
6
  import * as EXPORT_TABLES from '../../schemas';
@@ -1,12 +1,11 @@
1
- import { sql } from 'drizzle-orm';
2
- import pMap from 'p-map';
3
-
4
- import {
1
+ import type {
5
2
  FilterCondition,
6
3
  PaginationParams,
7
4
  TableBasicInfo,
8
5
  TableColumnInfo,
9
- } from '@/types/tableViewer';
6
+ } from '@lobechat/types';
7
+ import { sql } from 'drizzle-orm';
8
+ import pMap from 'p-map';
10
9
 
11
10
  import { LobeChatDatabase } from '../../type';
12
11
 
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable sort-keys-fix/sort-keys-fix */
2
+ import type { LobeAgentChatConfig, LobeAgentTTSConfig } from '@lobechat/types';
2
3
  import {
3
4
  boolean,
4
5
  index,
@@ -11,8 +12,6 @@ import {
11
12
  } from 'drizzle-orm/pg-core';
12
13
  import { createInsertSchema } from 'drizzle-zod';
13
14
 
14
- import { LobeAgentChatConfig, LobeAgentTTSConfig } from '@/types/agent';
15
-
16
15
  import { idGenerator, randomSlug } from '../utils/idGenerator';
17
16
  import { timestamps } from './_helpers';
18
17
  import { files, knowledgeBases } from './file';
@@ -1,9 +1,8 @@
1
1
  /* eslint-disable sort-keys-fix/sort-keys-fix */
2
+ import type { AiProviderConfig, AiProviderSettings } from '@lobechat/types';
2
3
  import { boolean, integer, jsonb, pgTable, primaryKey, text, varchar } from 'drizzle-orm/pg-core';
3
4
  import { AiModelSettings } from 'model-bank';
4
5
 
5
- import { AiProviderConfig, AiProviderSettings } from '@/types/aiProvider';
6
-
7
6
  import { timestamps } from './_helpers';
8
7
  import { users } from './user';
9
8
 
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable sort-keys-fix/sort-keys-fix */
2
+ import type { LobeDocumentPage } from '@lobechat/types';
2
3
  import {
3
4
  index,
4
5
  integer,
@@ -12,8 +13,6 @@ import {
12
13
  } from 'drizzle-orm/pg-core';
13
14
  import { createInsertSchema } from 'drizzle-zod';
14
15
 
15
- import { LobeDocumentPage } from '@/types/document';
16
-
17
16
  import { idGenerator } from '../utils/idGenerator';
18
17
  import { createdAt, timestamps } from './_helpers';
19
18
  import { files } from './file';
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable sort-keys-fix/sort-keys-fix */
2
+ import { FileSource } from '@lobechat/types';
2
3
  import {
3
4
  boolean,
4
5
  index,
@@ -13,8 +14,6 @@ import {
13
14
  } from 'drizzle-orm/pg-core';
14
15
  import { createInsertSchema } from 'drizzle-zod';
15
16
 
16
- import { FileSource } from '@/types/files';
17
-
18
17
  import { idGenerator } from '../utils/idGenerator';
19
18
  import { accessedAt, createdAt, timestamps } from './_helpers';
20
19
  import { asyncTasks } from './asyncTask';
@@ -1,9 +1,8 @@
1
1
  /* eslint-disable sort-keys-fix/sort-keys-fix */
2
+ import type { ChatTopicMetadata } from '@lobechat/types';
2
3
  import { boolean, index, jsonb, pgTable, primaryKey, text, uniqueIndex } from 'drizzle-orm/pg-core';
3
4
  import { createInsertSchema } from 'drizzle-zod';
4
5
 
5
- import { ChatTopicMetadata } from '@/types/topic';
6
-
7
6
  import { idGenerator } from '../utils/idGenerator';
8
7
  import { createdAt, timestamps, timestamptz } from './_helpers';
9
8
  import { chatGroups } from './chatGroup';
@@ -1,9 +1,9 @@
1
1
  /* eslint-disable sort-keys-fix/sort-keys-fix */
2
+ import type { CustomPluginParams } from '@lobechat/types';
2
3
  import { LobeChatPluginManifest } from '@lobehub/chat-plugin-sdk';
3
4
  import { boolean, jsonb, pgTable, primaryKey, text } from 'drizzle-orm/pg-core';
4
5
 
5
6
  import { DEFAULT_PREFERENCE } from '@/const/user';
6
- import { CustomPluginParams } from '@/types/tool/plugin';
7
7
 
8
8
  import { timestamps, timestamptz } from './_helpers';
9
9
 
@@ -1,3 +1,4 @@
1
+ import type { UserGuide, UserPreference } from '@lobechat/types';
1
2
  import { TRPCError } from '@trpc/server';
2
3
  import dayjs from 'dayjs';
3
4
  import { count, eq } from 'drizzle-orm';
@@ -5,7 +6,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
5
6
 
6
7
  import { INBOX_SESSION_ID } from '@/const/session';
7
8
  import { KeyVaultsGateKeeper } from '@/server/modules/KeyVaultsEncrypt';
8
- import { UserGuide, UserPreference } from '@/types/user';
9
9
 
10
10
  import { getTestDBInstance } from '../../../core/dbForTest';
11
11
  import { SessionModel } from '../../../models/session';
@@ -1,6 +1,5 @@
1
1
  import { GenerateContentResponse } from '@google/genai';
2
-
3
- import { GroundingSearch } from '@/types/search';
2
+ import { GroundingSearch } from '@lobechat/types';
4
3
 
5
4
  import { nanoid } from '../../utils/uuid';
6
5
  import { convertGoogleAIUsage } from '../usageConverters/google-ai';
@@ -1,9 +1,8 @@
1
1
  // @vitest-environment node
2
+ import type { ComfyUIKeyVault } from '@lobechat/types';
2
3
  import { createBasicAuthCredentials } from '@lobechat/utils';
3
4
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
4
5
 
5
- import type { ComfyUIKeyVault } from '@/types/index';
6
-
7
6
  import type { CreateImagePayload } from '../../../types/image';
8
7
  import { LobeComfyUI } from '../index';
9
8
 
@@ -1,7 +1,6 @@
1
+ import type { ComfyUIKeyVault } from '@lobechat/types';
1
2
  import { createBasicAuthCredentials } from '@lobechat/utils';
2
3
 
3
- import type { ComfyUIKeyVault } from '@/types/index';
4
-
5
4
  export interface BasicCredentials {
6
5
  password: string;
7
6
  type: 'basic';
@@ -1,14 +1,9 @@
1
+ import type { ComfyUIKeyVault } from '@lobechat/types';
1
2
  import { createBasicAuthCredentials } from '@lobechat/utils';
2
3
  import debug from 'debug';
3
4
 
4
- import type { ComfyUIKeyVault } from '@/types/index';
5
-
6
5
  import { LobeRuntimeAI } from '../../core/BaseAI';
7
- import {
8
- AuthenticatedImageRuntime,
9
- CreateImagePayload,
10
- CreateImageResponse,
11
- } from '../../types/image';
6
+ import { AuthenticatedImageRuntime, CreateImagePayload, CreateImageResponse } from '../../types';
12
7
  import { parseComfyUIErrorMessage } from '../../utils/comfyuiErrorParser';
13
8
  import { AgentRuntimeError } from '../../utils/createError';
14
9
 
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
 
3
- import { AsyncTaskStatus } from '@/types/asyncTask';
3
+ import type { AsyncTaskStatus } from '../asyncTask';
4
4
 
5
5
  export interface FileListItem {
6
6
  chunkCount: number | null;
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
 
3
- import { FileParsingTask } from '@/types/asyncTask';
3
+ import type { FileParsingTask } from '../asyncTask';
4
4
 
5
5
  export interface FileUploadState {
6
6
  progress: number;
@@ -116,7 +116,7 @@ export enum ImportStage {
116
116
  Finished,
117
117
  }
118
118
 
119
- export interface FileUploadState {
119
+ export interface ImportFileUploadState {
120
120
  progress: number;
121
121
  /**
122
122
  * rest time in ms
@@ -137,7 +137,7 @@ export interface ErrorShape {
137
137
 
138
138
  export interface OnImportCallbacks {
139
139
  onError?: (error: ErrorShape) => void;
140
- onFileUploading?: (state: FileUploadState) => void;
140
+ onFileUploading?: (state: ImportFileUploadState) => void;
141
141
  onStageChange?: (stage: ImportStage) => void;
142
142
  /**
143
143
  *
@@ -8,11 +8,14 @@ export * from './chatGroup';
8
8
  export * from './chunk';
9
9
  export * from './clientDB';
10
10
  export * from './discover';
11
+ export * from './document';
11
12
  export * from './eval';
13
+ export * from './export';
12
14
  export * from './fetch';
13
15
  export * from './files';
14
16
  export * from './generation';
15
17
  export * from './hotkey';
18
+ export * from './importer';
16
19
  export * from './knowledgeBase';
17
20
  export * from './llm';
18
21
  export * from './message';
@@ -23,6 +26,7 @@ export * from './search';
23
26
  export * from './serverConfig';
24
27
  export * from './service';
25
28
  export * from './session';
29
+ export * from './tableViewer';
26
30
  export * from './tool';
27
31
  export * from './topic';
28
32
  export * from './user';
@@ -1,4 +1,4 @@
1
- import { DallEImageQuality, DallEImageSize, DallEImageStyle } from '@/types/tool/dalle';
1
+ import type { DallEImageQuality, DallEImageSize, DallEImageStyle } from '../tool/dalle';
2
2
 
3
3
  export interface OpenAIImagePayload {
4
4
  model: 'dall-e-2' | 'dall-e-3';
@@ -1,4 +1,4 @@
1
- import { BaseDataModel } from '@/types/meta';
1
+ import type { BaseDataModel } from '../meta';
2
2
 
3
3
  // 类型定义
4
4
  export type TimeGroupId =
@@ -1,3 +1,3 @@
1
- import { HotkeyId } from '@/types/hotkey';
1
+ import type { HotkeyId } from '../../hotkey';
2
2
 
3
3
  export type UserHotkeyConfig = Record<HotkeyId, string>;
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
 
3
+ import { ErrorShape, ImportFileUploadState, ImportStage } from '@lobechat/types';
3
4
  import { Upload } from 'antd';
4
5
  import { createStyles } from 'antd-style';
5
6
  import { ImportIcon } from 'lucide-react';
@@ -12,7 +13,6 @@ import { importService } from '@/services/import';
12
13
  import { useChatStore } from '@/store/chat';
13
14
  import { useSessionStore } from '@/store/session';
14
15
  import { ImportPgDataStructure } from '@/types/export';
15
- import { ErrorShape, FileUploadState, ImportStage } from '@/types/importer';
16
16
 
17
17
  import ImportError from './Error';
18
18
  import { FileUploading } from './FileUploading';
@@ -64,7 +64,7 @@ const DataImporter = memo<DataImporterProps>(({ children, onFinishImport }) => {
64
64
  const [duration, setDuration] = useState(0);
65
65
  const [importState, setImportState] = useState(ImportStage.Start);
66
66
 
67
- const [fileUploadingState, setUploadingState] = useState<FileUploadState | undefined>();
67
+ const [fileUploadingState, setUploadingState] = useState<ImportFileUploadState | undefined>();
68
68
  const [importError, setImportError] = useState<ErrorShape | undefined>();
69
69
  const [importResults, setImportResults] = useState<ImportResults | undefined>();
70
70
  const [showImportModal, setShowImportModal] = useState(false);
package/Dockerfile.lite DELETED
@@ -1,272 +0,0 @@
1
- ## Set global build ENV
2
- ARG NODEJS_VERSION="24"
3
-
4
- ## Base image for all building stages
5
- FROM node:${NODEJS_VERSION}-slim AS base
6
-
7
- ARG USE_CN_MIRROR
8
-
9
- ENV DEBIAN_FRONTEND="noninteractive"
10
-
11
- RUN \
12
- # If you want to build docker in China, build with --build-arg USE_CN_MIRROR=true
13
- if [ "${USE_CN_MIRROR:-false}" = "true" ]; then \
14
- sed -i "s/deb.debian.org/mirrors.ustc.edu.cn/g" "/etc/apt/sources.list.d/debian.sources"; \
15
- fi \
16
- # Add required package
17
- && apt update \
18
- && apt install ca-certificates proxychains-ng -qy \
19
- # Prepare required package to distroless
20
- && mkdir -p /distroless/bin /distroless/etc /distroless/etc/ssl/certs /distroless/lib \
21
- # Copy proxychains to distroless
22
- && cp /usr/lib/$(arch)-linux-gnu/libproxychains.so.4 /distroless/lib/libproxychains.so.4 \
23
- && cp /usr/lib/$(arch)-linux-gnu/libdl.so.2 /distroless/lib/libdl.so.2 \
24
- && cp /usr/bin/proxychains4 /distroless/bin/proxychains \
25
- && cp /etc/proxychains4.conf /distroless/etc/proxychains4.conf \
26
- # Copy node to distroless
27
- && cp /usr/lib/$(arch)-linux-gnu/libstdc++.so.6 /distroless/lib/libstdc++.so.6 \
28
- && cp /usr/lib/$(arch)-linux-gnu/libgcc_s.so.1 /distroless/lib/libgcc_s.so.1 \
29
- && cp /usr/local/bin/node /distroless/bin/node \
30
- # Copy CA certificates to distroless
31
- && cp /etc/ssl/certs/ca-certificates.crt /distroless/etc/ssl/certs/ca-certificates.crt \
32
- # Cleanup temp files
33
- && rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*
34
-
35
- ## Builder image, install all the dependencies and build the app
36
- FROM base AS builder
37
-
38
- ARG USE_CN_MIRROR
39
- ARG NEXT_PUBLIC_BASE_PATH
40
- ARG NEXT_PUBLIC_SENTRY_DSN
41
- ARG NEXT_PUBLIC_ANALYTICS_POSTHOG
42
- ARG NEXT_PUBLIC_POSTHOG_HOST
43
- ARG NEXT_PUBLIC_POSTHOG_KEY
44
- ARG NEXT_PUBLIC_ANALYTICS_UMAMI
45
- ARG NEXT_PUBLIC_UMAMI_SCRIPT_URL
46
- ARG NEXT_PUBLIC_UMAMI_WEBSITE_ID
47
- ARG FEATURE_FLAGS
48
-
49
- ENV NEXT_PUBLIC_CLIENT_DB="pglite"
50
- ENV NEXT_PUBLIC_BASE_PATH="${NEXT_PUBLIC_BASE_PATH}" \
51
- FEATURE_FLAGS="${FEATURE_FLAGS}"
52
-
53
- # Sentry
54
- ENV NEXT_PUBLIC_SENTRY_DSN="${NEXT_PUBLIC_SENTRY_DSN}" \
55
- SENTRY_ORG="" \
56
- SENTRY_PROJECT=""
57
-
58
- ENV APP_URL="http://app.com"
59
-
60
- # Posthog
61
- ENV NEXT_PUBLIC_ANALYTICS_POSTHOG="${NEXT_PUBLIC_ANALYTICS_POSTHOG}" \
62
- NEXT_PUBLIC_POSTHOG_HOST="${NEXT_PUBLIC_POSTHOG_HOST}" \
63
- NEXT_PUBLIC_POSTHOG_KEY="${NEXT_PUBLIC_POSTHOG_KEY}"
64
-
65
- # Umami
66
- ENV NEXT_PUBLIC_ANALYTICS_UMAMI="${NEXT_PUBLIC_ANALYTICS_UMAMI}" \
67
- NEXT_PUBLIC_UMAMI_SCRIPT_URL="${NEXT_PUBLIC_UMAMI_SCRIPT_URL}" \
68
- NEXT_PUBLIC_UMAMI_WEBSITE_ID="${NEXT_PUBLIC_UMAMI_WEBSITE_ID}"
69
-
70
- # Node
71
- ENV NODE_OPTIONS="--max-old-space-size=6144"
72
-
73
- WORKDIR /app
74
-
75
- COPY package.json pnpm-workspace.yaml ./
76
- COPY .npmrc ./
77
- COPY packages ./packages
78
-
79
- RUN \
80
- # If you want to build docker in China, build with --build-arg USE_CN_MIRROR=true
81
- if [ "${USE_CN_MIRROR:-false}" = "true" ]; then \
82
- export SENTRYCLI_CDNURL="https://npmmirror.com/mirrors/sentry-cli"; \
83
- npm config set registry "https://registry.npmmirror.com/"; \
84
- echo 'canvas_binary_host_mirror=https://npmmirror.com/mirrors/canvas' >> .npmrc; \
85
- fi \
86
- # Set the registry for corepack
87
- && export COREPACK_NPM_REGISTRY=$(npm config get registry | sed 's/\/$//') \
88
- # Update corepack to latest (nodejs/corepack#612)
89
- && npm i -g corepack@latest \
90
- # Enable corepack
91
- && corepack enable \
92
- # Use pnpm for corepack
93
- && corepack use $(sed -n 's/.*"packageManager": "\(.*\)".*/\1/p' package.json) \
94
- # Install the dependencies
95
- && pnpm i
96
-
97
- COPY . .
98
-
99
- # run build standalone for docker version
100
- RUN npm run build:docker
101
-
102
- ## Application image, copy all the files for production
103
- FROM busybox:latest AS app
104
-
105
- COPY --from=base /distroless/ /
106
-
107
- # Automatically leverage output traces to reduce image size
108
- # https://nextjs.org/docs/advanced-features/output-file-tracing
109
- COPY --from=builder /app/.next/standalone /app/
110
-
111
- # Copy server launcher
112
- COPY --from=builder /app/scripts/serverLauncher/startServer.js /app/startServer.js
113
-
114
- RUN \
115
- # Add nextjs:nodejs to run the app
116
- addgroup -S -g 1001 nodejs \
117
- && adduser -D -G nodejs -H -S -h /app -u 1001 nextjs \
118
- # Set permission for nextjs:nodejs
119
- && chown -R nextjs:nodejs /app /etc/proxychains4.conf
120
-
121
- ## Production image, copy all the files and run next
122
- FROM scratch
123
-
124
- # Copy all the files from app, set the correct permission for prerender cache
125
- COPY --from=app / /
126
-
127
- ENV NODE_ENV="production" \
128
- NODE_OPTIONS="--dns-result-order=ipv4first --use-openssl-ca" \
129
- NODE_EXTRA_CA_CERTS="" \
130
- NODE_TLS_REJECT_UNAUTHORIZED="" \
131
- SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"
132
-
133
- # Make the middleware rewrite through local as default
134
- # refs: https://github.com/lobehub/lobe-chat/issues/5876
135
- ENV MIDDLEWARE_REWRITE_THROUGH_LOCAL="1"
136
-
137
- # set hostname to localhost
138
- ENV HOSTNAME="0.0.0.0" \
139
- PORT="3210"
140
-
141
- # General Variables
142
- ENV ACCESS_CODE="" \
143
- API_KEY_SELECT_MODE="" \
144
- DEFAULT_AGENT_CONFIG="" \
145
- SYSTEM_AGENT="" \
146
- FEATURE_FLAGS="" \
147
- PROXY_URL="" \
148
- ENABLE_AUTH_PROTECTION=""
149
-
150
- # Model Variables
151
- ENV \
152
- # AI21
153
- AI21_API_KEY="" AI21_MODEL_LIST="" \
154
- # Ai360
155
- AI360_API_KEY="" AI360_MODEL_LIST="" \
156
- # AiHubMix
157
- AIHUBMIX_API_KEY="" AIHUBMIX_MODEL_LIST="" \
158
- # Anthropic
159
- ANTHROPIC_API_KEY="" ANTHROPIC_MODEL_LIST="" ANTHROPIC_PROXY_URL="" \
160
- # Amazon Bedrock
161
- ENABLED_AWS_BEDROCK="" AWS_ACCESS_KEY_ID="" AWS_SECRET_ACCESS_KEY="" AWS_REGION="" AWS_BEDROCK_MODEL_LIST="" \
162
- # Azure OpenAI
163
- AZURE_API_KEY="" AZURE_API_VERSION="" AZURE_ENDPOINT="" AZURE_MODEL_LIST="" \
164
- # Baichuan
165
- BAICHUAN_API_KEY="" BAICHUAN_MODEL_LIST="" \
166
- # Cloudflare
167
- CLOUDFLARE_API_KEY="" CLOUDFLARE_BASE_URL_OR_ACCOUNT_ID="" CLOUDFLARE_MODEL_LIST="" \
168
- # Cohere
169
- COHERE_API_KEY="" COHERE_MODEL_LIST="" COHERE_PROXY_URL="" \
170
- # ComfyUI
171
- ENABLED_COMFYUI="" COMFYUI_BASE_URL="" COMFYUI_AUTH_TYPE="" \
172
- COMFYUI_API_KEY="" COMFYUI_USERNAME="" COMFYUI_PASSWORD="" COMFYUI_CUSTOM_HEADERS="" \
173
- # DeepSeek
174
- DEEPSEEK_API_KEY="" DEEPSEEK_MODEL_LIST="" \
175
- # Fireworks AI
176
- FIREWORKSAI_API_KEY="" FIREWORKSAI_MODEL_LIST="" \
177
- # Gitee AI
178
- GITEE_AI_API_KEY="" GITEE_AI_MODEL_LIST="" \
179
- # GitHub
180
- GITHUB_TOKEN="" GITHUB_MODEL_LIST="" \
181
- # Google
182
- GOOGLE_API_KEY="" GOOGLE_MODEL_LIST="" GOOGLE_PROXY_URL="" \
183
- # Groq
184
- GROQ_API_KEY="" GROQ_MODEL_LIST="" GROQ_PROXY_URL="" \
185
- # Higress
186
- HIGRESS_API_KEY="" HIGRESS_MODEL_LIST="" HIGRESS_PROXY_URL="" \
187
- # HuggingFace
188
- HUGGINGFACE_API_KEY="" HUGGINGFACE_MODEL_LIST="" HUGGINGFACE_PROXY_URL="" \
189
- # Hunyuan
190
- HUNYUAN_API_KEY="" HUNYUAN_MODEL_LIST="" \
191
- # InternLM
192
- INTERNLM_API_KEY="" INTERNLM_MODEL_LIST="" \
193
- # Jina
194
- JINA_API_KEY="" JINA_MODEL_LIST="" JINA_PROXY_URL="" \
195
- # Minimax
196
- MINIMAX_API_KEY="" MINIMAX_MODEL_LIST="" \
197
- # Mistral
198
- MISTRAL_API_KEY="" MISTRAL_MODEL_LIST="" \
199
- # ModelScope
200
- MODELSCOPE_API_KEY="" MODELSCOPE_MODEL_LIST="" MODELSCOPE_PROXY_URL="" \
201
- # Moonshot
202
- MOONSHOT_API_KEY="" MOONSHOT_MODEL_LIST="" MOONSHOT_PROXY_URL="" \
203
- # Nebius
204
- NEBIUS_API_KEY="" NEBIUS_MODEL_LIST="" NEBIUS_PROXY_URL="" \
205
- # NewAPI
206
- NEWAPI_API_KEY="" NEWAPI_PROXY_URL="" \
207
- # Novita
208
- NOVITA_API_KEY="" NOVITA_MODEL_LIST="" \
209
- # Nvidia NIM
210
- NVIDIA_API_KEY="" NVIDIA_MODEL_LIST="" NVIDIA_PROXY_URL="" \
211
- # Ollama
212
- ENABLED_OLLAMA="" OLLAMA_MODEL_LIST="" OLLAMA_PROXY_URL="" \
213
- # OpenAI
214
- ENABLED_OPENAI="" OPENAI_API_KEY="" OPENAI_MODEL_LIST="" OPENAI_PROXY_URL="" \
215
- # OpenRouter
216
- OPENROUTER_API_KEY="" OPENROUTER_MODEL_LIST="" \
217
- # Perplexity
218
- PERPLEXITY_API_KEY="" PERPLEXITY_MODEL_LIST="" PERPLEXITY_PROXY_URL="" \
219
- # Qiniu
220
- QINIU_API_KEY="" QINIU_MODEL_LIST="" QINIU_PROXY_URL="" \
221
- # Qwen
222
- QWEN_API_KEY="" QWEN_MODEL_LIST="" QWEN_PROXY_URL="" \
223
- # SambaNova
224
- SAMBANOVA_API_KEY="" SAMBANOVA_MODEL_LIST="" \
225
- # SenseNova
226
- SENSENOVA_API_KEY="" SENSENOVA_MODEL_LIST="" \
227
- # SiliconCloud
228
- SILICONCLOUD_API_KEY="" SILICONCLOUD_MODEL_LIST="" SILICONCLOUD_PROXY_URL="" \
229
- # Spark
230
- SPARK_API_KEY="" SPARK_MODEL_LIST="" SPARK_PROXY_URL="" SPARK_SEARCH_MODE="" \
231
- # Stepfun
232
- STEPFUN_API_KEY="" STEPFUN_MODEL_LIST="" \
233
- # Taichu
234
- TAICHU_API_KEY="" TAICHU_MODEL_LIST="" \
235
- # TogetherAI
236
- TOGETHERAI_API_KEY="" TOGETHERAI_MODEL_LIST="" \
237
- # Upstage
238
- UPSTAGE_API_KEY="" UPSTAGE_MODEL_LIST="" \
239
- # v0 (Vercel)
240
- V0_API_KEY="" V0_MODEL_LIST="" \
241
- # vLLM
242
- VLLM_API_KEY="" VLLM_MODEL_LIST="" VLLM_PROXY_URL="" \
243
- # Wenxin
244
- WENXIN_API_KEY="" WENXIN_MODEL_LIST="" \
245
- # xAI
246
- XAI_API_KEY="" XAI_MODEL_LIST="" XAI_PROXY_URL="" \
247
- # Xinference
248
- XINFERENCE_API_KEY="" XINFERENCE_MODEL_LIST="" XINFERENCE_PROXY_URL="" \
249
- # 01.AI
250
- ZEROONE_API_KEY="" ZEROONE_MODEL_LIST="" \
251
- # Zhipu
252
- ZHIPU_API_KEY="" ZHIPU_MODEL_LIST="" \
253
- # Tencent Cloud
254
- TENCENT_CLOUD_API_KEY="" TENCENT_CLOUD_MODEL_LIST="" \
255
- # Infini-AI
256
- INFINIAI_API_KEY="" INFINIAI_MODEL_LIST="" \
257
- # 302.AI
258
- AI302_API_KEY="" AI302_MODEL_LIST="" \
259
- # FAL
260
- ENABLED_FAL="" FAL_API_KEY="" FAL_MODEL_LIST="" \
261
- # BFL
262
- BFL_API_KEY="" BFL_MODEL_LIST="" \
263
- # Vercel AI Gateway
264
- VERCELAIGATEWAY_API_KEY="" VERCELAIGATEWAY_MODEL_LIST=""
265
-
266
- USER nextjs
267
-
268
- EXPOSE 3210/tcp
269
-
270
- ENTRYPOINT ["/bin/node"]
271
-
272
- CMD ["/app/startServer.js"]