There always bugs of selecting the right file to apply

When you click on the file name in the chat, it shows the correct file. However, when you press the apply button, it creates a new file in a wired location. I don’t know why. I need to copy and open the correct file and paste it manually. When updating only the code segment, I need to find the right line one by one and paste it.