Tips  提示

Just add the files that need to be changed to the chat
只需將需要更改的文件添加到聊天中

Take a moment and think about which files will need to be changed. Aider can often figure out which files to edit all by itself, but the most efficient approach is for you to add the files to the chat.
花點時間思考一下哪些文件需要更改。Aider 通常可以自己找出需要編輯的文件,但最有效的方法是您將文件添加到聊天中。

Don’t add lots of files to the chat
不要在聊天中添加大量文件

Just add the files you think need to be edited. Too much irrelevant code will distract and confuse the LLM. Aider uses a map of your entire git repo so is usually aware of relevant classes/functions/methods elsewhere in your code base. It’s ok to add 1-2 highly relevant files that don’t need to be edited, but be selective.
只需添加您認為需要編輯的文件。過多不相關的代碼會分散注意力並使LLM感到困惑。Aider 使用您整個 git 庫的地圖,因此通常會了解您代碼庫中其他地方的相關類別/函數/方法。可以添加 1-2 個不需要編輯的高度相關文件,但請謹慎選擇。

Break your goal down into bite sized steps
將你的目標分解成小步驟

Do them one at a time. Adjust the files added to the chat as you go: /drop files that don’t need any more changes, /add files that need changes for the next step.
一次處理一個。根據進度調整添加到聊天中的文件:/drop 不需要再更改的文件,/add 需要在下一步進行更改的文件。

For complex changes, discuss a plan first
對於複雜的變更,請先討論計劃

Use the /ask command to make a plan with aider. Once you are happy with the approach, just say “go ahead” without the /ask prefix.
使用/ask指令與輔助者制定計劃。一旦您對這個方法感到滿意,只需說“繼續”而不帶/ask前綴。

If aider gets stuck  如果幫助者卡住了

  • Use /clear to discard the chat history and make a fresh start.
    使用 /clear 來清除聊天記錄,重新開始。
  • Can you /drop any extra files?
    你能夠 /drop 任何多餘的檔案嗎?
  • Use /ask to discuss a plan before aider starts editing code.
    使用 /ask 在 aider 開始編輯代碼之前討論計劃。
  • Use the /model command to switch to a different model and try again. Switching between GPT-4o and Sonnet will often get past problems.
    使用/model命令切換到不同的模型並重試。切換 GPT-4o 和 Sonnet 之間通常可以解決問題。
  • If aider is hopelessly stuck, just code the next step yourself and try having aider code some more after that. Take turns and pair program with aider.
    如果輔助者無法脫困,就自己編寫下一步的代碼,然後讓輔助者再編寫一些代碼。輪流進行配對編程與輔助者。

Creating new files  創建新檔案

If you want aider to create a new file, add it to the repository first with /add <file>. This way aider knows this file exists and will write to it. Otherwise, aider might write the changes to an existing file. This can happen even if you ask for a new file, as LLMs tend to focus a lot on the existing information in their contexts.
如果您想讓 aider 創建一個新文件,請先使用 /add <file> 將其添加到存儲庫中。這樣 aider 就知道這個文件存在並會寫入它。否則,aider 可能會將更改寫入現有文件。即使您要求創建一個新文件,這種情況也可能發生,因為 LLMs 通常會非常關注其上下文中的現有信息。

Fixing bugs and errors  修復錯誤和缺陷

If your code is throwing an error, use the /run command to share the error output with the aider. Or just paste the errors into the chat. Let the aider figure out how to fix the bug.
如果您的代碼出現錯誤,請使用/run命令與協助者分享錯誤輸出。或者直接將錯誤粘貼到聊天中。讓協助者找出如何修復這個錯誤。

If test are failing, use the /test command to run tests and share the error output with the aider.
如果測試失敗,請使用/test命令來運行測試並與協助者分享錯誤輸出。

Providing docs  提供文件

LLMs know about a lot of standard tools and libraries, but may get some of the fine details wrong about API versions and function arguments.
LLMs 知道很多標準工具和庫,但可能對 API 版本和函數參數的一些細節理解錯誤。

You can provide up-to-date documentation in a few ways:
您可以通過幾種方式提供最新的文檔:

  • Paste doc snippets into the chat.
    將文檔片段粘貼到聊天中。
  • Include a URL to docs in your chat message and aider will scrape and read it. For example: Add a submit button like this https://ui.shadcn.com/docs/components/button.
    在您的聊天消息中包含一個文檔的網址,助手將會抓取並閱讀它。例如: Add a submit button like this https://ui.shadcn.com/docs/components/button
  • Use the /read command to read doc files into the chat from anywhere on your filesystem.
    使用/read命令從您檔案系統的任何位置將文檔文件讀入聊天中。
  • If you have coding conventions or standing instructions you want aider to follow, consider using a conventions file.
    如果您有希望 aider 遵循的編碼規範或常駐指示,請考慮使用規範文件

Interrupting & inputting  中斷與輸入

Use Control-C to interrupt aider if it isn’t providing a useful response. The partial response remains in the conversation, so you can refer to it when you reply with more information or direction.
使用 Control-C 來中斷 aider,如果它沒有提供有用的回應。部分回應會保留在對話中,因此您可以在回覆更多信息或指示時參考它。

You can send long, multi-line messages in the chat in a few ways:
您可以通過幾種方式在聊天中發送長的多行消息:

  • Paste a multi-line message directly into the chat.
    將多行消息直接粘貼到聊天中。
  • Enter { alone on the first line to start a multiline message and } alone on the last line to end it.
    在第一行單獨輸入 { 以開始多行消息,並在最後一行單獨輸入 } 以結束它。
  • Use Meta-ENTER to start a new line without sending the message (Esc+ENTER in some environments).
    使用 Meta-ENTER 開始新行而不發送消息(在某些環境中為 Esc+ENTER)。
  • Use /clipboard to paste text from the clipboard into the chat.
    使用 /clipboard 將剪貼簿中的文本粘貼到聊天中。