diff --git a/frontend/src/app/workspace/chats/[thread_id]/page.tsx b/frontend/src/app/workspace/chats/[thread_id]/page.tsx
index 2efbabc..39b8ef2 100644
--- a/frontend/src/app/workspace/chats/[thread_id]/page.tsx
+++ b/frontend/src/app/workspace/chats/[thread_id]/page.tsx
@@ -43,6 +43,7 @@ export default function ChatPage() {
open: artifactsOpen,
setOpen: setArtifactsOpen,
setArtifacts,
+ select: selectArtifact,
selectedArtifact,
} = useArtifacts();
const { thread_id: threadIdFromPath } = useParams<{ thread_id: string }>();
@@ -75,9 +76,16 @@ export default function ChatPage() {
useEffect(() => {
setArtifacts(thread.values.artifacts);
- }, [setArtifacts, thread.values.artifacts]);
+ if (env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true") {
+ if (thread?.values?.artifacts?.length > 0) {
+ selectArtifact(thread.values.artifacts[0]!);
+ }
+ }
+ }, [selectArtifact, setArtifacts, thread.values.artifacts]);
- const [todoListCollapsed, setTodoListCollapsed] = useState(true);
+ const [todoListCollapsed, setTodoListCollapsed] = useState(
+ env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY !== "true",
+ );
const handleSubmit = useSubmitThread({
isNewThread,
diff --git a/frontend/src/components/workspace/artifacts/artifact-file-detail.tsx b/frontend/src/components/workspace/artifacts/artifact-file-detail.tsx
index ae98c87..627b6d2 100644
--- a/frontend/src/components/workspace/artifacts/artifact-file-detail.tsx
+++ b/frontend/src/components/workspace/artifacts/artifact-file-detail.tsx
@@ -1,6 +1,8 @@
import {
+ Code2Icon,
CopyIcon,
DownloadIcon,
+ EyeIcon,
SquareArrowOutUpRightIcon,
XIcon,
} from "lucide-react";
@@ -31,6 +33,8 @@ import { useI18n } from "@/core/i18n/hooks";
import { checkCodeFile, getFileName } from "@/core/utils/files";
import { cn } from "@/lib/utils";
+import { Tooltip } from "../tooltip";
+
import { useArtifacts } from "./context";
export function ArtifactFileDetail({
@@ -115,8 +119,16 @@ export function ArtifactFileDetail({
setViewMode(value as "code" | "preview")
}
>
- Code
- Preview
+
+
+
+
+
+
+
+
+
+
)}
diff --git a/frontend/src/components/workspace/artifacts/context.tsx b/frontend/src/components/workspace/artifacts/context.tsx
index a7621f4..2428d86 100644
--- a/frontend/src/components/workspace/artifacts/context.tsx
+++ b/frontend/src/components/workspace/artifacts/context.tsx
@@ -1,6 +1,7 @@
import { createContext, useContext, useState, type ReactNode } from "react";
import { useSidebar } from "@/components/ui/sidebar";
+import { env } from "@/env";
export interface ArtifactsContextType {
artifacts: string[];
@@ -28,7 +29,9 @@ export function ArtifactsProvider({ children }: ArtifactsProviderProps) {
const [artifacts, setArtifacts] = useState([]);
const [selectedArtifact, setSelectedArtifact] = useState(null);
const [autoSelect, setAutoSelect] = useState(true);
- const [open, setOpen] = useState(false);
+ const [open, setOpen] = useState(
+ env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true",
+ );
const [autoOpen, setAutoOpen] = useState(true);
const { setOpen: setSidebarOpen } = useSidebar();
diff --git a/frontend/src/core/i18n/locales/en-US.ts b/frontend/src/core/i18n/locales/en-US.ts
index aae2141..fa9ff8e 100644
--- a/frontend/src/core/i18n/locales/en-US.ts
+++ b/frontend/src/core/i18n/locales/en-US.ts
@@ -22,6 +22,8 @@ export const enUS: Translations = {
custom: "Custom",
notAvailableInDemoMode: "Not available in demo mode",
loading: "Loading...",
+ code: "Code",
+ preview: "Preview",
},
// Welcome
diff --git a/frontend/src/core/i18n/locales/types.ts b/frontend/src/core/i18n/locales/types.ts
index dbdbb57..bb2fab9 100644
--- a/frontend/src/core/i18n/locales/types.ts
+++ b/frontend/src/core/i18n/locales/types.ts
@@ -20,6 +20,8 @@ export interface Translations {
custom: string;
notAvailableInDemoMode: string;
loading: string;
+ code: string;
+ preview: string;
};
// Welcome
diff --git a/frontend/src/core/i18n/locales/zh-CN.ts b/frontend/src/core/i18n/locales/zh-CN.ts
index 000fd92..eed6246 100644
--- a/frontend/src/core/i18n/locales/zh-CN.ts
+++ b/frontend/src/core/i18n/locales/zh-CN.ts
@@ -22,6 +22,8 @@ export const zhCN: Translations = {
custom: "自定义",
notAvailableInDemoMode: "在演示模式下不可用",
loading: "加载中...",
+ code: "代码",
+ preview: "预览",
},
// Welcome