Dominic Elm
commited on
fix: always parse all assistant messages (#13)
Browse files
packages/bolt/app/components/chat/Chat.client.tsx
CHANGED
@@ -4,13 +4,13 @@ import { useAnimate } from 'framer-motion';
|
|
4 |
import { useEffect, useRef, useState } from 'react';
|
5 |
import { cssTransition, toast, ToastContainer } from 'react-toastify';
|
6 |
import { useMessageParser, usePromptEnhancer, useSnapScroll } from '~/lib/hooks';
|
|
|
7 |
import { chatStore } from '~/lib/stores/chat';
|
8 |
import { workbenchStore } from '~/lib/stores/workbench';
|
9 |
import { fileModificationsToHTML } from '~/utils/diff';
|
10 |
import { cubicEasingFn } from '~/utils/easings';
|
11 |
import { createScopedLogger } from '~/utils/logger';
|
12 |
import { BaseChat } from './BaseChat';
|
13 |
-
import { useChatHistory } from '~/lib/persistence';
|
14 |
|
15 |
const toastAnimation = cssTransition({
|
16 |
enter: 'animated fadeInRight',
|
|
|
4 |
import { useEffect, useRef, useState } from 'react';
|
5 |
import { cssTransition, toast, ToastContainer } from 'react-toastify';
|
6 |
import { useMessageParser, usePromptEnhancer, useSnapScroll } from '~/lib/hooks';
|
7 |
+
import { useChatHistory } from '~/lib/persistence';
|
8 |
import { chatStore } from '~/lib/stores/chat';
|
9 |
import { workbenchStore } from '~/lib/stores/workbench';
|
10 |
import { fileModificationsToHTML } from '~/utils/diff';
|
11 |
import { cubicEasingFn } from '~/utils/easings';
|
12 |
import { createScopedLogger } from '~/utils/logger';
|
13 |
import { BaseChat } from './BaseChat';
|
|
|
14 |
|
15 |
const toastAnimation = cssTransition({
|
16 |
enter: 'animated fadeInRight',
|
packages/bolt/app/lib/hooks/useMessageParser.ts
CHANGED
@@ -52,14 +52,6 @@ export function useMessageParser() {
|
|
52 |
|
53 |
for (const [index, message] of messages.entries()) {
|
54 |
if (message.role === 'assistant') {
|
55 |
-
/**
|
56 |
-
* In production, we only parse the last assistant message since previous messages can't change.
|
57 |
-
* During development they can change, e.g., if the parser gets modified.
|
58 |
-
*/
|
59 |
-
if (import.meta.env.PROD && index < messages.length - 1) {
|
60 |
-
continue;
|
61 |
-
}
|
62 |
-
|
63 |
const newParsedContent = messageParser.parse(message.id, message.content);
|
64 |
|
65 |
setParsedMessages((prevParsed) => ({
|
|
|
52 |
|
53 |
for (const [index, message] of messages.entries()) {
|
54 |
if (message.role === 'assistant') {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
const newParsedContent = messageParser.parse(message.id, message.content);
|
56 |
|
57 |
setParsedMessages((prevParsed) => ({
|