-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added Term formatting #12
base: main
Are you sure you want to change the base?
Conversation
Hi! This looks nice. However, I am worried about this change making it more difficult to copy and paste code. Also, sometimes I want to copy and paste the markdown answer as markdown. |
That's fair. In VSCode you can box select from the terminal so it's not an issue, but it wouldn't work in every terminal. |
Is having a copy button for the code blocks (like in ChatGPT) a good idea? |
Having access to access only the code would be super useful (even if it would be saved in some variable). Is there a way to get contents of only the code blocks via Term? Or is my best bet to regex it? |
A copy button would be great, but would take some work to get it right. Term now can create live widgets in the terminal that could be used to display the text and make it interactive, e.g. select the code block and copy it. But it would take a bit of work to set it up and it would mean you couldn't just a repl mode like in the original implementation. If it's something @diegozea is interested in we could give it a go. It would also be a great use case for term's new functionality. Perhaps, given that the basic GPT interaction logic is used by other packages too like HelpGPT.jl and likely more in the future, it makes sense to create a GPTBase.jl with the basic API support and have separate packages for the repl mode, Term's interactive mode, help gpt... what do you think? |
Yes, having a ChatGPTBase sound like the right thing to do! I like that this package is using a REPL mode, so it would make sense to have the most interactive terminal app elsewhere. I have another idea to solve the problem for this package: adding commands like copy, regenerate, etc. I can implement those, but not before the 28th of March (I have a lot of things to tackle before that day). |
Shared codebase is a great idea! On the code copying, having a button would be cool. |
That OpenAIReplMode.jl approach is really nice! I like that it keeps the the copy/paste nature of the output but adds in that nice Julia formatting. In general, I think I'd like to add a setting or option that allows the ChatGPT response to be printed in plaintext to the terminal, or interpreted as Markdown. Maybe the more general solution would be to allow users to register different renderers (like plaintext, Markdown.jl, or Term.jl options) so we can have all of these options. How does that sound? |
Yeah that sounds perfect! Btw, unrelated but it would be nice to have a way to reset the context when the conversation has become too long. Otherwise the only way is to re-start Julia which can be a bit annoying. |
Re: resetting the history - that's a great idea! I'll track that in #18. |
I have a PR open for adding different formatters (#20), right now just with the Markdown formatter and a plaintext formatter. @FedeClaudi - do you think your Term.jl output could be implemented as one of these formatter functions? If so I think that'd be the nicest way to go so that users could pick between the cool Term formatter and simpler plain for MD styles. |
I had missed @diegozea's comment, but I think having something like "copy 1" and it copies the first code block in the response as a command would be the cleanest option. |
@ThatcherC yeah having the option to choose formatters would be great!
|
Slightly tangential but related to the Term-style formatting: would Term markdown be capable of supporting streaming requests (ie, incremental load of the response) to achieve the same UI as what you experience in the browser? |
Thank you for writing this, much easier then constantly switching between code/web browser.
I made a small change to improve the styling of the responses.
Using Term.jl it's possible to format the Markdown response to make something clearer/better looking.
Id does add a bit of TTX due to Term's code compilation.
Hope this helps!
P.s: getting this exact style requires Term 2.0.2 which will come out today/tomorrow. In doing this I found a bug in Term!