Presenting the OrderBot messages in a reverse order

The following slight modification to collect messages will present the assistant/user messages in a reverse order, which I found to be helpful:

def collect_messages(_):
prompt = inp.value_input
inp.value = ‘’
context.append({‘role’:‘user’, ‘content’:f"{prompt}“})
response = get_completion_from_messages(context)
context.append({‘role’:‘assistant’, ‘content’:f”{response}"})
pn.Row(‘User:’, pn.pane.Markdown(prompt, width=600))))
pn.Row(‘Assistant:’, pn.pane.Markdown(response, width=600, style={‘background-color’: ‘#F6F6F6’}))))

return pn.Column(*panels)
1 Like

Hi E0123,

Great idea. How would you describe the way in which this was helpful?


Thank you. I thought it was easier for the user to follow on the user/assistant messages when the messages were presented in reverse order, as suggested.

With the original code, sometimes it was necessary to scroll down in order to find the actual current message. I found it was easier to use the OrderBot once the order of the messages was reversed, as suggested.

Thanks again,