- {allActionFinished ? (
-
- ) : (
-
- )}
+ <>
+
+
+
-
+ )}
- {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 && (
+
+
+ )}
+ {onFork && (
+
+
+ )}
+
+ )}
+
>
{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 (
-