mirror of
https://github.com/lobehub/lobehub.git
synced 2026-03-27 13:29:15 +07:00
@@ -14,6 +14,7 @@ import { useAgentStore } from '@/store/agent';
|
||||
import { agentSelectors } from '@/store/agent/selectors';
|
||||
|
||||
import { useAgentMeta, useIsBuiltinAgent } from '../../../hooks';
|
||||
import { normalizeThinkTags, processWithArtifact } from '../../../utils/markdown';
|
||||
import { styles as containerStyles } from '../style';
|
||||
import { styles } from './style';
|
||||
import { type FieldType } from './type';
|
||||
@@ -34,6 +35,9 @@ const Preview = memo<PreviewProps>(
|
||||
const agentMeta = useAgentMeta(message.agentId);
|
||||
const isBuiltinAgent = useIsBuiltinAgent();
|
||||
|
||||
// Process message content for proper rendering
|
||||
const processedContent = normalizeThinkTags(processWithArtifact(message.content));
|
||||
|
||||
const { t } = useTranslation('chat');
|
||||
|
||||
const displayTitle = agentMeta.title || title;
|
||||
@@ -79,6 +83,7 @@ const Preview = memo<PreviewProps>(
|
||||
title: displayTitle,
|
||||
}}
|
||||
id={message.id}
|
||||
message={processedContent}
|
||||
/>
|
||||
</Flexbox>
|
||||
{withFooter ? (
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import type { StateCreator } from 'zustand';
|
||||
|
||||
import { useChatStore } from '@/store/chat';
|
||||
|
||||
import type { State } from '../../initialState';
|
||||
|
||||
export interface InputAction {
|
||||
@@ -22,10 +24,14 @@ export interface InputAction {
|
||||
export const inputSlice: StateCreator<State & InputAction, [], [], InputAction> = (set) => ({
|
||||
cleanupInput: () => {
|
||||
set({ editor: null, inputMessage: '' });
|
||||
// Also clear ChatStore's mainInputEditor
|
||||
useChatStore.setState({ mainInputEditor: null });
|
||||
},
|
||||
|
||||
setEditor: (editor) => {
|
||||
set({ editor });
|
||||
// Sync to ChatStore's mainInputEditor for error recovery in sendMessage
|
||||
useChatStore.setState({ mainInputEditor: editor });
|
||||
},
|
||||
|
||||
updateInputMessage: (message) => {
|
||||
|
||||
Reference in New Issue
Block a user