darrenburns / elia

A snappy, keyboard-centric terminal user interface for interacting with large language models. Chat with ChatGPT, Claude, Llama 3, Phi 3, Mistral, Gemma and more.
Apache License 2.0
1.86k stars 115 forks source link

Sent messages are rendered as markdown #25

Closed The-Compiler closed 6 months ago

The-Compiler commented 9 months ago

On the 0.5.0 release,

image

renders as:

image

And more generally, markdown is rendered in what the user types. However, ChatGPT does not interpret input as Markdown as far as I know, so it might make sense to display messages coming from the user as plain text entirely?

kjrstory commented 9 months ago

It seems simple to fix this. If you change the part of the chatbox.py file as below

...
from rich.text import Text
...
    @property
    def markdown(self) -> Markdown:
        return Markdown(self.message.content or "")

    @property
    def text(self) -> Text:
        return Text(self.message.content or "")

    def render(self) -> RenderableType:
        if self.message.type == "human":
            return self.text
        else:
            return self.markdown
...

There are three types of messages: human, ai, and system. I confirmed that the input was rendered as text and the output was rendered as markdown.

However, I cannot judge whether it makes sense. The code may become complicated, but it will also be possible to choose whether to render the user's input as markdown or text.

darrenburns commented 6 months ago

This has been fixed in 1.0.0