diff --git a/app/components/chat/Artifact.tsx b/app/components/chat/Artifact.tsx index d164689a..154b69eb 100644 --- a/app/components/chat/Artifact.tsx +++ b/app/components/chat/Artifact.tsx @@ -63,68 +63,74 @@ export const Artifact = memo(({ messageId }: ArtifactProps) => { }, [actions]); return ( -
-
- + {artifact.type !== 'bundled' &&
} + + {actions.length && artifact.type !== 'bundled' && ( + +
+
+
+
+ )} +
+
+ {artifact.type === 'bundled' && ( +
+
+ {allActionFinished ? ( +
+ ) : ( +
+ )} +
+
Create initial files
- -
+ )} - {actions.length && artifact.type !== 'bundled' && ( - 0 && ( + -
-
+
+ +
+
- + )}
- - {artifact.type !== 'bundled' && showActions && actions.length > 0 && ( - -
- -
- -
- - )} - -
+ ); }); diff --git a/app/components/chat/AssistantMessage.tsx b/app/components/chat/AssistantMessage.tsx index 20e26562..370d5bf0 100644 --- a/app/components/chat/AssistantMessage.tsx +++ b/app/components/chat/AssistantMessage.tsx @@ -4,10 +4,14 @@ import type { JSONValue } from 'ai'; import Popover from '~/components/ui/Popover'; import { workbenchStore } from '~/lib/stores/workbench'; import { WORK_DIR } from '~/utils/constants'; +import WithTooltip from '~/components/ui/Tooltip'; interface AssistantMessageProps { content: string; annotations?: JSONValue[]; + messageId?: string; + onRewind?: (messageId: string) => void; + onFork?: (messageId: string) => void; } function openArtifactInWorkbench(filePath: string) { @@ -34,7 +38,7 @@ function normalizedFilePath(path: string) { return normalizedPath; } -export const AssistantMessage = memo(({ content, annotations }: AssistantMessageProps) => { +export const AssistantMessage = memo(({ content, annotations, messageId, onRewind, onFork }: AssistantMessageProps) => { const filteredAnnotations = (annotations?.filter( (annotation: JSONValue) => annotation && typeof annotation === 'object' && Object.keys(annotation).includes('type'), ) || []) as { type: string; value: any } & { [key: string]: any }[]; @@ -100,11 +104,35 @@ export const AssistantMessage = memo(({ content, annotations }: AssistantMessage
)} - {usage && ( -
- Tokens: {usage.totalTokens} (prompt: {usage.promptTokens}, completion: {usage.completionTokens}) -
- )} +
+ {usage && ( +
+ Tokens: {usage.totalTokens} (prompt: {usage.promptTokens}, completion: {usage.completionTokens}) +
+ )} + {(onRewind || onFork) && messageId && ( +
+ {onRewind && ( + +
+ )} +
{content} diff --git a/app/components/chat/Messages.client.tsx b/app/components/chat/Messages.client.tsx index 4d7e2a65..47e28274 100644 --- a/app/components/chat/Messages.client.tsx +++ b/app/components/chat/Messages.client.tsx @@ -7,7 +7,6 @@ import { useLocation } from '@remix-run/react'; import { db, chatId } from '~/lib/persistence/useChatHistory'; import { forkChat } from '~/lib/persistence/db'; import { toast } from 'react-toastify'; -import WithTooltip from '~/components/ui/Tooltip'; import { useStore } from '@nanostores/react'; import { profileStore } from '~/lib/stores/profile'; import { forwardRef } from 'react'; @@ -63,7 +62,7 @@ export const Messages = forwardRef( return (
( {isUserMessage ? ( ) : ( - + )}
- {!isUserMessage && ( -
- {messageId && ( - -
- )}
); }) diff --git a/app/components/chat/UserMessage.tsx b/app/components/chat/UserMessage.tsx index e7ef54a6..4e3d4ad1 100644 --- a/app/components/chat/UserMessage.tsx +++ b/app/components/chat/UserMessage.tsx @@ -16,7 +16,7 @@ export function UserMessage({ content }: UserMessageProps) { const images = content.filter((item) => item.type === 'image' && item.image); return ( -
+
{textContent && {textContent}} {images.map((item, index) => ( diff --git a/app/styles/variables.scss b/app/styles/variables.scss index d67aeeee..42c86816 100644 --- a/app/styles/variables.scss +++ b/app/styles/variables.scss @@ -217,8 +217,8 @@ */ :root { --header-height: 54px; - --chat-max-width: 37rem; - --chat-min-width: 640px; + --chat-max-width: 35rem; + --chat-min-width: 575px; --workbench-width: min(calc(100% - var(--chat-min-width)), 2536px); --workbench-inner-width: var(--workbench-width); --workbench-left: calc(100% - var(--workbench-width));