From ae359a9c7b94df6c66416b342936455e2e20cb70 Mon Sep 17 00:00:00 2001 From: Adil Hafeez Date: Thu, 17 Oct 2024 17:24:07 -0700 Subject: [PATCH] more comments --- chatbot_ui/app/run.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chatbot_ui/app/run.py b/chatbot_ui/app/run.py index ae2ff037..02d6e01c 100644 --- a/chatbot_ui/app/run.py +++ b/chatbot_ui/app/run.py @@ -74,6 +74,9 @@ def predict(message, state): content = response.choices[0].message.content history.append({"role": "assistant", "content": content, "model": response.model}) + + # for gradio UI we don't want to show raw tool calls and messages from developer application + # so we're filtering those out history_view = [h for h in history if h["role"] != "tool" and "content" in h] messages = [ (history_view[i]["content"], history_view[i + 1]["content"])