lobehub/docs/usage/migrate-from-local-database.zh-CN.mdx
René Wang 3dfc86fd0f
feat: Update user guide & changelog (#11518)
* feat: Redesign doc

* chore: uopdate site

* chore: uopdate site

* chore: uopdate site

* chore: uopdate site

* chore: uopdate site

* feat: Uopdate content

* chore: New doc

* chore: Update content

* chore: Update content

* chore: add images

* chore: add images

* chore: add images

* chore: add images

* feat: Add more images

* feat: Add more images

* fix: Cannot reach end

* chore: Update content

* chore: Update content

* chore: Update content

* chore: Update content

* chore: Update content

* Revise README content and structure

Updated README to reflect changes in project description and removed outdated notes.

* Revise 'Getting Started' and TOC in README

Updated the 'Getting Started' section and modified the table of contents.

* chore: Update content

* Revise README structure and content

Updated the Getting Started section and removed the Table of Contents. Adjusted the Local Development instructions.

* Remove custom themes section from README

Removed section about custom themes from README.

* Update README.md

* Refine introduction and highlight cloud version

Updated wording for clarity and added recommendation for cloud version.

* chore: Update content

* chore: Update content

* chore: Update content

* chore: Update content

* chore: Update content

* chore: Update content

* chore: Update content

* fix: add missing translation

* 🔀 chore: Move README changes to feat/readme branch

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: add missing translation

* chore: update cdn

* docs: add migration guide from v1.x local database to v2.x and update help sections

Signed-off-by: Innei <tukon479@gmail.com>

* fix: add missing translation

* fix: add missing images

* fix: add missing changelogs

* fix: add missing changelogs

* fix: add missing changelogs

* fix: add missing changelogs

* fix: add missing changelogs

* style: update cdn

---------

Signed-off-by: Innei <tukon479@gmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: canisminor1990 <i@canisminor.cc>
Co-authored-by: Innei <tukon479@gmail.com>
2026-01-26 15:28:33 +08:00

115 lines
4.4 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 从本地数据库v1.x迁移到云端v2.x
description: 在 v1.x 客户端导出本地数据库数据,并导入到 LobeHub v2.x 云端版本。
tags:
- LobeHub
- 迁移
- Cloud
- 桌面端
- 本地数据库
---
# 从本地数据库v1.x迁移到云端v2.x
在 LobeHub v1.x Desktop 中,我们曾提供 **本地数据库** 模式,将数据保存在当前设备上。自 v2.x 起,我们转向 **Cloud-first 架构** 并移除了本地数据库能力,以便后续更好、更快地迭代,并在不同平台上提供更一致的体验。
<Callout type="info">
为什么要这样做v1.x
的本地数据库通常会带来更高的资源占用,而实际使用它的用户占比较小。砍掉这条分支能力后,我们可以让客户端更轻量、更稳定,同时把更多精力投入到
Cloud-first 体验与新功能交付上。
</Callout>
本文会引导你完成:**在 v1.x 导出数据** → **在 v2.x 导入数据**。
## 开始前准备
- 建议在迁移确认完成之前,**不要卸载 v1.x**。
- 准备 **稳定的网络连接**(如果对话记录较多,导入可能需要更久)。
- 登录 **LobeHub v2.x**(云端或你的自部署实例)。
如果你希望把 Cloud 部署在自己的服务器上,也可以先参考 [私有化部署指南](/docs/self-hosting/start) 完成部署,再把数据导入到自部署的 v2.x 实例中。
## 如果你已经不小心升级到了 v2.x
你依然可以完成迁移:
1. 前往 [GitHub Releases](https://github.com/lobehub/lobe-chat/releases) 下载并安装一个 **v1.x 版本**。
2. 使用 v1.x 按照本文的导出流程导出数据(`Settings -> Data Storage -> Export Data`),再在 v2.x 中导入。
请放心:**升级到 v2.x 的过程不会删除你的本地数据库文件**。只要本地数据库文件仍然存在,你的数据就依然存在。
### 本地数据库文件位置
本地数据库默认位于:
- `${appData}/lobehub-storage/lobehub-local-db`
## 通常可以迁移的内容
可迁移内容会受导出格式与 v1.x 构建版本影响,但一般包括:
- 助手 / Agents
- 会话 / Topics 与消息记录
- 提示词模板(如你的 v1.x 版本支持)
- 部分基础偏好设置(如版本支持)
## 通常不会迁移的内容(常见情况)
- 各模型服务商的 API Key / Secret更推荐在 v2.x 重新填写)
- 仅存在于本地的临时文件、缓存数据
- 一些与设备强绑定的设置项
<Callout type="warning">
如果你的 v1.x 数据包含敏感内容,请妥善保管导出的迁移文件,避免在公共渠道分享。
</Callout>
## 第一步:在 LobeHub v1.x 导出数据
在 v1.x Desktop 客户端中:
1. 进入 **Settings** → **Data Storage** → **Export Data**。
2. 你会得到一个 JSON 导出文件(例如:`2026-01-22-10-02_LobeHub-data.json`)。
3. 将导出的文件保存到你容易找到的位置(例如桌面)。
![v1.x 导出数据](/blog/assets13656829368732a95940edeff9ddfca6.webp)
### 导出建议
- 如果你的历史记录非常多,建议在设备空闲时导出。
## 第二步:在 LobeHub v2.x 导入数据
在任意 v2.x 应用中Desktop / Web / 自部署 WebApp
1. 登录你的 LobeHub 账号。
2. 进入 **Settings** → **Data Storage** → **Import Data**。
3. 上传你在第一步导出的 JSON 文件。
4. 等待导入完成;必要时刷新页面 / 重启应用。
![v2.x 导入数据](/blog/assets1e640c898e897bfb4ce4b66d5377010b.webp)
## 迁移完成后如何验收
导入完成后,建议你检查:
- 助手是否齐全,提示词 / 配置是否正确
- 最近的会话是否能正常打开、消息是否完整
- 常用设置(语言、主题、快捷键等)是否符合预期
如发现缺失,建议先升级到最新 v2.x 后再重试导入,同时保留 v1.x 的导出文件用于排查。
## 常见问题排查
### 导入失败或长时间卡住
- 确认网络稳定后重试。
- 升级到最新 v2.x 再导入一次。
### 导入后部分数据缺失
- 不同 v1.x 构建版本的数据结构可能略有差异。
- 如果你在 v1.x 使用过多个配置 / 空间(若支持),可尝试分别导出并逐个导入(如版本支持)。
## 获取帮助
如果你遇到迁移问题,可以查看 [帮助与支持](/docs/usage/help) 或通过 [GitHub Issues](https://github.com/lobehub/lobe-chat/issues/new/choose) 反馈。