UNPKG

@cloudraker/use-whisper

Version:

React Hook for OpenAI Whisper API with speech recorder and silence removal built-in.

8 lines (4 loc) 370 B
'use strict'; var react = require('react'); var u=(i,e,n,o)=>{let r=react.useMemo(()=>{let t=[];return Array.isArray(e)&&(t=[...t,...e]),Array.isArray(n)&&(t=[...t,...n]),Array.isArray(o)&&(t=[...t,...o]),t},[o,e,n]);return react.useEffect(()=>((async()=>{try{await i();}catch(t){typeof n=="function"&&n(t);}})(),()=>{typeof e=="function"&&e();}),r)}; exports.a = u;