Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

557 B
Raw Blame
import { type SkillDraftFile } from "@/src/features/skills/components/skillEditorStore";
import { api } from "@/src/utils/api";

export function useSkillFileContents(projectId: string, file: SkillDraftFile) {
  return api.skills.fileContents.useQuery(
    { projectId, sha256Hashes: file.sourceSha ? [file.sourceSha] : [] },
    {
      enabled: file.content === undefined && file.sourceSha !== null,
      select: (response) => response.data[0],
      staleTime: Infinity,
      gcTime: 10 * 60 * 1000,
      meta: { silentAllErrors: true },
    },
  );
}