Anna Sun
commited on
Commit
·
57f3b67
1
Parent(s):
42d9c16
Clean up interface for HF, add instructions
Browse files
streaming-react-app/package-lock.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
streaming-react-app/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
"type": "module",
|
| 6 |
"scripts": {
|
| 7 |
"dev": "vite --host --strictPort",
|
| 8 |
-
"build": "vite build",
|
| 9 |
"preview": "vite preview",
|
| 10 |
"clean:node-modules": "rm -rf node_modules/",
|
| 11 |
"ts-check": "tsc --noEmit",
|
|
|
|
| 5 |
"type": "module",
|
| 6 |
"scripts": {
|
| 7 |
"dev": "vite --host --strictPort",
|
| 8 |
+
"build": "tsc && vite build",
|
| 9 |
"preview": "vite preview",
|
| 10 |
"clean:node-modules": "rm -rf node_modules/",
|
| 11 |
"ts-check": "tsc --noEmit",
|
streaming-react-app/src/SocketWrapper.tsx
CHANGED
|
@@ -18,8 +18,7 @@ export default function SocketWrapper({children}) {
|
|
| 18 |
const [socket, setSocket] = useState<Socket | null>(null);
|
| 19 |
const [connected, setConnected] = useState<boolean | null>(null);
|
| 20 |
// Default to true:
|
| 21 |
-
const [willAttemptReconnect
|
| 22 |
-
useState<boolean>(true);
|
| 23 |
const serverIDRef = useRef<string | null>(null);
|
| 24 |
|
| 25 |
const setAppResetKey = useContext(AppResetKeyContext);
|
|
|
|
| 18 |
const [socket, setSocket] = useState<Socket | null>(null);
|
| 19 |
const [connected, setConnected] = useState<boolean | null>(null);
|
| 20 |
// Default to true:
|
| 21 |
+
const [willAttemptReconnect] = useState<boolean>(true);
|
|
|
|
| 22 |
const serverIDRef = useRef<string | null>(null);
|
| 23 |
|
| 24 |
const setAppResetKey = useContext(AppResetKeyContext);
|
streaming-react-app/src/StreamingInterface.tsx
CHANGED
|
@@ -58,7 +58,6 @@ import {CURSOR_BLINK_INTERVAL_MS} from './cursorBlinkInterval';
|
|
| 58 |
import {getURLParams} from './URLParams';
|
| 59 |
import debug from './debug';
|
| 60 |
import DebugSection from './DebugSection';
|
| 61 |
-
import Switch from '@mui/material/Switch';
|
| 62 |
import {Grid} from '@mui/material';
|
| 63 |
|
| 64 |
const AUDIO_STREAM_DEFAULTS: {
|
|
@@ -148,7 +147,6 @@ export default function StreamingInterface() {
|
|
| 148 |
const [serverExceptions, setServerExceptions] = useState<
|
| 149 |
Array<ServerExceptionData>
|
| 150 |
>([]);
|
| 151 |
-
const [connectionError, setConnectionError] = useState<string | null>(null);
|
| 152 |
const [roomState, setRoomState] = useState<RoomState | null>(null);
|
| 153 |
const roomID = roomState?.room_id ?? null;
|
| 154 |
const isSpeaker =
|
|
@@ -173,9 +171,6 @@ export default function StreamingInterface() {
|
|
| 173 |
|
| 174 |
// Dynamic Params:
|
| 175 |
const [targetLang, setTargetLang] = useState<string | null>(null);
|
| 176 |
-
const [enableExpressive, setEnableExpressive] = useState<boolean | null>(
|
| 177 |
-
null,
|
| 178 |
-
);
|
| 179 |
|
| 180 |
const [serverDebugFlag, setServerDebugFlag] = useState<boolean>(
|
| 181 |
debugParam ?? false,
|
|
@@ -257,7 +252,6 @@ export default function StreamingInterface() {
|
|
| 257 |
setAgent((prevAgent) => {
|
| 258 |
if (prevAgent?.name !== newAgent?.name) {
|
| 259 |
setTargetLang(newAgent?.targetLangs[0] ?? null);
|
| 260 |
-
setEnableExpressive(null);
|
| 261 |
}
|
| 262 |
return newAgent;
|
| 263 |
});
|
|
@@ -433,7 +427,6 @@ export default function StreamingInterface() {
|
|
| 433 |
// available before actually configuring and starting the stream
|
| 434 |
const fullDynamicConfig: DynamicConfig = {
|
| 435 |
targetLanguage: targetLang,
|
| 436 |
-
expressive: enableExpressive,
|
| 437 |
};
|
| 438 |
|
| 439 |
await onSetDynamicConfig(fullDynamicConfig);
|
|
@@ -759,6 +752,11 @@ export default function StreamingInterface() {
|
|
| 759 |
Seamless Translation
|
| 760 |
</Typography>
|
| 761 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 762 |
</div>
|
| 763 |
|
| 764 |
<Stack spacing="22px" direction="column">
|
|
@@ -832,11 +830,6 @@ export default function StreamingInterface() {
|
|
| 832 |
</Select>
|
| 833 |
</FormControl>
|
| 834 |
|
| 835 |
-
<Typography variant="body2">
|
| 836 |
-
{`Supported Source Languages: ${
|
| 837 |
-
currentAgent?.sourceLangs.join(', ') ?? 'None'
|
| 838 |
-
}`}
|
| 839 |
-
</Typography>
|
| 840 |
</Stack>
|
| 841 |
|
| 842 |
<Stack spacing={0.5}>
|
|
@@ -902,28 +895,6 @@ export default function StreamingInterface() {
|
|
| 902 |
spacing={1}
|
| 903 |
alignItems="flex-start"
|
| 904 |
sx={{flexGrow: 1}}>
|
| 905 |
-
{currentAgent?.dynamicParams?.includes(
|
| 906 |
-
'expressive',
|
| 907 |
-
) && (
|
| 908 |
-
<FormControlLabel
|
| 909 |
-
control={
|
| 910 |
-
<Switch
|
| 911 |
-
checked={enableExpressive ?? false}
|
| 912 |
-
onChange={(
|
| 913 |
-
event: React.ChangeEvent<HTMLInputElement>,
|
| 914 |
-
) => {
|
| 915 |
-
const newValue = event.target.checked;
|
| 916 |
-
setEnableExpressive(newValue);
|
| 917 |
-
onSetDynamicConfig({
|
| 918 |
-
expressive: newValue,
|
| 919 |
-
});
|
| 920 |
-
}}
|
| 921 |
-
/>
|
| 922 |
-
}
|
| 923 |
-
label="Expressive"
|
| 924 |
-
/>
|
| 925 |
-
)}
|
| 926 |
-
|
| 927 |
{isListener && (
|
| 928 |
<Box
|
| 929 |
sx={{
|
|
@@ -940,6 +911,13 @@ export default function StreamingInterface() {
|
|
| 940 |
</Grid>
|
| 941 |
</Stack>
|
| 942 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 943 |
<Stack
|
| 944 |
direction="row"
|
| 945 |
spacing={2}
|
|
|
|
| 58 |
import {getURLParams} from './URLParams';
|
| 59 |
import debug from './debug';
|
| 60 |
import DebugSection from './DebugSection';
|
|
|
|
| 61 |
import {Grid} from '@mui/material';
|
| 62 |
|
| 63 |
const AUDIO_STREAM_DEFAULTS: {
|
|
|
|
| 147 |
const [serverExceptions, setServerExceptions] = useState<
|
| 148 |
Array<ServerExceptionData>
|
| 149 |
>([]);
|
|
|
|
| 150 |
const [roomState, setRoomState] = useState<RoomState | null>(null);
|
| 151 |
const roomID = roomState?.room_id ?? null;
|
| 152 |
const isSpeaker =
|
|
|
|
| 171 |
|
| 172 |
// Dynamic Params:
|
| 173 |
const [targetLang, setTargetLang] = useState<string | null>(null);
|
|
|
|
|
|
|
|
|
|
| 174 |
|
| 175 |
const [serverDebugFlag, setServerDebugFlag] = useState<boolean>(
|
| 176 |
debugParam ?? false,
|
|
|
|
| 252 |
setAgent((prevAgent) => {
|
| 253 |
if (prevAgent?.name !== newAgent?.name) {
|
| 254 |
setTargetLang(newAgent?.targetLangs[0] ?? null);
|
|
|
|
| 255 |
}
|
| 256 |
return newAgent;
|
| 257 |
});
|
|
|
|
| 427 |
// available before actually configuring and starting the stream
|
| 428 |
const fullDynamicConfig: DynamicConfig = {
|
| 429 |
targetLanguage: targetLang,
|
|
|
|
| 430 |
};
|
| 431 |
|
| 432 |
await onSetDynamicConfig(fullDynamicConfig);
|
|
|
|
| 752 |
Seamless Translation
|
| 753 |
</Typography>
|
| 754 |
</div>
|
| 755 |
+
<div>
|
| 756 |
+
<Typography variant="body2" sx={{color: '#65676B'}}>
|
| 757 |
+
Welcome! Join a room as speaker or listener (or both), and share the room code to invite listeners.
|
| 758 |
+
</Typography>
|
| 759 |
+
</div>
|
| 760 |
</div>
|
| 761 |
|
| 762 |
<Stack spacing="22px" direction="column">
|
|
|
|
| 830 |
</Select>
|
| 831 |
</FormControl>
|
| 832 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 833 |
</Stack>
|
| 834 |
|
| 835 |
<Stack spacing={0.5}>
|
|
|
|
| 895 |
spacing={1}
|
| 896 |
alignItems="flex-start"
|
| 897 |
sx={{flexGrow: 1}}>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 898 |
{isListener && (
|
| 899 |
<Box
|
| 900 |
sx={{
|
|
|
|
| 911 |
</Grid>
|
| 912 |
</Stack>
|
| 913 |
|
| 914 |
+
<Typography variant="body2">
|
| 915 |
+
Note: we don't recommend echo cancellation, as it may distort
|
| 916 |
+
the input audio (dropping words/sentences) if there is output
|
| 917 |
+
audio playing. Instead, you should use headphones if you'd like
|
| 918 |
+
to listen to the output audio while speaking.
|
| 919 |
+
</Typography>
|
| 920 |
+
|
| 921 |
<Stack
|
| 922 |
direction="row"
|
| 923 |
spacing={2}
|
streaming-react-app/src/types/StreamingTypes.ts
CHANGED
|
@@ -125,8 +125,6 @@ export type DynamicConfig = {
|
|
| 125 |
// targetLanguage: a 3-letter string representing the desired output language.
|
| 126 |
// Supported languages are provided by the agent capabilities config
|
| 127 |
targetLanguage: string;
|
| 128 |
-
|
| 129 |
-
expressive: boolean | null;
|
| 130 |
};
|
| 131 |
|
| 132 |
export type PartialDynamicConfig = Partial<DynamicConfig>;
|
|
|
|
| 125 |
// targetLanguage: a 3-letter string representing the desired output language.
|
| 126 |
// Supported languages are provided by the agent capabilities config
|
| 127 |
targetLanguage: string;
|
|
|
|
|
|
|
| 128 |
};
|
| 129 |
|
| 130 |
export type PartialDynamicConfig = Partial<DynamicConfig>;
|