diff --git a/chatbot_ui/common.py b/chatbot_ui/common.py index 19111668..5fd33c5f 100644 --- a/chatbot_ui/common.py +++ b/chatbot_ui/common.py @@ -1,5 +1,6 @@ import json import logging +import os import yaml logging.basicConfig( diff --git a/chatbot_ui/run_stream.py b/chatbot_ui/run_stream.py index 798a2d5e..76ca8742 100644 --- a/chatbot_ui/run_stream.py +++ b/chatbot_ui/run_stream.py @@ -83,7 +83,9 @@ def chat(query: Optional[str], conversation: Optional[List[Tuple[str, str]]], st if message.content: history[-1]["content"] = history[-1].get("content", "") + message.content - if history[-1]["role"] != "tool" and message.content: + # message.content is none for tool calls + # when "role = tool" content would contain api call response + if message.content and history[-1]["role"] != "tool": conversation[-1] = ( conversation[-1][0], conversation[-1][1] + message.content,