HyperCluster/Fara-BrowserUse
5
1import { useCallback } from 'react';
2
3export const useSendTask = () => {
4 const sendTask = useCallback((instruction: string, modelId: string) => {
5 const sendNewTask = (window as Window & { __sendNewTask?: (instruction: string, modelId: string) => void }).__sendNewTask;
6 if (sendNewTask) {
7 sendNewTask(instruction, modelId);
8 } else {
9 console.error('WebSocket not initialized');
10 }
11 }, []);
12
13 return sendTask;
14};
15 