🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
♻️ refactor: refactor package types (#10233)
Arvin Xu9872409d9844
diff --git a/Dockerfile.lite b/Dockerfile.litedeleted file mode 100644index 602320c4174..00000000000--- a/Dockerfile.lite+++ /dev/null@@ -1,272 +0,0 @@-## Set global build ENV-ARG NODEJS_VERSION="24"--## Base image for all building stages-FROM node:${NODEJS_VERSION}-slim AS base--ARG USE_CN_MIRROR--ENV DEBIAN_FRONTEND="noninteractive"--RUN \- # If you want to build docker in China, build with --build-arg USE_CN_MIRROR=true- if [ "${USE_CN_MIRROR:-false}" = "true" ]; then \- sed -i "s/deb.debian.org/mirrors.ustc.edu.cn/g" "/etc/apt/sources.list.d/debian.sources"; \- fi \- # Add required package- && apt update \- && apt install ca-certificates proxychains-ng -qy \- # Prepare required package to distroless- && mkdir -p /distroless/bin /distroless/etc /distroless/etc/ssl/certs /distroless/lib \- # Copy proxychains to distroless- && cp /usr/lib/$(arch)-linux-gnu/libproxychains.so.4 /distroless/lib/libproxychains.so.4 \- && cp /usr/lib/$(arch)-linux-gnu/libdl.so.2 /distroless/lib/libdl.so.2 \- && cp /usr/bin/proxychains4 /distroless/bin/proxychains \- && cp /etc/proxychains4.conf /distroless/etc/proxychains4.conf \- # Copy node to distroless- && cp /usr/lib/$(arch)-linux-gnu/libstdc++.so.6 /distroless/lib/libstdc++.so.6 \- && cp /usr/lib/$(arch)-linux-gnu/libgcc_s.so.1 /distroless/lib/libgcc_s.so.1 \- && cp /usr/local/bin/node /distroless/bin/node \- # Copy CA certificates to distroless- && cp /etc/ssl/certs/ca-certificates.crt /distroless/etc/ssl/certs/ca-certificates.crt \- # Cleanup temp files- && rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*--## Builder image, install all the dependencies and build the app-FROM base AS builder--ARG USE_CN_MIRROR-ARG NEXT_PUBLIC_BASE_PATH-ARG NEXT_PUBLIC_SENTRY_DSN-ARG NEXT_PUBLIC_ANALYTICS_POSTHOG-ARG NEXT_PUBLIC_POSTHOG_HOST-ARG NEXT_PUBLIC_POSTHOG_KEY-ARG NEXT_PUBLIC_ANALYTICS_UMAMI-ARG NEXT_PUBLIC_UMAMI_SCRIPT_URL-ARG NEXT_PUBLIC_UMAMI_WEBSITE_ID-ARG FEATURE_FLAGS--ENV NEXT_PUBLIC_CLIENT_DB="pglite"-ENV NEXT_PUBLIC_BASE_PATH="${NEXT_PUBLIC_BASE_PATH}" \- FEATURE_FLAGS="${FEATURE_FLAGS}"--# Sentry-ENV NEXT_PUBLIC_SENTRY_DSN="${NEXT_PUBLIC_SENTRY_DSN}" \- SENTRY_ORG="" \- SENTRY_PROJECT=""--ENV APP_URL="http://app.com"--# Posthog-ENV NEXT_PUBLIC_ANALYTICS_POSTHOG="${NEXT_PUBLIC_ANALYTICS_POSTHOG}" \- NEXT_PUBLIC_POSTHOG_HOST="${NEXT_PUBLIC_POSTHOG_HOST}" \- NEXT_PUBLIC_POSTHOG_KEY="${NEXT_PUBLIC_POSTHOG_KEY}"--# Umami-ENV NEXT_PUBLIC_ANALYTICS_UMAMI="${NEXT_PUBLIC_ANALYTICS_UMAMI}" \- NEXT_PUBLIC_UMAMI_SCRIPT_URL="${NEXT_PUBLIC_UMAMI_SCRIPT_URL}" \- NEXT_PUBLIC_UMAMI_WEBSITE_ID="${NEXT_PUBLIC_UMAMI_WEBSITE_ID}"--# Node-ENV NODE_OPTIONS="--max-old-space-size=6144"--WORKDIR /app--COPY package.json pnpm-workspace.yaml ./-COPY .npmrc ./-COPY packages ./packages--RUN \- # If you want to build docker in China, build with --build-arg USE_CN_MIRROR=true- if [ "${USE_CN_MIRROR:-false}" = "true" ]; then \- export SENTRYCLI_CDNURL="https://npmmirror.com/mirrors/sentry-cli"; \- npm config set registry "https://registry.npmmirror.com/"; \- echo 'canvas_binary_host_mirror=https://npmmirror.com/mirrors/canvas' >> .npmrc; \- fi \- # Set the registry for corepack- && export COREPACK_NPM_REGISTRY=$(npm config get registry | sed 's/\/$//') \- # Update corepack to latest (nodejs/corepack#612)- && npm i -g corepack@latest \- # Enable corepack- && corepack enable \- # Use pnpm for corepack- && corepack use $(sed -n 's/.*"packageManager": "\(.*\)".*/\1/p' package.json) \- # Install the dependencies- && pnpm i--COPY . .--# run build standalone for docker version-RUN npm run build:docker--## Application image, copy all the files for production-FROM busybox:latest AS app--COPY --from=base /distroless/ /--# Automatically leverage output traces to reduce image size-# https://nextjs.org/docs/advanced-features/output-file-tracing-COPY --from=builder /app/.next/standalone /app/--# Copy server launcher-COPY --from=builder /app/scripts/serverLauncher/startServer.js /app/startServer.js--RUN \- # Add nextjs:nodejs to run the app- addgroup -S -g 1001 nodejs \- && adduser -D -G nodejs -H -S -h /app -u 1001 nextjs \- # Set permission for nextjs:nodejs- && chown -R nextjs:nodejs /app /etc/proxychains4.conf--## Production image, copy all the files and run next-FROM scratch--# Copy all the files from app, set the correct permission for prerender cache-COPY --from=app / /--ENV NODE_ENV="production" \- NODE_OPTIONS="--dns-result-order=ipv4first --use-openssl-ca" \- NODE_EXTRA_CA_CERTS="" \- NODE_TLS_REJECT_UNAUTHORIZED="" \- SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"--# Make the middleware rewrite through local as default-# refs: https://github.com/lobehub/lobe-chat/issues/5876-ENV MIDDLEWARE_REWRITE_THROUGH_LOCAL="1"--# set hostname to localhost-ENV HOSTNAME="0.0.0.0" \- PORT="3210"--# General Variables-ENV ACCESS_CODE="" \- API_KEY_SELECT_MODE="" \- DEFAULT_AGENT_CONFIG="" \- SYSTEM_AGENT="" \- FEATURE_FLAGS="" \- PROXY_URL="" \- ENABLE_AUTH_PROTECTION=""--# Model Variables-ENV \- # AI21- AI21_API_KEY="" AI21_MODEL_LIST="" \- # Ai360- AI360_API_KEY="" AI360_MODEL_LIST="" \- # AiHubMix- AIHUBMIX_API_KEY="" AIHUBMIX_MODEL_LIST="" \- # Anthropic- ANTHROPIC_API_KEY="" ANTHROPIC_MODEL_LIST="" ANTHROPIC_PROXY_URL="" \- # Amazon Bedrock- ENABLED_AWS_BEDROCK="" AWS_ACCESS_KEY_ID="" AWS_SECRET_ACCESS_KEY="" AWS_REGION="" AWS_BEDROCK_MODEL_LIST="" \- # Azure OpenAI- AZURE_API_KEY="" AZURE_API_VERSION="" AZURE_ENDPOINT="" AZURE_MODEL_LIST="" \- # Baichuan- BAICHUAN_API_KEY="" BAICHUAN_MODEL_LIST="" \- # Cloudflare- CLOUDFLARE_API_KEY="" CLOUDFLARE_BASE_URL_OR_ACCOUNT_ID="" CLOUDFLARE_MODEL_LIST="" \- # Cohere- COHERE_API_KEY="" COHERE_MODEL_LIST="" COHERE_PROXY_URL="" \- # ComfyUI- ENABLED_COMFYUI="" COMFYUI_BASE_URL="" COMFYUI_AUTH_TYPE="" \- COMFYUI_API_KEY="" COMFYUI_USERNAME="" COMFYUI_PASSWORD="" COMFYUI_CUSTOM_HEADERS="" \- # DeepSeek- DEEPSEEK_API_KEY="" DEEPSEEK_MODEL_LIST="" \- # Fireworks AI- FIREWORKSAI_API_KEY="" FIREWORKSAI_MODEL_LIST="" \- # Gitee AI- GITEE_AI_API_KEY="" GITEE_AI_MODEL_LIST="" \- # GitHub- GITHUB_TOKEN="" GITHUB_MODEL_LIST="" \- GOOGLE_API_KEY="" GOOGLE_MODEL_LIST="" GOOGLE_PROXY_URL="" \- # Groq- GROQ_API_KEY="" GROQ_MODEL_LIST="" GROQ_PROXY_URL="" \- # Higress- HIGRESS_API_KEY="" HIGRESS_MODEL_LIST="" HIGRESS_PROXY_URL="" \- # HuggingFace- HUGGINGFACE_API_KEY="" HUGGINGFACE_MODEL_LIST="" HUGGINGFACE_PROXY_URL="" \- # Hunyuan- HUNYUAN_API_KEY="" HUNYUAN_MODEL_LIST="" \- # InternLM- INTERNLM_API_KEY="" INTERNLM_MODEL_LIST="" \- # Jina- JINA_API_KEY="" JINA_MODEL_LIST="" JINA_PROXY_URL="" \- # Minimax- MINIMAX_API_KEY="" MINIMAX_MODEL_LIST="" \- # Mistral- MISTRAL_API_KEY="" MISTRAL_MODEL_LIST="" \- # ModelScope- MODELSCOPE_API_KEY="" MODELSCOPE_MODEL_LIST="" MODELSCOPE_PROXY_URL="" \- # Moonshot- MOONSHOT_API_KEY="" MOONSHOT_MODEL_LIST="" MOONSHOT_PROXY_URL="" \- # Nebius- NEBIUS_API_KEY="" NEBIUS_MODEL_LIST="" NEBIUS_PROXY_URL="" \- # NewAPI- NEWAPI_API_KEY="" NEWAPI_PROXY_URL="" \- # Novita- NOVITA_API_KEY="" NOVITA_MODEL_LIST="" \- # Nvidia NIM- NVIDIA_API_KEY="" NVIDIA_MODEL_LIST="" NVIDIA_PROXY_URL="" \- # Ollama- ENABLED_OLLAMA="" OLLAMA_MODEL_LIST="" OLLAMA_PROXY_URL="" \- # OpenAI- ENABLED_OPENAI="" OPENAI_API_KEY="" OPENAI_MODEL_LIST="" OPENAI_PROXY_URL="" \- # OpenRouter- OPENROUTER_API_KEY="" OPENROUTER_MODEL_LIST="" \- # Perplexity- PERPLEXITY_API_KEY="" PERPLEXITY_MODEL_LIST="" PERPLEXITY_PROXY_URL="" \- # Qiniu- QINIU_API_KEY="" QINIU_MODEL_LIST="" QINIU_PROXY_URL="" \- # Qwen- QWEN_API_KEY="" QWEN_MODEL_LIST="" QWEN_PROXY_URL="" \- # SambaNova- SAMBANOVA_API_KEY="" SAMBANOVA_MODEL_LIST="" \- # SenseNova- SENSENOVA_API_KEY="" SENSENOVA_MODEL_LIST="" \- # SiliconCloud- SILICONCLOUD_API_KEY="" SILICONCLOUD_MODEL_LIST="" SILICONCLOUD_PROXY_URL="" \- # Spark- SPARK_API_KEY="" SPARK_MODEL_LIST="" SPARK_PROXY_URL="" SPARK_SEARCH_MODE="" \- # Stepfun- STEPFUN_API_KEY="" STEPFUN_MODEL_LIST="" \- # Taichu- TAICHU_API_KEY="" TAICHU_MODEL_LIST="" \- # TogetherAI- TOGETHERAI_API_KEY="" TOGETHERAI_MODEL_LIST="" \- # Upstage- UPSTAGE_API_KEY="" UPSTAGE_MODEL_LIST="" \- # v0 (Vercel)- V0_API_KEY="" V0_MODEL_LIST="" \- # vLLM- VLLM_API_KEY="" VLLM_MODEL_LIST="" VLLM_PROXY_URL="" \- # Wenxin- WENXIN_API_KEY="" WENXIN_MODEL_LIST="" \- # xAI- XAI_API_KEY="" XAI_MODEL_LIST="" XAI_PROXY_URL="" \- # Xinference- XINFERENCE_API_KEY="" XINFERENCE_MODEL_LIST="" XINFERENCE_PROXY_URL="" \- # 01.AI- ZEROONE_API_KEY="" ZEROONE_MODEL_LIST="" \- # Zhipu- ZHIPU_API_KEY="" ZHIPU_MODEL_LIST="" \- # Tencent Cloud- TENCENT_CLOUD_API_KEY="" TENCENT_CLOUD_MODEL_LIST="" \- # Infini-AI- INFINIAI_API_KEY="" INFINIAI_MODEL_LIST="" \- # 302.AI- AI302_API_KEY="" AI302_MODEL_LIST="" \- # FAL- ENABLED_FAL="" FAL_API_KEY="" FAL_MODEL_LIST="" \- # BFL- BFL_API_KEY="" BFL_MODEL_LIST="" \- # Vercel AI Gateway- VERCELAIGATEWAY_API_KEY="" VERCELAIGATEWAY_MODEL_LIST=""--USER nextjs--EXPOSE 3210/tcp--ENTRYPOINT ["/bin/node"]--CMD ["/app/startServer.js"]diff --git a/package.json b/package.jsonindex 23f73322d3e..d460b85a18f 100644--- a/package.json+++ b/package.json@@ -75,7 +75,6 @@"release": "semantic-release","self-hosting:docker": "docker build -t lobehub:local .","self-hosting:docker-cn": "docker build -t lobehub-local --build-arg USE_CN_MIRROR=true .",- "self-hosting:docker-cn@lite": "docker build -t lobehub-lite-local -f Dockerfile.lite --build-arg USE_CN_MIRROR=true .","start": "next start -p 3210","stylelint": "stylelint \"src/**/*.{js,jsx,ts,tsx}\" --fix","test": "npm run test-app && npm run test-server",diff --git a/packages/agent-runtime/src/types/event.ts b/packages/agent-runtime/src/types/event.tsindex ed15e932864..5a47f51b22c 100644--- a/packages/agent-runtime/src/types/event.ts+++ b/packages/agent-runtime/src/types/event.ts@@ -1,6 +1,7 @@/* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */+import { ChatToolPayload } from '@lobechat/types';+import type { AgentState, ToolsCalling } from './state';-import { ChatToolPayload } from '@/types/message';export interface AgentEventInit {type: 'init';diff --git a/packages/conversation-flow/src/transformation/__tests__/MessageTransformer.test.ts b/packages/conversation-flow/src/transformation/__tests__/MessageTransformer.test.tsindex afe99089fb2..abe9a10121c 100644--- a/packages/conversation-flow/src/transformation/__tests__/MessageTransformer.test.ts+++ b/packages/conversation-flow/src/transformation/__tests__/MessageTransformer.test.ts@@ -1,7 +1,6 @@+import type { AssistantContentBlock } from '@lobechat/types';import { describe, expect, it } from 'vitest';-import type { AssistantContentBlock } from '@/types/index';-import type { Message } from '../../types';import { MessageTransformer } from '../MessageTransformer';diff --git a/packages/database/src/client/db.test.ts b/packages/database/src/client/db.test.tsindex 7bd66c9b574..4fef2a31cb7 100644--- a/packages/database/src/client/db.test.ts+++ b/packages/database/src/client/db.test.ts@@ -1,7 +1,6 @@+import { ClientDBLoadingProgress, DatabaseLoadingState } from '@lobechat/types';import { beforeEach, describe, expect, it, vi } from 'vitest';-import { ClientDBLoadingProgress, DatabaseLoadingState } from '@/types/clientDB';-import { DatabaseManager } from './db';// Mock 所有外部依赖diff --git a/packages/database/src/client/db.ts b/packages/database/src/client/db.tsindex 6e04c91f4fd..75be57079a0 100644--- a/packages/database/src/client/db.ts+++ b/packages/database/src/client/db.ts@@ -1,13 +1,13 @@+import {+ type ClientDBLoadingProgress,+ DatabaseLoadingState,+ type MigrationSQL,+ type MigrationTableItem,+} from '@lobechat/types';import { sql } from 'drizzle-orm';import { PgliteDatabase, drizzle } from 'drizzle-orm/pglite';import { Md5 } from 'ts-md5';-import {- ClientDBLoadingProgress,- DatabaseLoadingState,- MigrationSQL,- MigrationTableItem,-} from '@/types/clientDB';import { sleep } from '@/utils/sleep';import migrations from '../core/migrations.json';diff --git a/packages/database/src/core/electron.ts b/packages/database/src/core/electron.tsindex 7452ee0ee9c..2ed53aec993 100644--- a/packages/database/src/core/electron.ts+++ b/packages/database/src/core/electron.ts@@ -1,11 +1,11 @@import { PGlite } from '@electric-sql/pglite';import { vector } from '@electric-sql/pglite/vector';+import type { MigrationTableItem } from '@lobechat/types';import { drizzle as pgliteDrizzle } from 'drizzle-orm/pglite';import fs from 'node:fs';import { Md5 } from 'ts-md5';import { electronIpcClient } from '@/server/modules/ElectronIPCClient';-import { MigrationTableItem } from '@/types/clientDB';import { DrizzleMigrationModel } from '../models/drizzleMigration';import * as schema from '../schemas';diff --git a/packages/database/src/models/__tests__/asyncTask.test.ts b/packages/database/src/models/__tests__/asyncTask.test.tsindex e62ba8b2c1b..4927c538033 100644--- a/packages/database/src/models/__tests__/asyncTask.test.ts+++ b/packages/database/src/models/__tests__/asyncTask.test.ts@@ -1,9 +1,8 @@// @vitest-environment node+import { AsyncTaskStatus, AsyncTaskType } from '@lobechat/types';import { eq } from 'drizzle-orm';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';-import { AsyncTaskStatus, AsyncTaskType } from '@/types/asyncTask';-import { asyncTasks, users } from '../../schemas';import { LobeChatDatabase } from '../../type';import { ASYNC_TASK_TIMEOUT, AsyncTaskModel } from '../asyncTask';diff --git a/packages/database/src/models/__tests__/file.test.ts b/packages/database/src/models/__tests__/file.test.tsindex f7859ecf26a..5e8fda6fcfd 100644--- a/packages/database/src/models/__tests__/file.test.ts+++ b/packages/database/src/models/__tests__/file.test.ts@@ -1,9 +1,8 @@// @vitest-environment node+import { FilesTabs, SortType } from '@lobechat/types';import { eq, inArray } from 'drizzle-orm';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';-import { FilesTabs, SortType } from '@/types/files';-import {chunks,embeddings,diff --git a/packages/database/src/models/__tests__/generation.test.ts b/packages/database/src/models/__tests__/generation.test.tsindex 2432003d1e7..2b8cf534593 100644--- a/packages/database/src/models/__tests__/generation.test.ts+++ b/packages/database/src/models/__tests__/generation.test.ts@@ -1,10 +1,9 @@// @vitest-environment nodeimport { AsyncTaskStatus, ImageGenerationAsset } from '@lobechat/types';+import { FileSource } from '@lobechat/types';import { eq } from 'drizzle-orm';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';-import { FileSource } from '@/types/files';-import {NewGeneration,asyncTasks,diff --git a/packages/database/src/models/__tests__/generationBatch.test.ts b/packages/database/src/models/__tests__/generationBatch.test.tsindex 199dd72f762..3ab5632bb79 100644--- a/packages/database/src/models/__tests__/generationBatch.test.ts+++ b/packages/database/src/models/__tests__/generationBatch.test.ts@@ -1,10 +1,9 @@// @vitest-environment nodeimport { GenerationConfig } from '@lobechat/types';+import { AsyncTaskStatus } from '@lobechat/types';import { eq } from 'drizzle-orm';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';-import { AsyncTaskStatus } from '@/types/asyncTask';-import {NewGenerationBatch,generationBatches,diff --git a/packages/database/src/models/aiProvider.ts b/packages/database/src/models/aiProvider.tsindex 865a204ca4a..e18387abb64 100644--- a/packages/database/src/models/aiProvider.ts+++ b/packages/database/src/models/aiProvider.ts@@ -1,15 +1,15 @@-import { and, asc, desc, eq } from 'drizzle-orm';-import { isEmpty } from 'lodash-es';-import { ModelProvider } from 'model-bank';--import { DEFAULT_MODEL_PROVIDER_LIST } from '@/config/modelProviders';-import {+import type {AiProviderDetailItem,AiProviderListItem,AiProviderRuntimeConfig,CreateAiProviderParams,UpdateAiProviderConfigParams,-} from '@/types/aiProvider';+} from '@lobechat/types';+import { and, asc, desc, eq } from 'drizzle-orm';+import { isEmpty } from 'lodash-es';+import { ModelProvider } from 'model-bank';++import { DEFAULT_MODEL_PROVIDER_LIST } from '@/config/modelProviders';import { merge } from '@/utils/merge';import { AiProviderSelectItem, aiModels, aiProviders } from '../schemas';diff --git a/packages/database/src/repositories/aiInfra/index.test.ts b/packages/database/src/repositories/aiInfra/index.test.tsindex 88079d40946..707677be51f 100644--- a/packages/database/src/repositories/aiInfra/index.test.ts+++ b/packages/database/src/repositories/aiInfra/index.test.ts@@ -1,14 +1,14 @@+import type {+ AiProviderDetailItem,+ AiProviderListItem,+ AiProviderRuntimeConfig,+ EnabledProvider,+} from '@lobechat/types';import { AiProviderModelListItem, EnabledAiModel } from 'model-bank';import { beforeEach, describe, expect, it, vi } from 'vitest';import { DEFAULT_MODEL_PROVIDER_LIST } from '@/config/modelProviders';import { clientDB, initializeDB } from '@/database/client/db';-import {- AiProviderDetailItem,- AiProviderListItem,- AiProviderRuntimeConfig,- EnabledProvider,-} from '@/types/aiProvider';import { AiInfraRepos } from './index';diff --git a/packages/database/src/repositories/aiInfra/index.ts b/packages/database/src/repositories/aiInfra/index.tsindex b6c85ac6cf4..03ec1348585 100644--- a/packages/database/src/repositories/aiInfra/index.ts+++ b/packages/database/src/repositories/aiInfra/index.ts@@ -1,3 +1,10 @@+import type {+ AiProviderDetailItem,+ AiProviderListItem,+ AiProviderRuntimeState,+ EnabledProvider,+ ProviderConfig,+} from '@lobechat/types';import { isEmpty } from 'lodash-es';import {AIChatModelCard,@@ -8,13 +15,6 @@ import {import pMap from 'p-map';import { DEFAULT_MODEL_PROVIDER_LIST } from '@/config/modelProviders';-import {- AiProviderDetailItem,- AiProviderListItem,- AiProviderRuntimeState,- EnabledProvider,-} from '@/types/aiProvider';-import { ProviderConfig } from '@/types/user/settings';import { merge, mergeArrayById } from '@/utils/merge';import { AiModelModel } from '../../models/aiModel';diff --git a/packages/database/src/repositories/dataImporter/__tests__/index.test.ts b/packages/database/src/repositories/dataImporter/__tests__/index.test.tsindex 82a53f905ee..00162bcc0e6 100644--- a/packages/database/src/repositories/dataImporter/__tests__/index.test.ts+++ b/packages/database/src/repositories/dataImporter/__tests__/index.test.ts@@ -1,8 +1,7 @@+import type { ImportPgDataStructure } from '@lobechat/types';import { eq, inArray } from 'drizzle-orm';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';-import { ImportPgDataStructure } from '@/types/export';-import { getTestDB } from '../../../models/__tests__/_util';import * as Schema from '../../../schemas';import { DataImporterRepos } from '../index';diff --git a/packages/database/src/repositories/dataImporter/deprecated/__tests__/index.test.ts b/packages/database/src/repositories/dataImporter/deprecated/__tests__/index.test.tsindex 554bd0289f3..398e138760b 100644--- a/packages/database/src/repositories/dataImporter/deprecated/__tests__/index.test.ts+++ b/packages/database/src/repositories/dataImporter/deprecated/__tests__/index.test.ts@@ -1,4 +1,5 @@// @vitest-environment node+import type { ImporterEntryData } from '@lobechat/types';import { eq, inArray } from 'drizzle-orm';import { beforeEach, describe, expect, it, vi } from 'vitest';@@ -12,7 +13,6 @@ import {topics,users,} from '@/database/schemas';-import { ImporterEntryData } from '@/types/importer';import { DeprecatedDataImporterRepos as DataImporterRepos } from '../index';import mockImportData from './fixtures/messages.json';diff --git a/packages/database/src/repositories/dataImporter/deprecated/index.ts b/packages/database/src/repositories/dataImporter/deprecated/index.tsindex 7a6a5b96b2b..b0541e5d5b1 100644--- a/packages/database/src/repositories/dataImporter/deprecated/index.ts+++ b/packages/database/src/repositories/dataImporter/deprecated/index.ts@@ -1,6 +1,6 @@+import type { ImporterEntryData } from '@lobechat/types';import { and, eq, inArray, sql } from 'drizzle-orm';-import { ImporterEntryData } from '@/types/importer';import { sanitizeUTF8 } from '@/utils/sanitizeUTF8';import {diff --git a/packages/database/src/repositories/dataImporter/index.ts b/packages/database/src/repositories/dataImporter/index.tsindex 5a2eb66b8bf..ca01f31187d 100644--- a/packages/database/src/repositories/dataImporter/index.ts+++ b/packages/database/src/repositories/dataImporter/index.ts@@ -1,7 +1,6 @@+import type { ImportPgDataStructure, ImportResultData, ImporterEntryData } from '@lobechat/types';import { and, eq, inArray } from 'drizzle-orm';-import { ImportPgDataStructure } from '@/types/export';-import { ImportResultData, ImporterEntryData } from '@/types/importer';import { uuid } from '@/utils/uuid';import * as EXPORT_TABLES from '../../schemas';diff --git a/packages/database/src/repositories/tableViewer/index.ts b/packages/database/src/repositories/tableViewer/index.tsindex 1730d3ef4db..3237be2cafe 100644--- a/packages/database/src/repositories/tableViewer/index.ts+++ b/packages/database/src/repositories/tableViewer/index.ts@@ -1,12 +1,11 @@-import { sql } from 'drizzle-orm';-import pMap from 'p-map';--import {+import type {FilterCondition,PaginationParams,TableBasicInfo,TableColumnInfo,-} from '@/types/tableViewer';+} from '@lobechat/types';+import { sql } from 'drizzle-orm';+import pMap from 'p-map';import { LobeChatDatabase } from '../../type';diff --git a/packages/database/src/schemas/agent.ts b/packages/database/src/schemas/agent.tsindex 89d2c70c8c8..2ff51e4edeb 100644--- a/packages/database/src/schemas/agent.ts+++ b/packages/database/src/schemas/agent.ts@@ -1,4 +1,5 @@/* eslint-disable sort-keys-fix/sort-keys-fix */+import type { LobeAgentChatConfig, LobeAgentTTSConfig } from '@lobechat/types';import {boolean,index,@@ -11,8 +12,6 @@ import {} from 'drizzle-orm/pg-core';import { createInsertSchema } from 'drizzle-zod';-import { LobeAgentChatConfig, LobeAgentTTSConfig } from '@/types/agent';-import { idGenerator, randomSlug } from '../utils/idGenerator';import { timestamps } from './_helpers';import { files, knowledgeBases } from './file';diff --git a/packages/database/src/schemas/aiInfra.ts b/packages/database/src/schemas/aiInfra.tsindex 911f47211f3..44e7865eb3e 100644--- a/packages/database/src/schemas/aiInfra.ts+++ b/packages/database/src/schemas/aiInfra.ts@@ -1,9 +1,8 @@/* eslint-disable sort-keys-fix/sort-keys-fix */+import type { AiProviderConfig, AiProviderSettings } from '@lobechat/types';import { boolean, integer, jsonb, pgTable, primaryKey, text, varchar } from 'drizzle-orm/pg-core';import { AiModelSettings } from 'model-bank';-import { AiProviderConfig, AiProviderSettings } from '@/types/aiProvider';-import { timestamps } from './_helpers';import { users } from './user';diff --git a/packages/database/src/schemas/document.ts b/packages/database/src/schemas/document.tsindex 7b32bc8fead..31018727f0b 100644--- a/packages/database/src/schemas/document.ts+++ b/packages/database/src/schemas/document.ts@@ -1,4 +1,5 @@/* eslint-disable sort-keys-fix/sort-keys-fix */+import type { LobeDocumentPage } from '@lobechat/types';import {index,integer,@@ -12,8 +13,6 @@ import {} from 'drizzle-orm/pg-core';import { createInsertSchema } from 'drizzle-zod';-import { LobeDocumentPage } from '@/types/document';-import { idGenerator } from '../utils/idGenerator';import { createdAt, timestamps } from './_helpers';import { files } from './file';diff --git a/packages/database/src/schemas/file.ts b/packages/database/src/schemas/file.tsindex c68799a160f..45f939b15b8 100644--- a/packages/database/src/schemas/file.ts+++ b/packages/database/src/schemas/file.ts@@ -1,4 +1,5 @@/* eslint-disable sort-keys-fix/sort-keys-fix */+import { FileSource } from '@lobechat/types';import {boolean,index,@@ -13,8 +14,6 @@ import {} from 'drizzle-orm/pg-core';import { createInsertSchema } from 'drizzle-zod';-import { FileSource } from '@/types/files';-import { idGenerator } from '../utils/idGenerator';import { accessedAt, createdAt, timestamps } from './_helpers';import { asyncTasks } from './asyncTask';diff --git a/packages/database/src/schemas/topic.ts b/packages/database/src/schemas/topic.tsindex 605deb0ecde..edcc55191f2 100644--- a/packages/database/src/schemas/topic.ts+++ b/packages/database/src/schemas/topic.ts@@ -1,9 +1,8 @@/* eslint-disable sort-keys-fix/sort-keys-fix */+import type { ChatTopicMetadata } from '@lobechat/types';import { boolean, index, jsonb, pgTable, primaryKey, text, uniqueIndex } from 'drizzle-orm/pg-core';import { createInsertSchema } from 'drizzle-zod';-import { ChatTopicMetadata } from '@/types/topic';-import { idGenerator } from '../utils/idGenerator';import { createdAt, timestamps, timestamptz } from './_helpers';import { chatGroups } from './chatGroup';diff --git a/packages/database/src/schemas/user.ts b/packages/database/src/schemas/user.tsindex 71f0d384ad3..90a69d84d2b 100644--- a/packages/database/src/schemas/user.ts+++ b/packages/database/src/schemas/user.ts@@ -1,9 +1,9 @@/* eslint-disable sort-keys-fix/sort-keys-fix */+import type { CustomPluginParams } from '@lobechat/types';import { LobeChatPluginManifest } from '@lobehub/chat-plugin-sdk';import { boolean, jsonb, pgTable, primaryKey, text } from 'drizzle-orm/pg-core';import { DEFAULT_PREFERENCE } from '@/const/user';-import { CustomPluginParams } from '@/types/tool/plugin';import { timestamps, timestamptz } from './_helpers';diff --git a/packages/database/src/server/models/__tests__/user.test.ts b/packages/database/src/server/models/__tests__/user.test.tsindex a89cefdf6e9..2bf3c74fbca 100644--- a/packages/database/src/server/models/__tests__/user.test.ts+++ b/packages/database/src/server/models/__tests__/user.test.ts@@ -1,3 +1,4 @@+import type { UserGuide, UserPreference } from '@lobechat/types';import { TRPCError } from '@trpc/server';import dayjs from 'dayjs';import { count, eq } from 'drizzle-orm';@@ -5,7 +6,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { INBOX_SESSION_ID } from '@/const/session';import { KeyVaultsGateKeeper } from '@/server/modules/KeyVaultsEncrypt';-import { UserGuide, UserPreference } from '@/types/user';import { getTestDBInstance } from '../../../core/dbForTest';import { SessionModel } from '../../../models/session';diff --git a/packages/model-runtime/src/core/streams/vertex-ai.ts b/packages/model-runtime/src/core/streams/vertex-ai.tsindex 8acc27843c6..d9f6acbe87b 100644--- a/packages/model-runtime/src/core/streams/vertex-ai.ts+++ b/packages/model-runtime/src/core/streams/vertex-ai.ts@@ -1,6 +1,5 @@import { GenerateContentResponse } from '@google/genai';--import { GroundingSearch } from '@/types/search';+import { GroundingSearch } from '@lobechat/types';import { nanoid } from '../../utils/uuid';import { convertGoogleAIUsage } from '../usageConverters/google-ai';diff --git a/packages/model-runtime/src/providers/comfyui/__tests__/index.test.ts b/packages/model-runtime/src/providers/comfyui/__tests__/index.test.tsindex a3001202235..1da8a6e40eb 100644--- a/packages/model-runtime/src/providers/comfyui/__tests__/index.test.ts+++ b/packages/model-runtime/src/providers/comfyui/__tests__/index.test.ts@@ -1,9 +1,8 @@// @vitest-environment node+import type { ComfyUIKeyVault } from '@lobechat/types';import { createBasicAuthCredentials } from '@lobechat/utils';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';-import type { ComfyUIKeyVault } from '@/types/index';-import type { CreateImagePayload } from '../../../types/image';import { LobeComfyUI } from '../index';diff --git a/packages/model-runtime/src/providers/comfyui/auth/AuthManager.ts b/packages/model-runtime/src/providers/comfyui/auth/AuthManager.tsindex 4427d980b71..1a0dc34a82c 100644--- a/packages/model-runtime/src/providers/comfyui/auth/AuthManager.ts+++ b/packages/model-runtime/src/providers/comfyui/auth/AuthManager.ts@@ -1,7 +1,6 @@+import type { ComfyUIKeyVault } from '@lobechat/types';import { createBasicAuthCredentials } from '@lobechat/utils';-import type { ComfyUIKeyVault } from '@/types/index';-export interface BasicCredentials {password: string;type: 'basic';diff --git a/packages/model-runtime/src/providers/comfyui/index.ts b/packages/model-runtime/src/providers/comfyui/index.tsindex e38d67ed60e..0215194bc5c 100644--- a/packages/model-runtime/src/providers/comfyui/index.ts+++ b/packages/model-runtime/src/providers/comfyui/index.ts@@ -1,14 +1,9 @@+import type { ComfyUIKeyVault } from '@lobechat/types';import { createBasicAuthCredentials } from '@lobechat/utils';import debug from 'debug';-import type { ComfyUIKeyVault } from '@/types/index';-import { LobeRuntimeAI } from '../../core/BaseAI';-import {- AuthenticatedImageRuntime,- CreateImagePayload,- CreateImageResponse,-} from '../../types/image';+import { AuthenticatedImageRuntime, CreateImagePayload, CreateImageResponse } from '../../types';import { parseComfyUIErrorMessage } from '../../utils/comfyuiErrorParser';import { AgentRuntimeError } from '../../utils/createError';diff --git a/packages/types/src/files/list.ts b/packages/types/src/files/list.tsindex 6f2fe282fb5..53cd6c044b5 100644--- a/packages/types/src/files/list.ts+++ b/packages/types/src/files/list.ts@@ -1,6 +1,6 @@import { z } from 'zod';-import { AsyncTaskStatus } from '@/types/asyncTask';+import type { AsyncTaskStatus } from '../asyncTask';export interface FileListItem {chunkCount: number | null;diff --git a/packages/types/src/files/upload.ts b/packages/types/src/files/upload.tsindex 4b1356a904a..eb66a4a64fa 100644--- a/packages/types/src/files/upload.ts+++ b/packages/types/src/files/upload.ts@@ -1,6 +1,6 @@import { z } from 'zod';-import { FileParsingTask } from '@/types/asyncTask';+import type { FileParsingTask } from '../asyncTask';export interface FileUploadState {progress: number;diff --git a/packages/types/src/importer.ts b/packages/types/src/importer.tsindex 7b791ebe57a..543a3b95d16 100644--- a/packages/types/src/importer.ts+++ b/packages/types/src/importer.ts@@ -116,7 +116,7 @@ export enum ImportStage {Finished,}-export interface FileUploadState {+export interface ImportFileUploadState {progress: number;/*** rest time in ms@@ -137,7 +137,7 @@ export interface ErrorShape {export interface OnImportCallbacks {onError?: (error: ErrorShape) => void;- onFileUploading?: (state: FileUploadState) => void;+ onFileUploading?: (state: ImportFileUploadState) => void;onStageChange?: (stage: ImportStage) => void;/***diff --git a/packages/types/src/index.ts b/packages/types/src/index.tsindex f85dac25136..cb706a3f78f 100644--- a/packages/types/src/index.ts+++ b/packages/types/src/index.ts@@ -8,11 +8,14 @@ export * from './chatGroup';export * from './chunk';export * from './clientDB';export * from './discover';+export * from './document';export * from './eval';+export * from './export';export * from './fetch';export * from './files';export * from './generation';export * from './hotkey';+export * from './importer';export * from './knowledgeBase';export * from './llm';export * from './message';@@ -23,6 +26,7 @@ export * from './search';export * from './serverConfig';export * from './service';export * from './session';+export * from './tableViewer';export * from './tool';export * from './topic';export * from './user';diff --git a/packages/types/src/openai/image.ts b/packages/types/src/openai/image.tsindex 515792f3bdb..822002ca784 100644--- a/packages/types/src/openai/image.ts+++ b/packages/types/src/openai/image.ts@@ -1,4 +1,4 @@-import { DallEImageQuality, DallEImageSize, DallEImageStyle } from '@/types/tool/dalle';+import type { DallEImageQuality, DallEImageSize, DallEImageStyle } from '../tool/dalle';export interface OpenAIImagePayload {model: 'dall-e-2' | 'dall-e-3';diff --git a/packages/types/src/topic/topic.ts b/packages/types/src/topic/topic.tsindex 674b1f5c3a3..a87c2e041ed 100644--- a/packages/types/src/topic/topic.ts+++ b/packages/types/src/topic/topic.ts@@ -1,4 +1,4 @@-import { BaseDataModel } from '@/types/meta';+import type { BaseDataModel } from '../meta';// 类型定义export type TimeGroupId =diff --git a/packages/types/src/user/settings/hotkey.ts b/packages/types/src/user/settings/hotkey.tsindex 2babd751b0d..6d17d953005 100644--- a/packages/types/src/user/settings/hotkey.ts+++ b/packages/types/src/user/settings/hotkey.ts@@ -1,3 +1,3 @@-import { HotkeyId } from '@/types/hotkey';+import type { HotkeyId } from '../../hotkey';export type UserHotkeyConfig = Record<HotkeyId, string>;diff --git a/src/features/DataImporter/index.tsx b/src/features/DataImporter/index.tsxindex f4f2a3a3b0a..b8938204a06 100644--- a/src/features/DataImporter/index.tsx+++ b/src/features/DataImporter/index.tsx@@ -1,5 +1,6 @@'use client';+import { ErrorShape, ImportFileUploadState, ImportStage } from '@lobechat/types';import { Upload } from 'antd';import { createStyles } from 'antd-style';import { ImportIcon } from 'lucide-react';@@ -12,7 +13,6 @@ import { importService } from '@/services/import';import { useChatStore } from '@/store/chat';import { useSessionStore } from '@/store/session';import { ImportPgDataStructure } from '@/types/export';-import { ErrorShape, FileUploadState, ImportStage } from '@/types/importer';import ImportError from './Error';import { FileUploading } from './FileUploading';@@ -64,7 +64,7 @@ const DataImporter = memo<DataImporterProps>(({ children, onFinishImport }) => {const [duration, setDuration] = useState(0);const [importState, setImportState] = useState(ImportStage.Start);- const [fileUploadingState, setUploadingState] = useState<FileUploadState | undefined>();+ const [fileUploadingState, setUploadingState] = useState<ImportFileUploadState | undefined>();const [importError, setImportError] = useState<ErrorShape | undefined>();const [importResults, setImportResults] = useState<ImportResults | undefined>();const [showImportModal, setShowImportModal] = useState(false);