Skip to content

Commit 7161685

Browse files
handled streaming chart response
1 parent e15fb4e commit 7161685

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/App/src/components/Chat/Chat.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,11 @@ const Chat: React.FC<ChatProps> = ({
558558
scrollChatToBottom();
559559
} else if (isChartQuery(userMessage)) {
560560
try {
561-
const parsedChartResponse = JSON.parse(runningText);
561+
562+
const splitRunningText= runningText.split("}{")
563+
let parsedChartResponse:any = {};
564+
parsedChartResponse["object"] = JSON.parse(JSON.parse("{" + splitRunningText[splitRunningText.length-1])?.choices[0]?.messages[0]?.content)?.answer;
565+
562566
if (
563567
"object" in parsedChartResponse &&
564568
parsedChartResponse?.object?.type &&

0 commit comments

Comments
 (0)