Spaces:
Runtime error
Runtime error
File size: 3,268 Bytes
2485dd8 6bfe941 2485dd8 6bfe941 2485dd8 1143e8d 2485dd8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
interface ServerTranslationDataBase {
eos: boolean;
event: string;
latency?: number;
}
export interface ServerTextData extends ServerTranslationDataBase {
event: 'translation_text';
payload: string;
}
export interface ServerSpeechData extends ServerTranslationDataBase {
event: 'translation_speech';
payload: Array<number>;
sample_rate: number;
}
export const OUTPUT_MODALITIES_BASE_VALUES = ['s2t', 's2s'] as const;
export type OutputModalitiesBase =
(typeof OUTPUT_MODALITIES_BASE_VALUES)[number];
export const DYNAMIC_PARAMS_VALUES = ['expressive'] as const;
export type DynamicParams = (typeof DYNAMIC_PARAMS_VALUES)[number];
export type AgentCapabilities = {
name: string;
description: string;
modalities: Array<OutputModalitiesBase>;
targetLangs: Array<string>;
dynamicParams: Array<DynamicParams>;
};
export const SUPPORTED_OUTPUT_MODE_VALUES = ['s2s&t', 's2t', 's2s'] as const;
export type SupportedOutputMode = (typeof SUPPORTED_OUTPUT_MODE_VALUES)[number];
export const SUPPORTED_OUTPUT_MODES: Array<{
value: (typeof SUPPORTED_OUTPUT_MODE_VALUES)[number];
label: string;
}> = [
{ value: 's2s&t', label: 'Text & Speech' },
{ value: 's2t', label: 'Text' },
{ value: 's2s', label: 'Speech' },
];
export const SUPPORTED_INPUT_SOURCE_VALUES = [
'userMedia',
'displayMedia',
] as const;
export type SupportedInputSource =
(typeof SUPPORTED_INPUT_SOURCE_VALUES)[number];
export const SUPPORTED_INPUT_SOURCES: Array<{
value: SupportedInputSource;
label: string;
}> = [
{value: 'userMedia', label: 'Microphone'},
{value: 'displayMedia', label: 'Browser Tab (Chrome only)'},
];
export type StartStreamEventConfig = {
event: 'config';
rate: number;
model_name: string;
debug: boolean;
async_processing: boolean;
model_type: SupportedOutputMode;
buffer_limit: number;
};
export interface BrowserAudioStreamConfig {
echoCancellation: boolean;
noiseSuppression: boolean;
echoCancellation: boolean;
}
export interface ServerStateItem {
activeConnections: number;
activeTranscoders: number;
}
export type ServerLockObject = {
name: string | null;
clientID: string | null;
isActive: boolean;
};
export type ServerState = ServerStateItem & {
agentsCapabilities: Array<AgentCapabilities>;
statusByRoom: {
[key: string]: { activeConnections: number; activeTranscoders: number };
};
totalActiveConnections: number;
totalActiveTranscoders: number;
serverLock: ServerLockObject | null;
};
export type ServerExceptionData = {
message: string;
timeEpochMs: number;
// NOTE: This is added on the client
timeStringClient?: string;
room?: string;
member?: string;
clientID?: string;
};
export type StreamingStatus = 'stopped' | 'running' | 'starting';
export type TranslationSentences = Array<string>;
export type DynamicConfig = {
// targetLanguage: a 3-letter string representing the desired output language.
targetLanguage: string;
expressive: boolean | null;
};
export type PartialDynamicConfig = Partial<DynamicConfig>;
export type BaseResponse = {
status: 'ok' | 'error';
message: string;
};
export type Roles = 'speaker' | 'listener';
export type JoinRoomConfig = {
roles: Array<Roles>;
lockServerName: string | null;
};
|