Skip to content

Commit 4fa9c33

Browse files
authored
Merge pull request #413 from nextcloud/enh/noid/audio-adjustments
Fix audio recording and deal with audio watermarking in sub tasks
2 parents 28fbd6e + eb0e15d commit 4fa9c33

File tree

11 files changed

+40
-165
lines changed

11 files changed

+40
-165
lines changed

.github/workflows/appstore-build-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
types: [published]
1414

1515
env:
16-
PHP_VERSION: 8.1
16+
PHP_VERSION: 8.2
1717

1818
jobs:
1919
build_and_publish:

appinfo/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Known providers:
6262
6363
More details on how to set this up in the [admin docs](https://docs.nextcloud.com/server/latest/admin_manual/ai/index.html)
6464
]]> </description>
65-
<version>2.10.0</version>
65+
<version>2.11.0-dev</version>
6666
<licence>agpl</licence>
6767
<author>Julien Veyssier</author>
6868
<namespace>Assistant</namespace>

composer.lock

Lines changed: 25 additions & 109 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Listener/CSPListener.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public function handle(Event $event): void {
3030

3131
$csp = new ContentSecurityPolicy();
3232
$csp->addAllowedWorkerSrcDomain('blob:');
33+
$csp->addAllowedConnectDomain('blob:');
3334
$event->addPolicy($csp);
3435
}
3536
}

lib/TaskProcessing/AudioToAudioChatProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ public function process(?string $userId, array $input, callable $reportProgress)
143143
Application::APP_ID . ':internal',
144144
$userId,
145145
);
146+
// the setIncludeWatermark method was introduced in NC 33
147+
if (method_exists($task, 'setIncludeWatermark')) {
148+
$task->setIncludeWatermark(false);
149+
}
146150
$taskOutput = $this->taskProcessingService->runTaskProcessingTask($task);
147151
$outputAudioFileId = $taskOutput['speech'];
148152

lib/TaskProcessing/ContextAgentAudioInteractionProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ public function process(?string $userId, array $input, callable $reportProgress)
143143
Application::APP_ID . ':internal',
144144
$userId,
145145
);
146+
// the setIncludeWatermark method was introduced in NC 33
147+
if (method_exists($task, 'setIncludeWatermark')) {
148+
$task->setIncludeWatermark(false);
149+
}
146150
$ttsTaskOutput = $this->taskProcessingService->runTaskProcessingTask($task);
147151
$outputAudioFileId = $ttsTaskOutput['speech'];
148152
$outputAudioFileContent = $this->taskProcessingService->getOutputFileContent($outputAudioFileId);

src/audioUtils.js

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/components/ChattyLLM/InputArea.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export default {
132132
const url = generateOcsUrl('/apps/assistant/api/v1/input-file')
133133
const formData = new FormData()
134134
formData.append('data', blob)
135-
formData.append('filename', 'chat-input.mp3')
135+
formData.append('filename', 'chat-input.wav')
136136
axios.post(url, formData).then(response => {
137137
this.$emit('submit-audio', response.data.ocs.data.fileId)
138138
}).catch(error => {

src/components/fields/AudioRecorderWrapper.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import NcButton from '@nextcloud/vue/components/NcButton'
4949
5050
import { showError } from '@nextcloud/dialogs'
5151
52-
import { convertWavToMp3 } from '../../audioUtils.js'
5352
import { MediaRecorder, register } from 'extendable-media-recorder'
5453
import { connect } from 'extendable-media-recorder-wav-encoder'
5554
@@ -210,8 +209,7 @@ export default {
210209
this.killStreams()
211210
if (!this.aborted) {
212211
const wavBlob = new Blob(this.chunks, { type: this.mediaRecorder.mimeType })
213-
const mp3Blob = await convertWavToMp3(wavBlob)
214-
this.$emit('new-recording', mp3Blob)
212+
this.$emit('new-recording', wavBlob)
215213
this.$emit('update:is-recording', false)
216214
}
217215
this.resetComponentData()

src/components/fields/ListOfMediaField.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export default {
218218
const url = generateOcsUrl('/apps/assistant/api/v1/input-file')
219219
const formData = new FormData()
220220
formData.append('data', blob)
221-
formData.append('filename', 'recording.mp3')
221+
formData.append('filename', 'recording.wav')
222222
axios.post(url, formData).then(response => {
223223
const fileId = response.data.ocs.data.fileId
224224
if (this.value === null) {

0 commit comments

Comments
 (0)