mirror of
https://github.com/stackblitz/bolt.new
synced 2024-11-27 22:42:21 +00:00
fix: always parse all assistant messages (#13)
This commit is contained in:
parent
14747cfa0f
commit
20e2d49993
@ -4,13 +4,13 @@ import { useAnimate } from 'framer-motion';
|
|||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { cssTransition, toast, ToastContainer } from 'react-toastify';
|
import { cssTransition, toast, ToastContainer } from 'react-toastify';
|
||||||
import { useMessageParser, usePromptEnhancer, useSnapScroll } from '~/lib/hooks';
|
import { useMessageParser, usePromptEnhancer, useSnapScroll } from '~/lib/hooks';
|
||||||
|
import { useChatHistory } from '~/lib/persistence';
|
||||||
import { chatStore } from '~/lib/stores/chat';
|
import { chatStore } from '~/lib/stores/chat';
|
||||||
import { workbenchStore } from '~/lib/stores/workbench';
|
import { workbenchStore } from '~/lib/stores/workbench';
|
||||||
import { fileModificationsToHTML } from '~/utils/diff';
|
import { fileModificationsToHTML } from '~/utils/diff';
|
||||||
import { cubicEasingFn } from '~/utils/easings';
|
import { cubicEasingFn } from '~/utils/easings';
|
||||||
import { createScopedLogger } from '~/utils/logger';
|
import { createScopedLogger } from '~/utils/logger';
|
||||||
import { BaseChat } from './BaseChat';
|
import { BaseChat } from './BaseChat';
|
||||||
import { useChatHistory } from '~/lib/persistence';
|
|
||||||
|
|
||||||
const toastAnimation = cssTransition({
|
const toastAnimation = cssTransition({
|
||||||
enter: 'animated fadeInRight',
|
enter: 'animated fadeInRight',
|
||||||
|
@ -52,14 +52,6 @@ export function useMessageParser() {
|
|||||||
|
|
||||||
for (const [index, message] of messages.entries()) {
|
for (const [index, message] of messages.entries()) {
|
||||||
if (message.role === 'assistant') {
|
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);
|
const newParsedContent = messageParser.parse(message.id, message.content);
|
||||||
|
|
||||||
setParsedMessages((prevParsed) => ({
|
setParsedMessages((prevParsed) => ({
|
||||||
|
Loading…
Reference in New Issue
Block a user