Download apps/vis/web/src/hooks/useTasks.ts from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 950 Bytes
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/apps/vis/web/src/hooks/useTasks.ts
- Command line
-
hf download hf://SaylorTwift/kimi-code/apps/vis/web/src/hooks/useTasks.ts
-
curl -L -o useTasks.ts https://huggingface.co/SaylorTwift/kimi-code/resolve/main/apps/vis/web/src/hooks/useTasks.ts
950 Bytes
| import { useQuery } from '@tanstack/react-query'; | |
| import { api } from '../api'; | |
| /** Background tasks for a session (process / agent / question), with | |
| * `output.log` size metadata per task. */ | |
| export function useTasks(sessionId: string | undefined) { | |
| return useQuery({ | |
| queryKey: ['tasks', sessionId] as const, | |
| queryFn: () => api.getTasks(sessionId!), | |
| enabled: !!sessionId, | |
| }); | |
| } | |
| /** Cron jobs scheduled within a session. */ | |
| export function useCron(sessionId: string | undefined) { | |
| return useQuery({ | |
| queryKey: ['cron', sessionId] as const, | |
| queryFn: () => api.getCron(sessionId!), | |
| enabled: !!sessionId, | |
| }); | |
| } | |
| /** Parsed diagnostic log for a session (session or global). */ | |
| export function useLogs(sessionId: string | undefined, which: 'session' | 'global') { | |
| return useQuery({ | |
| queryKey: ['logs', sessionId, which] as const, | |
| queryFn: () => api.getLogs(sessionId!, which), | |
| enabled: !!sessionId, | |
| }); | |
| } | |