mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-04 01:28:51 +01:00
✨ WIP: Implement Realtime Ephemeral Token functionality and update related components
This commit is contained in:
parent
40c8b8fd75
commit
ea5cb4bc2b
13 changed files with 1113 additions and 14 deletions
|
|
@ -171,7 +171,9 @@ export const textToSpeechManual = () => `${textToSpeech()}/manual`;
|
|||
|
||||
export const textToSpeechVoices = () => `${textToSpeech()}/voices`;
|
||||
|
||||
export const getCustomConfigSpeech = () => `${speech()}/config/get`;
|
||||
export const getCustomConfigSpeech = () => `${speech()}/config`;
|
||||
|
||||
export const getRealtimeEphemeralToken = () => `${speech()}/realtime`;
|
||||
|
||||
export const getPromptGroup = (_id: string) => `${prompts()}/groups/${_id}`;
|
||||
|
||||
|
|
|
|||
|
|
@ -408,6 +408,18 @@ const speechTab = z
|
|||
})
|
||||
.optional();
|
||||
|
||||
const realtime = z
|
||||
.object({
|
||||
openai: z
|
||||
.object({
|
||||
url: z.string().optional(),
|
||||
apiKey: z.string().optional(),
|
||||
voices: z.array(z.string()).optional(),
|
||||
})
|
||||
.optional(),
|
||||
})
|
||||
.optional();
|
||||
|
||||
export enum RateLimitPrefix {
|
||||
FILE_UPLOAD = 'FILE_UPLOAD',
|
||||
IMPORT = 'IMPORT',
|
||||
|
|
@ -595,6 +607,7 @@ export const configSchema = z.object({
|
|||
tts: ttsSchema.optional(),
|
||||
stt: sttSchema.optional(),
|
||||
speechTab: speechTab.optional(),
|
||||
realtime: realtime.optional(),
|
||||
})
|
||||
.optional(),
|
||||
rateLimits: rateLimitSchema.optional(),
|
||||
|
|
@ -1216,6 +1229,13 @@ export enum TTSProviders {
|
|||
LOCALAI = 'localai',
|
||||
}
|
||||
|
||||
export enum RealtimeVoiceProviders {
|
||||
/**
|
||||
* Provider for OpenAI Realtime Voice API
|
||||
*/
|
||||
OPENAI = 'openai',
|
||||
}
|
||||
|
||||
/** Enum for app-wide constants */
|
||||
export enum Constants {
|
||||
/** Key for the app's version. */
|
||||
|
|
|
|||
|
|
@ -576,6 +576,12 @@ export const getCustomConfigSpeech = (): Promise<t.TCustomConfigSpeechResponse>
|
|||
return request.get(endpoints.getCustomConfigSpeech());
|
||||
};
|
||||
|
||||
export const getRealtimeEphemeralToken = (
|
||||
data: t.TRealtimeEphemeralTokenRequest,
|
||||
): Promise<t.TRealtimeEphemeralTokenResponse> => {
|
||||
return request.get(endpoints.getRealtimeEphemeralToken(), { params: data });
|
||||
};
|
||||
|
||||
/* conversations */
|
||||
|
||||
export function duplicateConversation(
|
||||
|
|
|
|||
|
|
@ -69,4 +69,5 @@ export enum MutationKeys {
|
|||
updateRole = 'updateRole',
|
||||
enableTwoFactor = 'enableTwoFactor',
|
||||
verifyTwoFactor = 'verifyTwoFactor',
|
||||
realtimeEphemeralToken = 'realtimeEphemeralToken',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import type {
|
|||
TConversationTag,
|
||||
TBanner,
|
||||
} from './schemas';
|
||||
export type TOpenAIMessage = OpenAI.Chat.ChatCompletionMessageParam;
|
||||
import { string } from 'zod';
|
||||
|
||||
export * from './schemas';
|
||||
|
||||
|
|
@ -532,3 +532,12 @@ export type TAcceptTermsResponse = {
|
|||
};
|
||||
|
||||
export type TBannerResponse = TBanner | null;
|
||||
|
||||
export type TRealtimeEphemeralTokenRequest = {
|
||||
voice: string;
|
||||
};
|
||||
|
||||
export type TRealtimeEphemeralTokenResponse = {
|
||||
token: string;
|
||||
url: string;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue