add audio playback

This commit is contained in:
Enrique Hernandez 2021-02-23 14:33:58 -06:00 committed by riqo
commit d06fb395b9
9 changed files with 342 additions and 58 deletions

View file

@ -5,7 +5,10 @@ import { backgroundMitt } from './emitter';
import { ipcMain } from "electron";
interface RenderMessage {
content: string;
content: {
text: string;
audio: boolean | Buffer;
};
avatar: string;
context: string;
subContext: string;
@ -24,7 +27,7 @@ interface TextMessage {
content: string;
}
const ip = 'ws://127.0.0.1';
const ip = 'ws://127.0. 0.1';
const port = 8760;
const reconnectTimeout = 3000; //ms
let socket: WebSocket;
@ -67,6 +70,9 @@ const receiveMessage = (message: string): void => {
}
const parsed: RenderMessage = JSON.parse(message);
console.log('message received', parsed);
if (parsed.content.audio) {
}
backgroundMitt.emit('ipc-renderer', {
endpoint: 'render-message',
message: parsed