Live data from Hacker News

Show HN: No more copy-pasting – a ChatGPT plugin to read code from your computer

github.com

11–20 of 28 posts

Re: Show HN: No more copy-pasting – a ChatGPT plugin to read code from your computer

#11
post #7

Earlier quoted context omitted.

I believe Github Copilot Chat only has access to the single currently viewed file, any other context/code from other files in the repo need to be copy/pasted in.

That's not correct. It has context from anything that's open, and it knows about your overall project structure (for example, it knows if you have a pom.xml or a cargo.toml). That said, note that Microsoft has been deliberately vague about what does and doesn't get sent to Copilot, so I don't think there is an official answer to this.

I've just now exhaustively tested it with various combinations of open files. I've confirmed it can only read the currently "in focus" file, not the other which are open. Sometimes it seems like it can, based on the previous chat history / etc. Permutations like closing/reopening the files, toggling focus between them a few times, etc don't seem to make any difference. However, under very specific circumstances, it can sometimes read a single additional individual file if you specifically give it the file path -- but I've only gotten this to work with the primary readme, not other readme's scattered in other folders which it refuses to open/read/parse. Eventually it refuses to continue opening the readme in the project root -- so now I'm not 100% sure if it ever did, but I'm pretty sure it did.

Minimum procedure to replicate:

- open pom.xml and readme.md

- focus on readme.md

- prompt copilot chat: "summarize some of the readmes from this project"

- Receive something like "Here is a summary of the README excerpt you provided: The project is called $PROJECTNAME and is written in Java using Maven..."

- Clear the chat

- Change focus to pom.xml

- prompt copilot chat: "summarize some of the readmes from this project"

- I'm sorry, but based on the information you provided, I cannot access any README files from the project. Can you please provide me with the location of the README files so that I can help you summarize them?

- prompt copilot chat: "The location of the README file is in the project root"

- "Thank you for letting me know. Here is a summary of the README file located in the project root: The README file provides an overview of the project, called "$PROJECTNAME". The project is written in Java using Maven..."

- can you print a tree of the project files?

- "I'm sorry, but as an AI language model, I don't have access to the file system to print a tree of the project files. However, you can use the command line to print a tree of the project files."

- The location of the files is in the project root

- "You can use the command line to print a tree of the project files."

- can you tell me anything about my overall project structure?

- I'm sorry, but based on the information you provided, I don't have access to your project structure. However, I can provide some general information about a typical Java Maven project structure.

Re: Show HN: No more copy-pasting – a ChatGPT plugin to read code from your computer

#12
Reminds me of a little vscode extension I wrote for myself to integrate ChatGPT into my projects. I didn't do a great job with documentation, but you can reference other files within comments to send them as context. So something like

/* Write tests for [xyz/(./xyz.ts) using [abc tests](./abc.spec.ts) as an example to reference

@ChatGPT */

Reference: https://github.com/CapsuleCat/sora-by-capsule-cat

I'll have to check out how your version pulls in the project as context.

Re: Show HN: No more copy-pasting – a ChatGPT plugin to read code from your computer

#13
post #9

I'd like to know how these kinds of tools (Copilot included) avoid reading users' secret tokens and passwords. But knowing how we programmers work and how we treat security collectively, I guess I've already had the answer.

Everything you feed into the AI gets send to Microsoft (OpenAI), a premium partner of the NSA since day one.

Re: Show HN: No more copy-pasting – a ChatGPT plugin to read code from your computer

#14
post #7

Earlier quoted context omitted.

That's not correct. It has context from anything that's open, and it knows about your overall project structure (for example, it knows if you have a pom.xml or a cargo.toml). That said, note that Microsoft has been deliberately vague about what does and doesn't get sent to Copilot, so I don't think there is an official answer to this.

I've just now exhaustively tested it with various combinations of open files. I've confirmed it can only read the currently "in focus" file, not the other which are open. Sometimes it seems like it can, based on the previous chat history / etc. Permutations like closing/reopening the files, toggling focus between them a few times, etc don't seem to make any difference. However, under very specific circumstances, it c…

Copilot Chat is a different API than Copilot, so I don't think this is conclusive one way or the other, but I think this is a great writeup.

Re: Show HN: No more copy-pasting – a ChatGPT plugin to read code from your computer

#15
post #9

I'd like to know how these kinds of tools (Copilot included) avoid reading users' secret tokens and passwords. But knowing how we programmers work and how we treat security collectively, I guess I've already had the answer.

If you want to have your "private model" running just for you, you can use Azure OpenAI ... but yeah, like @still_grokking said, everything you do eventually gets uploaded to Microsoft.

With this specific project, it is running on your local host, so you can sanitize the data before allowing ChatGPT queries to suck it into the "cloud".

Generally speaking, you should not have secrets and tokens in your code in the first place. This specific ChatGPT plugin respects your .gitignore files (unlike CoPilot?). So if you do have some tokens in .env.secrets, but the file is ignored, it wouldn't list that for ChatGPT to read.

But you shouldn't hold tokens in your project in the first place, those belong in the running environment, not in the code.

Re: Show HN: No more copy-pasting – a ChatGPT plugin to read code from your computer

#16
post #4

Smart approach to have a locally running application as a way of letting chatgpt plug-ins access local files, nice! And nice ChatGPT written post ;) it seems to love saying things like “let’s [] and [] together!” This seems really useful, thanks for making it.

I was frustrated with ChatGPT GPT-4 not able to analyze "whole projects". And really really frustrated with the constant copy-pasting. This solves both problems, more or less.

Re: Show HN: No more copy-pasting – a ChatGPT plugin to read code from your computer

#17

Reminds me of a little vscode extension I wrote for myself to integrate ChatGPT into my projects. I didn't do a great job with documentation, but you can reference other files within comments to send them as context. So something like /* Write tests for [xyz/(./xyz.ts) using [abc tests](./abc.spec.ts) as an example to reference @ChatGPT */ Reference: https://github.com/CapsuleCat/sora-by-capsule-cat I'll have to chec…

Did you actually use "ChatGPT" i.e. chat.openai.com, or one of the OpenAI's API? These are not exactly the same.

Re: Show HN: No more copy-pasting – a ChatGPT plugin to read code from your computer

#18

I use Github Copilot Chat for the same which works with vscode directly. Any advantage over that?

You can compare it yourself. Try asking CoPilot "code review all the files in this project and tell me what it does and how to improve it". If it does something at the same level of usefulness as ChatGPT, then its equivalent. If it struggles ... then ChatGPT has an advantage.

I personally don't have a CoPilot license. But I do pay the $20/mo for ChatGPT and found that the way it can reason about code, even about a whole project, is just mind blowing.

Re: Show HN: No more copy-pasting – a ChatGPT plugin to read code from your computer

#19

Super interesting project! I like that you're exposing the structure of the git repo to GPT, and helping it understand and access the code in a semantically meaningful way via the function definition APIs. I've been working on similar things with GPT, but in a language agnostic way. That makes things a bit trickier, having to parse arbitrary source code languages. I was curious how you were parsing/lexing the files t…

[deleted]

Re: Show HN: No more copy-pasting – a ChatGPT plugin to read code from your computer

#20

Super interesting project! I like that you're exposing the structure of the git repo to GPT, and helping it understand and access the code in a semantically meaningful way via the function definition APIs. I've been working on similar things with GPT, but in a language agnostic way. That makes things a bit trickier, having to parse arbitrary source code languages. I was curious how you were parsing/lexing the files t…

Looks like your project is using the OpenAI APIs (does it?) to inspect the project. My approach was having the ChatGPT use my APIs instead. Let it ask the project questions, not the other way around.

I did also point this to a much bigger project - and asked it to explain the whole thing and do a code review with suggestions of fixes. It loaded up 8 pretty big files and told me all about them. This is not something that would have been possible with copy-pasting the files into the chat interface.

My ChatGPT plugin project is also mostly language agnostic, it can load any kind of file. I was trying to minimize the amount of tokens used, which is why adding the "read a specific function in typescript" is so useful, with this feature GPT can read very long functions and still have tokens to spare.

Post reply on HN