From 9b83adcd644da0c401584be97e58799650c3f694 Mon Sep 17 00:00:00 2001 From: liunux4odoo Date: Tue, 19 Sep 2023 10:16:30 +0800 Subject: [PATCH] fix bug in filter_messages --- README.md | 4 +++- setup.py | 2 +- streamlit_chatbox/__init__.py | 5 +++-- streamlit_chatbox/messages.py | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7c1fdca..cf9dbe3 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,10 @@ This package(>=1.0.0) will focus on wrapper of official chat elements to make ch A Streamlit component to show chat messages. It's basiclly a wrapper of streamlit officeial elements including the chat elemnts. +- demo ![](demo.gif) + +- demo agent ![](demo_agent.gif) ## Features @@ -115,7 +118,6 @@ if cols[1].button('run agent'): agent = FakeAgent() text = "" - if streaming: # streaming: chat_box.ai_say() # generate a blank placeholder to render messages for d in agent.run_stream(): diff --git a/setup.py b/setup.py index c44755a..2c3f878 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ def readme(): setuptools.setup( name='streamlit-chatbox', - version='1.1.8', + version='1.1.9', author='liunux', author_email='liunux@qq.com', description='A chat box and some helpful tools used to build chatbot app with streamlit', diff --git a/streamlit_chatbox/__init__.py b/streamlit_chatbox/__init__.py index 1c26c67..92d6035 100644 --- a/streamlit_chatbox/__init__.py +++ b/streamlit_chatbox/__init__.py @@ -1,11 +1,12 @@ from typing import * -import streamlit as st -import time # from streamlit_option_menu import option_menu import asyncio from .messages import * +__version__ = "1.1.9" + + __all__ = [ "ChatBox", "Markdown", diff --git a/streamlit_chatbox/messages.py b/streamlit_chatbox/messages.py index 0d35e16..9375bcb 100644 --- a/streamlit_chatbox/messages.py +++ b/streamlit_chatbox/messages.py @@ -117,7 +117,7 @@ def default_filter(msg, index=None): def default_stop(history): if isinstance(history_len, int): - user_count = len(x for x in history if x["role"] == "user") + user_count = len([x for x in history if x["role"] == "user"]) return user_count >= history_len else: return False