diff --git a/components/message.tsx b/components/message.tsx
index 1ebe1b933..10916e01c 100644
--- a/components/message.tsx
+++ b/components/message.tsx
@@ -3,14 +3,12 @@
import type { ChatRequestOptions, Message } from 'ai';
import cx from 'classnames';
import { AnimatePresence, motion } from 'framer-motion';
-import { memo, useMemo, useState } from 'react';
+import { memo, useState } from 'react';
import type { Vote } from '@/lib/db/schema';
import { DocumentToolCall, DocumentToolResult } from './document';
import {
- ChevronDownIcon,
- LoaderIcon,
PencilEditIcon,
SparklesIcon,
} from './icons';
@@ -90,89 +88,99 @@ const PurePreviewMessage = ({
)}
- {message.reasoning && (
-
- )}
-
- {(message.content || message.reasoning) && mode === 'view' && (
-
- {message.role === 'user' && !isReadonly && (
-
-
-
+
+ Edit message
+
+ )}
- {message.toolInvocations && message.toolInvocations.length > 0 && (
-
- {message.toolInvocations.map((toolInvocation) => {
- const { toolName, toolCallId, state, args } = toolInvocation;
+
+ {p.text}
+
+
+ );
+ }
+ if (mode === "edit") {
+ return (
+
+
- if (state === 'result') {
- const { result } = toolInvocation;
+
+
+ );
+ }
+ return null;
+ case "reasoning":
+ return (
+
+ );
+ case "tool-invocation":
+ const { toolName, toolCallId, state, args } =
+ p.toolInvocation;
+ if (state === "result") {
+ const { result } = p.toolInvocation;
return (
- {toolName === 'getWeather' ? (
+ {toolName === "getWeather" ? (
- ) : toolName === 'createDocument' ? (
+ ) : toolName === "createDocument" ? (
- ) : toolName === 'updateDocument' ? (
+ ) : toolName === "updateDocument" ? (
- ) : toolName === 'requestSuggestions' ? (
+ ) : toolName === "requestSuggestions" ? (
- {toolName === 'getWeather' ? (
+ {toolName === "getWeather" ? (
- ) : toolName === 'createDocument' ? (
+ ) : toolName === "createDocument" ? (
- ) : toolName === 'updateDocument' ? (
+ ) : toolName === "updateDocument" ? (
- ) : toolName === 'requestSuggestions' ? (
+ ) : toolName === "requestSuggestions" ? (
);
- })}
-
- )}
+ default:
+ return null;
+ }
+ })}
{!isReadonly && (