Download src/hooks/useSendTask.ts from HyperCluster/Fara-BrowserUse: direct link, hf CLI and curl.
- Browser
- Download file 455 Bytes
-
https://huggingface.co/spaces/HyperCluster/Fara-BrowserUse/resolve/main/src/hooks/useSendTask.ts
- Command line
-
hf download hf://spaces/HyperCluster/Fara-BrowserUse/src/hooks/useSendTask.ts
-
curl -L -o useSendTask.ts https://huggingface.co/spaces/HyperCluster/Fara-BrowserUse/resolve/main/src/hooks/useSendTask.ts
455 Bytes
| import { useCallback } from 'react'; | |
| export const useSendTask = () => { | |
| const sendTask = useCallback((instruction: string, modelId: string) => { | |
| const sendNewTask = (window as Window & { __sendNewTask?: (instruction: string, modelId: string) => void }).__sendNewTask; | |
| if (sendNewTask) { | |
| sendNewTask(instruction, modelId); | |
| } else { | |
| console.error('WebSocket not initialized'); | |
| } | |
| }, []); | |
| return sendTask; | |
| }; | |