From e8498f5d25967c6c11f1d2045881bc495b2d3ca9 Mon Sep 17 00:00:00 2001 From: Adil Hafeez Date: Mon, 28 Oct 2024 23:41:08 -0700 Subject: [PATCH] add comments --- chatbot_ui/common.py | 1 + chatbot_ui/run_stream.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) 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,