diff options
author | A.J. Shulman <Shulman.aj@gmail.com> | 2024-08-19 12:53:00 -0400 |
---|---|---|
committer | A.J. Shulman <Shulman.aj@gmail.com> | 2024-08-19 12:53:00 -0400 |
commit | 4b6ce2ffcb82c1a7467ef7ed8b67b97094a8f6b6 (patch) | |
tree | 8878d68bcbf46d176c59baecae69d6ae26bb33d2 /src/client/views/nodes/ChatBox/AnswerParser.ts | |
parent | ff3c041af6738d025926732115a032d40cffb859 (diff) |
Streaming wiht thoughts and actions working much better but still get error for web search
Diffstat (limited to 'src/client/views/nodes/ChatBox/AnswerParser.ts')
-rw-r--r-- | src/client/views/nodes/ChatBox/AnswerParser.ts | 17 |
1 files changed, 11 insertions, 6 deletions
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 = /<answer>([\s\S]*?)<\/answer>/; const citationsRegex = /<citations>([\s\S]*?)<\/citations>/; const citationRegex = /<citation index="([^"]+)" chunk_id="([^"]+)" type="([^"]+)">([\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; } } |