Skip to content

Commit

Permalink
add stylizing
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonalaird committed Jul 25, 2024
1 parent f30a732 commit 0519f3d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/chat/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ def main():
with tabs[0]:
messages = st.container(height=400)
for message in st.session_state.messages:
messages.chat_message(message["role"]).write(message["content"])
if message["role"] in {"user", "assistant"}:
msg = message["content"]
msg = msg.replace("<execute_python>", "<execute_python>`")
msg = msg.replace("</execute_python>", "`</execute_python>")
messages.chat_message(message["role"]).write(msg)
else:
messages.chat_message("observation").write(message["content"])

st.text_input("Chat here", key="widget", on_change=submit)
prompt = st.session_state.input_text
Expand Down

0 comments on commit 0519f3d

Please sign in to comment.