mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-11 01:34:45 +08:00
21 lines
470 B
TypeScript
21 lines
470 B
TypeScript
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 };
|
|
}
|