From 4b6ce2ffcb82c1a7467ef7ed8b67b97094a8f6b6 Mon Sep 17 00:00:00 2001 From: "A.J. Shulman" Date: Mon, 19 Aug 2024 12:53:00 -0400 Subject: Streaming wiht thoughts and actions working much better but still get error for web search --- src/client/views/nodes/ChatBox/AnswerParser.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/client/views/nodes/ChatBox/AnswerParser.ts') diff --git a/src/client/views/nodes/ChatBox/AnswerParser.ts b/src/client/views/nodes/ChatBox/AnswerParser.ts index 68637b7c7..1d46a366d 100644 --- a/src/client/views/nodes/ChatBox/AnswerParser.ts +++ b/src/client/views/nodes/ChatBox/AnswerParser.ts @@ -1,8 +1,8 @@ -import { ASSISTANT_ROLE, AssistantMessage, Citation, CHUNK_TYPE, TEXT_TYPE, getChunkType } from './types'; +import { ASSISTANT_ROLE, AssistantMessage, Citation, CHUNK_TYPE, TEXT_TYPE, getChunkType, ProcessingInfo } from './types'; import { v4 as uuid } from 'uuid'; export class AnswerParser { - static parse(xml: string, currentMessage: AssistantMessage): AssistantMessage { + static parse(xml: string, processingInfo: ProcessingInfo[]): AssistantMessage { const answerRegex = /([\s\S]*?)<\/answer>/; const citationsRegex = /([\s\S]*?)<\/citations>/; const citationRegex = /([\s\S]*?)<\/citation>/g; @@ -102,10 +102,15 @@ export class AnswerParser { followUpQuestions.push(questionMatch[1].trim()); } } - currentMessage.content = currentMessage.content.concat(content); - currentMessage.citations = citations; - currentMessage.follow_up_questions = followUpQuestions; - return currentMessage; + const assistantResponse: AssistantMessage = { + role: ASSISTANT_ROLE.ASSISTANT, + content, + follow_up_questions: followUpQuestions, + citations, + processing_info: processingInfo, + }; + + return assistantResponse; } } -- cgit v1.2.3-70-g09d2