> For the complete documentation index, see [llms.txt](https://docs.cheapserver.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cheapserver.tw/debug/chat-gpt.md).

# 使用 ChatGPT 分析錯誤

本篇將教學如何使用 ChatGPT 分析伺服器錯誤，使用 AI 可以快速分類錯誤訊息，減輕分析錯誤的時間。

截稿前，ChatGPT 免費版可以使用 ChatGPT 4o mini 模型，已足以應對大部分日常使用。\
首先前往 [chatgpt.com](https://chatgpt.com) 網站。免註冊即可使用，但如果想要保存紀錄，也可以免費註冊帳號。

你可以在網頁下方看到輸入匡，你可以在這裡發送訊息。

<figure><img src="https://3045106892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F14bYhNP1432cxGkZABZe%2Fuploads%2FsrE9jNe5VC3EfcjC2mzT%2Fimage.png?alt=media&amp;token=c5f65b3c-bbcd-4fd0-b30e-e800876a52fc" alt=""><figcaption></figcaption></figure>

然後開頭先可以與 AI 定義，接下來對話都使用繁體中文。\
那就輸入 「接下來的對話都使用繁體中文」 到網頁裡。

<figure><img src="https://3045106892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F14bYhNP1432cxGkZABZe%2Fuploads%2FoSCHtpFMEACNAlDJuUDa%2Fimage.png?alt=media&amp;token=24a370ad-92de-4764-b227-e95b099fba0a" alt=""><figcaption></figcaption></figure>

接著就可以開始分析錯誤訊息了。你可以將崩潰日誌或伺服器日誌輸入到 ChatGPT 裡，ChatGPT 就會開始分析原因。通常來說，我都會寫上我的目的，像是 「分析 Minecraft 伺服器錯誤」 等。\
像是輸入：

```
分析 Minecraft 伺服器錯誤：
container@pterodactyl~ 伺服器已標示為 offline...
[CheapServer]: 正在檢查伺服器儲存空間，可能需要一點時間，請稍後...
[CheapServer]: 正在更新運行配置檔案...
[CheapServer]: 正在確認檔案權限，可能需要一點時間請稍後...
container@pterodactyl~ 伺服器已標示為 starting...
[CheapServer]: 正在取得 Docker 容器檔案，可能需要幾分鐘才會完成...
[CheapServer]: 已取得 Docker 容器檔案。
container@pterodactyl~ java -version
openjdk version "21.0.3" 2024-04-16 LTS
OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode, sharing)
container@pterodactyl~ java -Xms128M -Xmx8192M -jar server.jar
Error: Unable to access jarfile server.jar
container@pterodactyl~ 伺服器已標示為 offline...
[CheapServer]: ---------- CheapServer 檢測到伺服器崩潰! ----------
[CheapServer]: 退出狀態碼: 1
[CheapServer]: 超出記憶體: false
[CheapServer]: 因 60 秒前已經崩潰過一次，所以將不會自動重啟。
```

ChatGPT 就會分析錯誤原因，並提出總結。

<figure><img src="https://3045106892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F14bYhNP1432cxGkZABZe%2Fuploads%2FRW4hgoKeh1u4dKS9FZ2r%2Fimage.png?alt=media&amp;token=6e32c858-ee46-41c6-8389-a46833eb47c1" alt=""><figcaption></figcaption></figure>

接下來你就可以根據 ChatGPT 所提出的結果，來修復你的伺服器錯誤。
