ShipBit / slickgpt

SlickGPT is a light-weight "use-your-own-API-key" web client for the OpenAI API written in Svelte. It offers GPT-4 integration, a userless share feature and other superpowers.
https://slickgpt.vercel.app
MIT License
464 stars 97 forks source link

Multiline formatting of code block is lost for several (non-supported?) languages #107

Closed GrAndAG closed 3 weeks ago

GrAndAG commented 4 months ago

For example, the assembly/nasm/x86 code block lost its formatting and shown as single line.

image

The corresponding JSON of the response:

    {
      "role": "assistant",
      "content": "Here's a simple \"Hello, World!\" program in x86 assembly language for the NASM (Netwide Assembler) assembler:\n\n```nasm\nsection .data\n    msg db 'Hello, World!', 0\n\nsection .text\n    global _start\n\n_start:\n    ; Print the message\n    mov eax, 4      ; system call number for write\n    mov ebx, 1      ; file descriptor (stdout)\n    mov ecx, msg    ; address of string to write\n    mov edx, len    ; length of string\n    int 0x80        ; invoke operating system\n\n    ; Exit the program\n    mov eax, 1      ; system call number for exit\n    xor ebx, ebx    ; return code (0)\n    int 0x80        ; invoke operating system\n\nsection .data\nlen equ $-msg    ; calculate length of string\n```\n\n...."
    },

Another examples:

image image

And again, a lot of \n in original responce are lost in code block.

Shackless commented 4 months ago

Yeah that's because our syntax highlighter highlight.js doesn't support these languages be default. Maybe with a plugin.

GrAndAG commented 4 months ago

It's ok if a language is not supported and rendered without syntax highlighting. But anyway it has to be displayed "as is" at least (preserve multiline formatting).