TheR1D / shell_gpt

A command-line productivity tool powered by AI large language models like GPT-4, will help you accomplish your tasks faster and more efficiently.
MIT License
9.43k stars 746 forks source link

Chat formatting when listing chat history #422

Closed amorphius closed 7 months ago

amorphius commented 9 months ago

Default output is nicely formatted and I was expecting that printing chat history via sgpt --show-chat 1 will print chat history with exactly same formatting but it's not the case. I see raw text without any format. Is there any option for formatting chat histories or this is just not implemented feature so far?

jeanlucthumm commented 8 months ago

Currently show chat will output different color based on if the message was from the assistant or the human. I don't think rich.markdown has support for coloring text at the top level like that:

image

We can probably just bold the source though and it should be clear enough:


system: You are ShellGPT You are programming and system administration assistant. You are managing Linux/Arch Linux operating system with fish shell. Provide short responses in about 100 words, unless you are specifically asked for more details. Use and apply Markdown formatting when possible. If you need to store any data, assume it will be stored in the conversation. user: Hello testing assistant: Hello! How can I assist you with your Linux/Arch Linux system or programming tasks today? user: random code assistant: Sure, here's a simple Python script that generates a random number between 1 and 10:

import random

random_number = random.randint(1, 10)
print(f"The random number is {random_number}")

You can run this script in your terminal by saving it to a file (e.g., random_number.py) and then executing python random_number.py. user: Done! assistant: Great! If you have any other questions or need further assistance with programming or managing your Linux/Arch Linux system, feel free to ask. I'm here to help!

jeanlucthumm commented 8 months ago

Nevermind it actually looks fine without the bolding because markdown adds new lines (see #444)