Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion frontend/src/components/workspace/chats/use-thread-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { useParams, usePathname, useSearchParams } from "next/navigation";
import { useCallback, useEffect, useRef, useState } from "react";

import { SHOWCASE_ROUTE_PREFIX } from "@/core/threads/static-demo";
import { uuid } from "@/core/utils/uuid";

export const THREAD_CHAT_RESET_EVENT = "deer-flow:thread-chat-reset";
Expand Down Expand Up @@ -120,7 +121,7 @@ export function useThreadChat() {
}, []);

const isMock =
actualPathname.startsWith("/showcase/") ||
actualPathname.startsWith(`${SHOWCASE_ROUTE_PREFIX}/`) ||
searchParams.get("mock") === "true";
return {
threadId: isNewPath ? (newThreadIdRef.current ?? threadId) : threadId,
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/core/threads/static-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,11 @@ export function isDemoThreadId(threadId: string): boolean {
return DEMO_THREAD_ID_SET.has(threadId);
}

/** Route prefix for the public, read-only showcase demo thread pages. */
export const SHOWCASE_ROUTE_PREFIX = "/showcase";

export function pathOfPublicDemoThread(threadId: string): string {
return `/showcase/${encodeURIComponent(threadId)}`;
return `${SHOWCASE_ROUTE_PREFIX}/${encodeURIComponent(threadId)}`;
}

export type ThreadSearchParams = NonNullable<
Expand Down