diff --git a/setup.py b/setup.py index a26d295..b850715 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ def readme(): setuptools.setup( name='streamlit-chatbox', - version='0.2.3', + version='0.2.4', author='liunux', author_email='liunux@qq.com', description='A chat box used in streamlit', diff --git a/streamlit_chatbox/__init__.py b/streamlit_chatbox/__init__.py index 6f65cb0..8ea5865 100644 --- a/streamlit_chatbox/__init__.py +++ b/streamlit_chatbox/__init__.py @@ -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
"): 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 )