fix: always parse all assistant messages (#13)

This commit is contained in:
Dominic Elm 2024-07-26 11:09:35 +02:00 committed by GitHub
parent 14747cfa0f
commit 20e2d49993
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 9 deletions

View File

@ -4,13 +4,13 @@ import { useAnimate } from 'framer-motion';
import { useEffect, useRef, useState } from 'react';
import { cssTransition, toast, ToastContainer } from 'react-toastify';
import { useMessageParser, usePromptEnhancer, useSnapScroll } from '~/lib/hooks';
import { useChatHistory } from '~/lib/persistence';
import { chatStore } from '~/lib/stores/chat';
import { workbenchStore } from '~/lib/stores/workbench';
import { fileModificationsToHTML } from '~/utils/diff';
import { cubicEasingFn } from '~/utils/easings';
import { createScopedLogger } from '~/utils/logger';
import { BaseChat } from './BaseChat';
import { useChatHistory } from '~/lib/persistence';
const toastAnimation = cssTransition({
enter: 'animated fadeInRight',

View File

@ -52,14 +52,6 @@ export function useMessageParser() {
for (const [index, message] of messages.entries()) {
if (message.role === 'assistant') {
/**
* In production, we only parse the last assistant message since previous messages can't change.
* During development they can change, e.g., if the parser gets modified.
*/
if (import.meta.env.PROD && index < messages.length - 1) {
continue;
}
const newParsedContent = messageParser.parse(message.id, message.content);
setParsedMessages((prevParsed) => ({