Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dabolus committed Jun 3, 2019
2 parents a38895c + b26dca8 commit e646113
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 12 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@babel/runtime-corejs3": "^7.4.5",
"core-js": "^3.1.3",
"electron-store": "^3.2.0",
"electron-updater": "^4.0.6",
"google-auth-library": "^4.1.0",
"nodejs-assistant": "^0.7.1",
"typedi": "^0.8.0"
Expand Down
2 changes: 2 additions & 0 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Environment, EnvironmentService } from '@services/environment.service';
import { app, Menu, shell, systemPreferences } from 'electron';
import { resolve } from 'path';
import { format as formatUrl } from 'url';
import { autoUpdater } from 'electron-updater';

const environmentService: Environment = container.get(EnvironmentService);

Expand Down Expand Up @@ -166,6 +167,7 @@ app.on('activate', () => {
// create main BrowserWindowWithEvents when electron is ready
app.on('ready', () => {
mainWindow = createMainWindow();
autoUpdater.checkForUpdatesAndNotify();
});

if (environmentService.development) {
Expand Down
6 changes: 2 additions & 4 deletions src/renderer/components/bottom-bar/bottom-bar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,8 @@ export class BottomBar extends connect(store)(LitElement) {
mimeType: 'audio/webm;codecs=opus',
bitsPerSecond: 128000,
});
recorder.addEventListener('dataavailable', async ({ data }) => {
const arrayBuffer = await new Response(data).arrayBuffer();
const buffer = Buffer.from(arrayBuffer);
store.dispatch(requestAudioSend(buffer));
recorder.addEventListener('dataavailable', ({ data }) => {
store.dispatch(requestAudioSend(data));
});
recorder.start(500);
// TODO: stop recording when Assistant tells the user has stopped speaking
Expand Down
9 changes: 7 additions & 2 deletions src/renderer/services/chat.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { AssistantQueryOptions } from 'nodejs-assistant';

export interface Chat {
sendMessage(text: string, options?: AssistantQueryOptions): void;
sendAudio(audio: Buffer, options?: AssistantQueryOptions): void;
sendAudio(data: Blob, options?: AssistantQueryOptions): Promise<void>;
}

@injectable()
Expand All @@ -16,7 +16,12 @@ export class ChatService implements Chat {
});
}

public sendAudio(audio: Buffer, options?: AssistantQueryOptions): void {
public async sendAudio(
data: Blob,
options?: AssistantQueryOptions,
): Promise<void> {
const arrayBuffer = await new Response(data).arrayBuffer();
const audio = Buffer.from(arrayBuffer);
ipcRenderer.send('chat.requestSendAudio', {
audio,
options,
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/store/chat/chat.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export type ChatActionSendMessageRejected = FluxStandardAction<
export type ChatActionSendAudioRequested = FluxStandardAction<
ChatActionType.SEND_AUDIO_REQUESTED,
{
audio: Buffer;
audio: Blob;
conversationState?: Buffer;
}
>;
Expand Down Expand Up @@ -115,7 +115,7 @@ export const rejectMessageSend = (
});

export const requestAudioSend = (
audio: Buffer,
audio: Blob,
conversationState?: Buffer,
): ChatActionSendAudioRequested => ({
type: ChatActionType.SEND_AUDIO_REQUESTED,
Expand Down
38 changes: 34 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2328,6 +2328,16 @@ builder-util-runtime@^8.2.2, builder-util-runtime@^8.2.3:
fs-extra-p "^8.0.0"
sax "^1.2.4"

builder-util-runtime@~8.1.0:
version "8.1.1"
resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-8.1.1.tgz#f2f6fc43e33d26892bd491667fc746ad69bccc50"
integrity sha512-+ieS4PMB33vVE2S3ZNWBEQJ1zKmAs/agrBdh7XadE1lKLjrH4aXYuOh9OOGdxqIRldhlhNBaF+yKMMEFOdNVig==
dependencies:
bluebird-lst "^1.0.6"
debug "^4.1.1"
fs-extra-p "^7.0.0"
sax "^1.2.4"

[email protected]:
version "10.0.0"
resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-10.0.0.tgz#b80e347cbd21947fd50f7a0225149eeffc7307c0"
Expand Down Expand Up @@ -3743,6 +3753,21 @@ electron-to-chromium@^1.3.137:
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.142.tgz#d3db509ac0f0f5a212af234ff3b500d8cc4ea812"
integrity sha512-GLOB/wAA2g9l5Hwg1XrPqd6br2WNOPIY8xl/q+g5zZdv3b5fB69oFOooxKxc0DfDfDS1RqaF6hKjwt6v4fuFUw==

electron-updater@^4.0.6:
version "4.0.6"
resolved "https://registry.yarnpkg.com/electron-updater/-/electron-updater-4.0.6.tgz#9c4f495ae0e80bf4425e3e1b801c5ed2ab933c2d"
integrity sha512-JPGLME6fxJcHG8hX7HWFl6Aew6iVm0DkcrENreKa5SUJCHG+uUaAhxDGDt+YGcNkyx1uJ6eBGMvFxDTLUv67pg==
dependencies:
bluebird-lst "^1.0.6"
builder-util-runtime "~8.1.0"
fs-extra-p "^7.0.0"
js-yaml "^3.12.0"
lazy-val "^1.0.3"
lodash.isequal "^4.5.0"
pako "^1.0.7"
semver "^5.6.0"
source-map-support "^0.5.9"

electron-watch@^1.0.9:
version "1.0.9"
resolved "https://registry.yarnpkg.com/electron-watch/-/electron-watch-1.0.9.tgz#5d2d2461c0f9750081f79d2ae0e44713a267d06a"
Expand Down Expand Up @@ -6259,7 +6284,7 @@ js-levenshtein@^1.1.3:
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==

js-yaml@^3.12.1, js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.9.0:
js-yaml@^3.12.0, js-yaml@^3.12.1, js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.9.0:
version "3.13.1"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847"
integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==
Expand Down Expand Up @@ -6458,7 +6483,7 @@ latest-version@^3.0.0:
dependencies:
package-json "^4.0.0"

lazy-val@^1.0.4:
lazy-val@^1.0.3, lazy-val@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/lazy-val/-/lazy-val-1.0.4.tgz#882636a7245c2cfe6e0a4e3ba6c5d68a137e5c65"
integrity sha512-u93kb2fPbIrfzBuLjZE+w+fJbUUMhNDXxNmMfaqNgpfQf1CO5ZSe2LfsnBqVAk7i/2NF48OSoRj+Xe2VT+lE8Q==
Expand Down Expand Up @@ -6573,6 +6598,11 @@ lodash.clone@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.clone/-/lodash.clone-4.5.0.tgz#195870450f5a13192478df4bc3d23d2dea1907b6"
integrity sha1-GVhwRQ9aExkkeN9Lw9I9LeoZB7Y=

lodash.isequal@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"
integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA=

lodash.memoize@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
Expand Down Expand Up @@ -7666,7 +7696,7 @@ package-json@^4.0.0:
registry-url "^3.0.3"
semver "^5.1.0"

pako@~1.0.5:
pako@^1.0.7, pako@~1.0.5:
version "1.0.10"
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.10.tgz#4328badb5086a426aa90f541977d4955da5c9732"
integrity sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==
Expand Down Expand Up @@ -9632,7 +9662,7 @@ source-map-support@^0.4.15:
dependencies:
source-map "^0.5.6"

source-map-support@^0.5.12, source-map-support@^0.5.6, source-map-support@~0.5.10:
source-map-support@^0.5.12, source-map-support@^0.5.6, source-map-support@^0.5.9, source-map-support@~0.5.10:
version "0.5.12"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.12.tgz#b4f3b10d51857a5af0138d3ce8003b201613d599"
integrity sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==
Expand Down

0 comments on commit e646113

Please sign in to comment.