> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/work/file-library/versions.md).

# 版本紀錄與還原

檔案庫的兩種版本紀錄：工作區的異動紀錄（上傳、搬移、刪除、AI 操作）大多可以還原；單一檔案的版本清單保留最近 20 版，可預覽並還原至任一版本。

檔案庫有兩層紀錄：**工作區的版本紀錄**記下這個工作區內發生的每一件事，**檔案的版本清單**則保留同一份檔案的歷次內容。兩者都可以還原，而且還原本身也會留下紀錄。

## 使用情境 <a href="#use-case" id="use-case"></a>

主管發現 FAQ 的保固說明被改錯了。她打開 FAQ.md 的版本清單，看到最新一版標著 <mark style="color:blue;">Agent</mark>、由同事在對話中確認，旁邊附著來源對話；她預覽上一版確認內容正確後按 <mark style="color:blue;">還原至此版本</mark>，檔案立即回到原本的內容，版本清單多出一筆「還原自 v1」。

***

## 工作區的版本紀錄 <a href="#workspace-activity" id="workspace-activity"></a>

點選檔案庫右上角的 <mark style="color:blue;">版本紀錄</mark>（時鐘圖示），側欄會依時間列出異動；上方的 <mark style="color:blue;">範圍</mark> 可以切換要看哪個空間或工作區。可以撤銷的異動右側會有還原圖示。

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-d6701f648727c7e111e209509ec1acc1f71ca3fc%2Ffile-library-activity.png?alt=media" alt="版本紀錄側欄，範圍為 A1 上市提案，列出套用至對話、工作區指引自動更新與上傳等事件，可還原的事件右側有還原圖示"><figcaption><p>可以撤銷的異動右側有還原圖示</p></figcaption></figure>

紀錄的事件包括：

| 類型    | 事件                                               |
| ----- | ------------------------------------------------ |
| 檔案    | 上傳、重新命名、移動、刪除、還原、內容已更新、內容已還原                     |
| 對話相關  | Session 附件（對話附件歸檔）、Session 生成（AI 產出）、套用至對話、從對話解除 |
| 工作區指引 | 工作區指引自動更新、指引手動儲存、工作區指引建議                         |

Session 生成、套用至對話、從對話解除只做紀錄，不能還原。

由 AI 執行的操作會標示 <mark style="color:blue;">Agent</mark>，並寫明「由○○於對話中確認」與產出對話，方便追溯是誰、在哪段對話裡同意的。

{% hint style="info" %}

* 還原後會再記一筆「還原」事件。
* 若原本的位置已不存在（例如資料夾已被刪除），該筆會顯示「原始位置已不存在，無法還原」。
  {% endhint %}

***

## 檔案的版本清單 <a href="#file-versions" id="file-versions"></a>

### 1. 開啟版本清單 <a href="#open-file-versions" id="open-file-versions"></a>

點選檔名開啟檔案詳情，再點選 <mark style="color:blue;">版本</mark>。檔案被修改過（AI 修改、線上編輯或上傳新版本）之後才會出現這個按鈕；剛上傳、還沒改過的檔案沒有版本清單。側欄會列出這份檔案的歷次版本：誰在什麼時間存的、是否由 Agent 修改。目前使用中的版本標示 <mark style="color:blue;">目前版本</mark>。

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-663d979010acad8d8c04324e9910c3730dfc8224%2Ffile-library-file-versions.png?alt=media" alt="檔案版本清單，v2 為目前版本並標示 Agent 與來源對話，下方為 v1"><figcaption><p>每一版都記錄修改者與確認者</p></figcaption></figure>

### 2. 預覽舊版 <a href="#preview-version" id="preview-version"></a>

點選任一舊版本，下方會顯示該版本的內容預覽。

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-d536349bb6ce97a06983e9050d0a4d955ce54a5e%2Ffile-library-version-preview.png?alt=media" alt="預覽 v1 的內容，右上角有還原至此版本按鈕"><figcaption><p>預覽舊版內容後再決定是否還原</p></figcaption></figure>

### 3. 還原至此版本 <a href="#restore-version" id="restore-version"></a>

按 <mark style="color:blue;">還原至此版本</mark> 並確認後，系統會用舊版內容**建立一個新版本**，不會刪除中間的版本；新版本會標示 <mark style="color:blue;">已還原</mark> 與「還原自 v○」。

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-c001e58bef71b499ceac8335686ad14715cd1107%2Ffile-library-version-restored.png?alt=media" alt="還原後產生 v3，標示目前版本、已還原與還原自 v1"><figcaption><p>還原也是一個新版本</p></figcaption></figure>

{% hint style="warning" %}

* 每份檔案保留**最近 20 個版本**，更早的版本會自動移除。
* 還原檔案版本需要該工作區的編輯權限。
  {% endhint %}

***

## 相關頁面 <a href="#related" id="related"></a>

* [讓 AI 修改、整理檔案](https://docs.maiagent.ai/work/file-library/ai-edit.md)
* [線上編輯](https://docs.maiagent.ai/work/file-library/online-editing.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.maiagent.ai/work/file-library/versions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
