@lobehub/chat
Version:
Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.
39 lines (31 loc) • 874 B
text/typescript
import { OpenAITTSPayload } from '@lobehub/tts';
import { createOpenaiAudioSpeech } from '@lobehub/tts/server';
import { createBizOpenAI } from '@/app/(backend)/_deprecated/createBizOpenAI';
export const runtime = 'edge';
export const preferredRegion = [
'arn1',
'bom1',
'cdg1',
'cle1',
'cpt1',
'dub1',
'fra1',
'gru1',
'hnd1',
'iad1',
'icn1',
'kix1',
'lhr1',
'pdx1',
'sfo1',
'sin1',
'syd1',
];
export const POST = async (req: Request) => {
const payload = (await req.json()) as OpenAITTSPayload;
// need to be refactored with jwt auth mode
const openaiOrErrResponse = createBizOpenAI(req);
// if resOrOpenAI is a Response, it means there is an error,just return it
if (openaiOrErrResponse instanceof Response) return openaiOrErrResponse;
return await createOpenaiAudioSpeech({ openai: openaiOrErrResponse, payload });
};