Skip to content

Commit

Permalink
fix bug in filter_messages
Browse files Browse the repository at this point in the history
  • Loading branch information
liunux4odoo committed Sep 19, 2023
1 parent c6f7657 commit 9b83adc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def readme():

setuptools.setup(
name='streamlit-chatbox',
version='1.1.8',
version='1.1.9',
author='liunux',
author_email='[email protected]',
description='A chat box and some helpful tools used to build chatbot app with streamlit',
Expand Down
5 changes: 3 additions & 2 deletions streamlit_chatbox/__init__.py
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion streamlit_chatbox/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9b83adc

Please sign in to comment.