MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / useQueueControls

Function useQueueControls

cli/src/hooks/use-queue-controls.ts:32–68  ·  view source on GitHub ↗
({
  queuePaused,
  queuedCount,
  clearQueue,
  resumeQueue,
  inputHasText,
  baseHandleCtrlC,
}: UseQueueControlsParams)

Source from the content-addressed store, hash-verified

30}
31
32export const useQueueControls = ({
33 queuePaused,
34 queuedCount,
35 clearQueue,
36 resumeQueue,
37 inputHasText,
38 baseHandleCtrlC,
39}: UseQueueControlsParams) => {
40 const handleCtrlC = useCallback(
41 createQueueCtrlCHandler({
42 queuePaused,
43 queuedCount,
44 clearQueue,
45 resumeQueue,
46 inputHasText,
47 baseHandleCtrlC,
48 }),
49 [
50 baseHandleCtrlC,
51 clearQueue,
52 inputHasText,
53 queuePaused,
54 queuedCount,
55 resumeQueue,
56 ],
57 )
58
59 const ensureQueueActiveBeforeSubmit = useCallback(() => {
60 if (queuePaused) {
61 resumeQueue()
62 return true
63 }
64 return false
65 }, [queuePaused, resumeQueue])
66
67 return { handleCtrlC, ensureQueueActiveBeforeSubmit }
68}

Callers 1

useChatStreamingFunction · 0.90

Calls 1

createQueueCtrlCHandlerFunction · 0.85

Tested by

no test coverage detected