Skip to content

Commit

Permalink
custom cursor position
Browse files Browse the repository at this point in the history
  • Loading branch information
liunux committed Jul 14, 2023
1 parent 10054b4 commit 36269c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def readme():

setuptools.setup(
name='streamlit-chatbox',
version='0.2.3',
version='0.2.4',
author='liunux',
author_email='[email protected]',
description='A chat box used in streamlit',
Expand Down
6 changes: 4 additions & 2 deletions streamlit_chatbox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,13 @@ def output_messages(
self.last_response = empty
return self.last_response

def update_last_box_text(self, msg):
def update_last_box_text(self, msg, cursor_pos="\n\n<details>"):
if self.last_response is not None:
self.history[-1]['content'] = msg
if cursor_pos:
msg = msg.replace(cursor_pos, " ▌" + cursor_pos, 1)
self.last_response.markdown(
self.format_md(msg + '▌', False),
self.format_md(msg, False),
unsafe_allow_html=True
)

Expand Down

0 comments on commit 36269c8

Please sign in to comment.