fix: ValueError breaks Ui #629 (#630) #none

This commit is contained in:
Varun Sharma 2025-02-14 15:33:35 +01:00 committed by GitHub
parent 8b04f8475a
commit 952026da6c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1317,39 +1317,42 @@ class ChatPage(BasePage):
chat_state, chat_state,
) )
for response in pipeline.stream(chat_input, conversation_id, chat_history): try:
for response in pipeline.stream(chat_input, conversation_id, chat_history):
if not isinstance(response, Document): if not isinstance(response, Document):
continue continue
if response.channel is None: if response.channel is None:
continue continue
if response.channel == "chat": if response.channel == "chat":
if response.content is None: if response.content is None:
text = "" text = ""
else: else:
text += response.content text += response.content
if response.channel == "info": if response.channel == "info":
if response.content is None: if response.content is None:
refs = "" refs = ""
else: else:
refs += response.content refs += response.content
if response.channel == "plot": if response.channel == "plot":
plot = response.content plot = response.content
plot_gr = self._json_to_plot(plot) plot_gr = self._json_to_plot(plot)
chat_state[pipeline.get_info()["id"]] = reasoning_state["pipeline"] chat_state[pipeline.get_info()["id"]] = reasoning_state["pipeline"]
yield ( yield (
chat_history + [(chat_input, text or msg_placeholder)], chat_history + [(chat_input, text or msg_placeholder)],
refs, refs,
plot_gr, plot_gr,
plot, plot,
chat_state, chat_state,
) )
except ValueError as e:
print(e)
if not text: if not text:
empty_msg = getattr( empty_msg = getattr(