@lobehub/tts
Version:
A high-quality & reliable TTS React Hooks library
17 lines (15 loc) • 499 B
JavaScript
import { OpenaiSTT } from "../../core/OpenAISTT/index.mjs";
import useSWR from "swr";
//#region src/react/useOpenAISTT/useOpenAISTTCore.ts
const useOpenAISTTCore = (init) => {
const key = (/* @__PURE__ */ new Date()).getDate().toString();
const { shouldFetch, api, options, speech, ...swrConfig } = init;
return useSWR(shouldFetch && speech ? key : null, async () => {
return new OpenaiSTT(api).create({
options,
speech
});
}, swrConfig);
};
//#endregion
export { useOpenAISTTCore };