Skip to content

Commit

Permalink
fix: fixed with rendering messages
Browse files Browse the repository at this point in the history
  • Loading branch information
KenyonY committed Jul 20, 2024
1 parent 94ca947 commit 25c3b89
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions openai_forward/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ def _start_streamlit(self, port):
'true',
'--theme.base',
'light',
'--browser.gatherUsageStats',
'false',
]
)

Expand Down
3 changes: 2 additions & 1 deletion openai_forward/webui/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ def render_chat_log_message(msg: Dict):
if msg.get("user_role"):
with st.chat_message(name="human"):
messages = msg.pop('messages')
st.write({msg_item['role']: msg_item['content'] for msg_item in messages})
for msg_item in messages:
st.write(f"`{msg_item['role']}`: {msg_item['content']}")
st.write(msg)
elif msg.get("assistant_role"):
with st.chat_message(name="ai"):
Expand Down
1 change: 0 additions & 1 deletion openai_forward/webui/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ def display_other_configuration():
uid, msg = q.get()
uid: bytes
print(f"{uid=}")
time.sleep(0.01)
item = orjson.loads(msg)
if uid.startswith(b"0"):
item['user_role'] = True
Expand Down

0 comments on commit 25c3b89

Please sign in to comment.