szczyglis-dev / py-gpt

Desktop AI Assistant powered by o1, GPT-4, GPT-4 Vision, Gemini, Claude, Llama 3, Bielik, DALL-E, Langchain, Llama-index, chat, vision, voice control, image generation and analysis, agents, command execution, file upload/download, speech synthesis and recognition, access to Web, memory, presets, assistants, plugins, and more. Linux, Windows, Mac.
https://pygpt.net
Other
614 stars 116 forks source link

feature request - code formatting #43

Closed glinkot closed 7 months ago

glinkot commented 7 months ago

Would be nice to have two features on code (see screenshot from heyGPT, which has been abandoned but has been my go-to until I found pyGPT):

image

glinkot commented 7 months ago

I notice this project which could help with the syntax highlighting:

https://pygments.org/

szczyglis-dev commented 7 months ago

Copy to clipboard button added in 2.1.45. Thanks!

Code highlighting coming soon.

glinkot commented 7 months ago

Another notable thing - the one I use applies the code highlighting in real time as the text comes through, rather than just once at the end. That's really useful as you watch it spool out.

glinkot commented 7 months ago

I downloaded 2.1.46 that mentioned improved code formatting, but I didn't notice differences yet. Thanks so much for looking into it though!

szczyglis-dev commented 7 months ago

Syntax highlighting added in 2.1.59:

2.1.59 (2024-04-20)

glinkot commented 7 months ago

This is awesome! Do you think it runs quickly enough that we could apply the highlight after each word or few words as it streams out of the API, rather than once at the end?

glinkot commented 7 months ago

Also it would be good to put any unrecognised syntaxes into a monospaced code box rather than leaving the backticks (example of each shown)

image

image

szczyglis-dev commented 7 months ago

This is awesome! Do you think it runs quickly enough that we could apply the highlight after each word or few words as it streams out of the API, rather than once at the end?

Thanks ;) And yes, real-time formatting in stream mode has just been added in version 2.1.61 (it also works for syntax highlighting).

2.1.61 (2024-04-21)

Also added default syntax highlighting if no language is provided:

2.1.62 (2024-04-22)