diff --git a/app/(chat)/chat/[id]/page.tsx b/app/(chat)/chat/[id]/page.tsx index 5d5b06208..acf5da3d1 100644 --- a/app/(chat)/chat/[id]/page.tsx +++ b/app/(chat)/chat/[id]/page.tsx @@ -1,4 +1,3 @@ - import { cookies } from 'next/headers'; import { notFound } from 'next/navigation'; diff --git a/components/document.tsx b/components/document.tsx index bb415d98e..4c7eb2eb7 100644 --- a/components/document.tsx +++ b/components/document.tsx @@ -3,14 +3,19 @@ import type { SetStateAction } from 'react'; import type { UIBlock } from './block'; import { FileIcon, LoaderIcon, MessageIcon, PencilEditIcon } from './icons'; -const getActionText = (type: 'create' | 'update' | 'request-suggestions') => { +const getActionText = ( + type: 'create' | 'update' | 'request-suggestions', + tense: 'present' | 'past', +) => { switch (type) { case 'create': - return 'Creating'; + return tense === 'present' ? 'Creating' : 'Created'; case 'update': - return 'Updating'; + return tense === 'present' ? 'Updating' : 'Updated'; case 'request-suggestions': - return 'Adding suggestions'; + return tense === 'present' + ? 'Adding suggestions' + : 'Added suggestions to'; default: return null; } @@ -26,7 +31,6 @@ interface DocumentToolResultProps { export function DocumentToolResult({ type, result, - block, setBlock, }: DocumentToolResultProps) { return ( @@ -62,8 +66,8 @@ export function DocumentToolResult({ ) : null} -
- {getActionText(type)} {result.title} +
+ {`${getActionText(type, 'past')} "${result.title}"`}
); @@ -72,11 +76,35 @@ export function DocumentToolResult({ interface DocumentToolCallProps { type: 'create' | 'update' | 'request-suggestions'; args: { title: string }; + setBlock: (value: SetStateAction) => void; } -export function DocumentToolCall({ type, args }: DocumentToolCallProps) { +export function DocumentToolCall({ + type, + args, + setBlock, +}: DocumentToolCallProps) { return ( -
+ ); } diff --git a/components/message.tsx b/components/message.tsx index 6340fcaef..cbbf2d2a9 100644 --- a/components/message.tsx +++ b/components/message.tsx @@ -104,13 +104,22 @@ export const PreviewMessage = ({ {toolName === 'getWeather' ? ( ) : toolName === 'createDocument' ? ( - + ) : toolName === 'updateDocument' ? ( - + ) : toolName === 'requestSuggestions' ? ( ) : null}