Skip to content

Commit 290d32b

Browse files
remove everything before and including answer tag
1 parent 2e67a0d commit 290d32b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/web/src/features/chat/utils.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,12 @@ export const getAnswerPartFromAssistantMessage = (message: SBChatMessage, isStre
338338
.findLast((part) => part.type === 'text')
339339

340340
if (lastTextPart?.text.includes(ANSWER_TAG)) {
341-
return lastTextPart;
341+
const answerIndex = lastTextPart.text.indexOf(ANSWER_TAG);
342+
const answer = lastTextPart.text.substring(answerIndex + ANSWER_TAG.length);
343+
return {
344+
...lastTextPart,
345+
text: answer
346+
};
342347
}
343348

344349
// If the agent did not include the answer tag, then fallback to using the last text part.

0 commit comments

Comments
 (0)