> 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/ai-edit.md).

# 讓 AI 修改、整理檔案

在掛上工作區的 MaiGPT 對話中，請 AI 修改檔案內容、批次改名、搬移或刪除檔案；AI 會先列出變更、經你確認後才執行，且每一步都可還原。

AI 不只會讀檔，也能直接修改工作區裡的檔案，或幫你改名、搬移、刪除。所有變更都會**先列出要改什麼，等你確認後才執行**；寫入後會產生新版本，刪除的檔案 30 天內可以還原。

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

產品公告前一天，保固政策從一年改成兩年。行銷專員在掛著產品工作區的對話中說「把 FAQ.md 第三題的保固改成主機兩年、馬達三年」。AI 先列出修改前後的內容並詢問是否寫回，她確認後，AI 直接更新 FAQ.md。接著她請 AI 把三份訪談筆記改名為「2026Q3\_原檔名」並搬進「訪談資料」資料夾，AI 先列出對照表，確認後一次完成。版本紀錄記下每一步是由她在對話中確認的。

***

## 修改檔案內容 <a href="#edit-file-content" id="edit-file-content"></a>

### 1. 說出要改的地方 <a href="#describe-change" id="describe-change"></a>

在已掛上工作區的對話中，直接描述要修改的檔案與內容，例如：

> 「把 FAQ.md 第三題的保固改成：主機保固兩年，馬達保固三年」

### 2. 確認修改 <a href="#confirm-change" id="confirm-change"></a>

AI 會先讀取檔案，列出修改前後的內容，並詢問是否寫入。確認內容無誤後回覆確認（或點選 AI 提供的確認選項），AI 才會寫回檔案。

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-41b16d41fa190807f7441a4e5ff34d83ec221fc3%2Ffile-library-ai-edit-confirm.png?alt=media" alt="AI 列出 FAQ.md 第三題修改前後的內容，並詢問是否寫回"><figcaption><p>AI 先列出修改前後，確認後才寫入</p></figcaption></figure>

### 3. 查看新版本 <a href="#check-new-version" id="check-new-version"></a>

寫入完成後，檔案會產生新版本，檔名與位置不變。版本清單會標示 <mark style="color:blue;">Agent</mark> 與確認者，並附上來源對話，詳見 [版本紀錄與還原](https://docs.maiagent.ai/work/file-library/versions.md)。

### 可以修改的格式 <a href="#editable-formats" id="editable-formats"></a>

| 類型        | 格式                  | 說明                                                 |
| --------- | ------------------- | -------------------------------------------------- |
| 文字與資料     | MD、TXT、SQL、JSON、CSV | 直接修改內容                                             |
| Office 文件 | XLSX、DOCX、PPTX      | 需要對話開啟 Code Interpreter；複雜的圖表或格式可能無法完整保留，建議修改後檢查一次 |

{% hint style="warning" %}

* 需要對該工作區有**編輯權限**。只有檢視權限時，AI 會告知無法修改，並改為產出新檔案。
* 如果同事在你確認前已存了新版本，AI 不會覆蓋，而是提示檔案已被更新、請重新確認，避免蓋掉別人的內容。
  {% endhint %}

***

## 改名與搬移 <a href="#rename-and-move" id="rename-and-move"></a>

可以請 AI 一次處理多個檔案，例如「把三份訪談筆記改名成『2026Q3\_原檔名』，再搬到『訪談資料』資料夾」。AI 會先列出 <mark style="color:blue;">目前位置</mark>、<mark style="color:blue;">目前檔名</mark>、<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-3bc6e066c166e05ee0a25dcfe3428dfba1dcb15c%2Ffile-library-ai-move-plan.png?alt=media" alt="AI 列出三份訪談筆記改名與搬移的對照表，請使用者確認"><figcaption><p>改名與搬移前的對照表</p></figcaption></figure>

* 每次最多處理 **20** 個檔案。
* 改名時不能變更副檔名。
* 目的地資料夾不存在時，AI 會把「建立資料夾」一起列進對照表，確認後一次完成。
* 同一個檔案的改名與搬移會一起完成；其中一步做不到時，兩步都不會執行，AI 會告訴你原因。

***

## 刪除檔案 <a href="#delete-files" id="delete-files"></a>

說「把 Q2 的舊版報價單刪掉」，AI 會列出要刪除的檔案與位置，**一律要你確認後才刪除**。

* 刪除的檔案會保留 **30 天**，期間可以在工作區的 <mark style="color:blue;">版本紀錄</mark> 還原到原位置。
* **不是工作區擁有者（組織擁有者、空間擁有者或工作區建立者）時**，AI 會改為送出刪除申請，由擁有者在工作區的 <mark style="color:blue;">待核准刪除</mark> 中 <mark style="color:blue;">核准刪除</mark> 或 <mark style="color:blue;">拒絕</mark>；申請 7 天後失效。

***

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

* [在 MaiGPT 使用工作區](https://docs.maiagent.ai/work/file-library/use-in-maigpt.md)
* [版本紀錄與還原](https://docs.maiagent.ai/work/file-library/versions.md)
* [Code Interpreter（程式碼執行）](https://docs.maiagent.ai/build/agent/code-interpreter.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/ai-edit.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.
