课程: Practical GitHub Copilot

History and file names - Github Copilot教程

课程: Practical GitHub Copilot

History and file names

- [Instructor] I'm the kind of person that likes to keep things clean so I'm constantly getting rid of some of the chats that I've had with Copilot but it does keep everything. So if you want to get to an early chat even if you've deleted it, you can go right here to this history panel and take a look at all the chats that you've had with the application. So you can see some of the earlier chats that we used right here. You can click on any one of those and take a look at how you have interacted with the application before. That can be super useful because again, I've mentioned that you do want to keep your chat around just in case you are in a new project and you want to remember how to do something. Now, this is a little bit too messy it has too much information, but this is a nice way of getting to additional data that perhaps you've lost. So let's take a look at how we can improve on this. Next up, if I take a look at my sample YAML I do have a file name that has the name of the MP3 and I use that so that the audio player in the podcast stream knows where the files are in relationship to my XML document in my application that I built with actions. So I'm going to do that. Let's go back into chat. And I've cleared this out. You can see I'm keeping things clean. So let's say in the get audio files function, I'm being specific here. I'd like to also include the file name. All right, so it's just really part of the ID 3 data. So let's try selecting this and just copying in this code and we'll give it a test. Run a debug here. And, now sometimes it does do this, notice that it just rewrote part of it and it didn't give me the whole context. So let's undo this because it didn't do this YAML dump right here and make sure that we have everything selected. Let's go back to the chat and we'll just go ahead and delete this prompt and do it again. (types) All right, let's see if it gives me everything this time. Yeah, it looks like I just maybe didn't have that last line selected. So just be careful about that and we'll hit this button here. Let's try running it again. And it is giving me all the information. And now file name needs to have the audio prefix in it, just like in the YAML file, right? So here you can see that it does have this prefix. So I'll just ask it to add that. Let's go back into chat and let's say prefix the file name with audio like this. It's going to give me the updated code again make sure everything's selected and hit that over. It looks like it's adding the audio file right there. Now it is bothering me that for some reason it's sort of putting the comments first on each element and then the file name and then the title. So something is kind of sorting the data. Let's ask Chat Copilot about this. My YAML is resorting the data, can I prevent it from doing that? And let's check it out. Yeah, so you can say sort keys parameter, set the false right here. So let's go ahead and again, make sure everything's selected, copy that over, and just a little addition here. So let's try that again. We'll run a debug and now that's looking better. So it's got the title and then the comments. And the comments is just a bunch of text, so that's fine. And then the file name at the end. So between the history and continuing to prompt Chat Copilot I'm really getting close to what I need to match the information that I need to enter in this feed file.

内容