mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-22 21:54:45 +08:00
feat: support artifact preview
This commit is contained in:
20
frontend/src/core/artifacts/hooks.ts
Normal file
20
frontend/src/core/artifacts/hooks.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { loadArtifactContent } from "./loader";
|
||||
|
||||
export function useArtifactContent({
|
||||
filepath,
|
||||
threadId,
|
||||
enabled,
|
||||
}: {
|
||||
filepath: string;
|
||||
threadId: string;
|
||||
enabled?: boolean;
|
||||
}) {
|
||||
const { data, isLoading, error } = useQuery({
|
||||
queryKey: ["artifact", filepath, threadId],
|
||||
queryFn: () => loadArtifactContent({ filepath, threadId }),
|
||||
enabled,
|
||||
});
|
||||
return { content: data, isLoading, error };
|
||||
}
|
||||
Reference in New Issue
Block a user