diff --git a/api/edge-speech.ts b/api/edge-speech.ts index 9bee67d..e3e558b 100644 --- a/api/edge-speech.ts +++ b/api/edge-speech.ts @@ -1,5 +1,4 @@ -import { createEdgeSpeechComletion } from '../src/server/createEdgeSpeechComletion'; -import { EdgeSpeechPayload } from '../src/server/types'; +import { EdgeSpeechPayload, createEdgeSpeechComletion } from '@lobehub/tts'; export const config = { runtime: 'edge', diff --git a/api/microsoft-speech.ts b/api/microsoft-speech.ts index 48e2408..7ecd596 100644 --- a/api/microsoft-speech.ts +++ b/api/microsoft-speech.ts @@ -1,5 +1,4 @@ -import { createMicrosoftSpeechComletion } from '../src/server/createMicrosoftSpeechComletion'; -import { MicrosoftSpeechPayload } from '../src/server/types'; +import { MicrosoftSpeechPayload, createMicrosoftSpeechComletion } from '@lobehub/tts'; export const config = { runtime: 'edge', diff --git a/api/open-stt.ts b/api/open-stt.ts index 9576821..abfd891 100644 --- a/api/open-stt.ts +++ b/api/open-stt.ts @@ -1,8 +1,6 @@ +import { OpenAISTTPayload, createOpenaiAudioTranscriptionsCompletion } from '@lobehub/tts'; import OpenAI from 'openai'; -import { createOpenaiAudioTranscriptionsCompletion } from '../src/server/createOpenaiAudioTranscriptionsCompletion'; -import { OpenAISTTPayload } from '../src/server/types'; - export const config = { runtime: 'edge', }; diff --git a/api/openai-tts.ts b/api/openai-tts.ts index 2338729..fa95fa0 100644 --- a/api/openai-tts.ts +++ b/api/openai-tts.ts @@ -1,8 +1,6 @@ +import { OpenAITTSPayload, createOpenaiAudioSpeechCompletion } from '@lobehub/tts'; import OpenAI from 'openai'; -import { createOpenaiAudioSpeechCompletion } from '../src/server/createOpenaiAudioSpeechCompletion'; -import { OpenAITTSPayload } from '../src/server/types'; - export const config = { runtime: 'edge', }; diff --git a/src/server/createEdgeSpeechComletion.ts b/src/server/createEdgeSpeechComletion.ts index c0a478c..ae6dffe 100644 --- a/src/server/createEdgeSpeechComletion.ts +++ b/src/server/createEdgeSpeechComletion.ts @@ -1,11 +1,11 @@ import qs from 'query-string'; import { v4 as uuidv4 } from 'uuid'; -import { EDGE_API_TOKEN, EDGE_SPEECH_URL } from '../const/api'; -import { EdgeSpeechPayload } from '../server/types'; -import { genSSML } from '../utils/genSSML'; -import { genSendContent } from '../utils/genSendContent'; -import { getHeadersAndData } from '../utils/getHeadersAndData'; +import { EDGE_API_TOKEN, EDGE_SPEECH_URL } from '@/const/api'; +import { EdgeSpeechPayload } from '@/server/types'; +import { genSSML } from '@/utils/genSSML'; +import { genSendContent } from '@/utils/genSendContent'; +import { getHeadersAndData } from '@/utils/getHeadersAndData'; const configConent = JSON.stringify({ context: { diff --git a/src/server/createMicrosoftSpeechComletion.ts b/src/server/createMicrosoftSpeechComletion.ts index 9b2f854..dc8bb8c 100644 --- a/src/server/createMicrosoftSpeechComletion.ts +++ b/src/server/createMicrosoftSpeechComletion.ts @@ -1,8 +1,8 @@ import { v4 as uuidv4 } from 'uuid'; -import { MICROSOFT_SPEECH_URL } from '../const/api'; -import { MicrosoftSpeechPayload } from '../server/types'; -import { genSSML } from '../utils/genSSML'; +import { MICROSOFT_SPEECH_URL } from '@/const/api'; +import { MicrosoftSpeechPayload } from '@/server/types'; +import { genSSML } from '@/utils/genSSML'; interface CreateMicrosoftSpeechComletionOptions { payload: MicrosoftSpeechPayload; @@ -41,6 +41,8 @@ export const createMicrosoftSpeechComletion = async ({ const res = await fetch(MICROSOFT_SPEECH_URL, { body, + // @ts-ignore + duplex: 'half', headers: DEFAULT_HEADERS, method: 'POST', // @ts-ignore