diff --git a/frontend/src/app/workspace/chats/[thread_id]/page.tsx b/frontend/src/app/workspace/chats/[thread_id]/page.tsx
index 7b4b293..1cc8245 100644
--- a/frontend/src/app/workspace/chats/[thread_id]/page.tsx
+++ b/frontend/src/app/workspace/chats/[thread_id]/page.tsx
@@ -14,6 +14,7 @@ import {
import { useSidebar } from "@/components/ui/sidebar";
import {
ArtifactFileDetail,
+ ArtifactFileList,
useArtifacts,
} from "@/components/workspace/artifacts";
import { FlipDisplay } from "@/components/workspace/flip-display";
@@ -32,8 +33,10 @@ export default function ChatPage() {
const [settings, setSettings] = useLocalSettings();
const { setOpen: setSidebarOpen } = useSidebar();
const {
+ artifacts,
open: artifactsOpen,
setOpen: setArtifactsOpen,
+ setArtifacts,
selectedArtifact,
} = useArtifacts();
@@ -65,6 +68,10 @@ export default function ChatPage() {
return result;
}, [thread, isNewThread]);
+ useEffect(() => {
+ setArtifacts(thread.values.artifacts);
+ }, [setArtifacts, thread.values.artifacts]);
+
const handleSubmit = useSubmitThread({
isNewThread,
threadId,
@@ -96,17 +103,17 @@ export default function ChatPage() {
- {!artifactsOpen && (
-
+ {artifacts?.length && !artifactsOpen && (
+
)}
@@ -161,7 +168,7 @@ export default function ChatPage() {
threadId={threadId!}
/>
) : (
-
+
-
}
- title="No artifact selected"
- description="Select an artifact to view its details"
- />
+ {thread.values.artifacts?.length === 0 ? (
+
}
+ title="No artifact selected"
+ description="Select an artifact to view its details"
+ />
+ ) : (
+
+ )}
)}
diff --git a/frontend/src/components/ai-elements/artifact.tsx b/frontend/src/components/ai-elements/artifact.tsx
index c90cb5f..c42459d 100644
--- a/frontend/src/components/ai-elements/artifact.tsx
+++ b/frontend/src/components/ai-elements/artifact.tsx
@@ -16,8 +16,8 @@ export type ArtifactProps = HTMLAttributes;
export const Artifact = ({ className, ...props }: ArtifactProps) => (
@@ -31,8 +31,8 @@ export const ArtifactHeader = ({
}: ArtifactHeaderProps) => (
@@ -49,8 +49,8 @@ export const ArtifactClose = ({
}: ArtifactCloseProps) => (