# PDF 文件翻譯

## 功能說明 <a href="#feature-description" id="feature-description"></a>

MaiAgent 提供 AI 驅動的 PDF 文件翻譯功能，可將知識庫中的 PDF 檔案翻譯為指定語言。翻譯完成後會產出兩種版本：

* **翻譯版**：僅包含目標語言的翻譯內容
* **雙語對照版**：原文與譯文並排顯示，方便對照閱讀

支援的語言包括：繁體中文、簡體中文、英文、日文、韓文、西班牙文、法文、德文、葡萄牙文、俄文、阿拉伯文、義大利文、荷蘭文、波蘭文、土耳其文。

{% hint style="info" %}
目前僅支援 PDF 格式的文件翻譯，且 PDF 必須包含可提取的文字內容（不支援純掃描/圖片型 PDF）。
{% endhint %}

***

## 如何翻譯 PDF 文件 <a href="#how-to-translate-pdf" id="how-to-translate-pdf"></a>

### 1. 進入文件詳情頁 <a href="#open-document-detail" id="open-document-detail"></a>

在知識庫的 <mark style="color:blue;">文件</mark> 頁籤中，點擊要翻譯的 PDF 檔案，進入文件詳情頁面。

<figure><img src="/files/xbpzY0z4tWYwehXTyj4b" alt=""><figcaption><p>PDF 文件詳情頁，右上角可見「翻譯 PDF」按鈕</p></figcaption></figure>

### 2. 開啟翻譯設定 <a href="#open-translation-settings" id="open-translation-settings"></a>

點擊右上角的 <mark style="color:blue;">翻譯 PDF</mark> 按鈕。若該檔案已有翻譯紀錄，會先顯示翻譯結果彈窗，可點擊 <mark style="color:blue;">再次翻譯</mark> 開啟設定；若為首次翻譯，則直接開啟翻譯設定彈窗。

<figure><img src="/files/o2dfXanUomYrqEOxlykS" alt=""><figcaption><p>翻譯設定彈窗</p></figcaption></figure>

### 3. 設定翻譯參數 <a href="#configure-translation-params" id="configure-translation-params"></a>

| 欄位          | 說明                                         |
| ----------- | ------------------------------------------ |
| **來源語言**    | 原文的語言，預設為「自動偵測」，系統會自動判斷                    |
| **目標語言**    | 翻譯的目標語言（必填）                                |
| **大語言模型**   | 選擇用於翻譯的 LLM 模型                             |
| **自訂術語/提示** | （選填）引導翻譯風格或指定術語對照，例如：「請把 Hermione 翻譯成『妙麗』」 |

{% hint style="info" %}
自訂提示最多可輸入 5,000 字元，適合用於指定專有名詞、品牌名稱或特定翻譯風格。
{% endhint %}

### 4. 開始翻譯 <a href="#start-translation" id="start-translation"></a>

點擊 <mark style="color:blue;">確認</mark> 後，系統會在背景執行翻譯任務。翻譯過程中狀態會即時更新，完成後會自動顯示結果。

***

## 查看翻譯結果 <a href="#view-translation-result" id="view-translation-result"></a>

翻譯完成後，點擊 <mark style="color:blue;">翻譯 PDF</mark> 按鈕即可開啟翻譯結果彈窗，包含三個頁籤：

### 結果預覽 <a href="#result-preview" id="result-preview"></a>

預覽雙語對照版的 PDF，原文與譯文並排顯示。

<figure><img src="/files/EFBDVKGN6kmMrGb5dshy" alt=""><figcaption><p>翻譯結果 — 雙語對照版 PDF 預覽</p></figcaption></figure>

### 下載檔案 <a href="#download-file" id="download-file"></a>

提供三種檔案下載選項：

* **原始檔案**：下載未翻譯的原始 PDF
* **翻譯版**：僅包含目標語言的翻譯 PDF
* **雙語對照版**：原文與譯文並排的 PDF

<figure><img src="/files/ln3q0GsStviF6Q4qgXJK" alt=""><figcaption><p>下載檔案 — 支援三種格式</p></figcaption></figure>

### 處理詳情 <a href="#processing-details" id="processing-details"></a>

顯示翻譯任務的完整統計資訊：

* **翻譯配置**：來源/目標語言、使用的 LLM 模型
* **處理統計**：Token 消耗量、LLM 呼叫次數、處理時間拆分
* **檔案資訊**：原始與翻譯後的檔案大小、字元數
* **時間戳記**：建立、開始、完成時間與最終狀態

<figure><img src="/files/Q6G6uV5QYdpwMzhRsmUY" alt=""><figcaption><p>處理詳情 — Token 消耗與時間統計</p></figcaption></figure>

***

## 翻譯版本管理 <a href="#translation-version-management" id="translation-version-management"></a>

同一份 PDF 檔案可執行多次翻譯（例如翻成不同語言或使用不同模型），每次翻譯都會保留為獨立版本。

在翻譯結果彈窗上方的 <mark style="color:blue;">選擇翻譯版本</mark> 下拉選單中，可切換不同版本查看結果。版本格式為：`日期 | 來源語言 → 目標語言 | 使用模型`。

如需再次翻譯，點擊 <mark style="color:blue;">再次翻譯</mark> 按鈕即可開啟新的翻譯設定。


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.maiagent.ai/km/translate-pdf.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
