@adminforth/agent 1.43.14 → 1.43.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build.log CHANGED
@@ -60,5 +60,5 @@ custom/speech_recognition_frontend/voiceActivityDetection.ts
60
60
  custom/speech_recognition_frontend/types/
61
61
  custom/speech_recognition_frontend/types/voice-activity-detection.d.ts
62
62
 
63
- sent 1,664,782 bytes received 883 bytes 3,331,330.00 bytes/sec
64
- total size is 1,660,823 speedup is 1.00
63
+ sent 1,665,569 bytes received 883 bytes 3,332,904.00 bytes/sec
64
+ total size is 1,661,554 speedup is 1.00
@@ -25,7 +25,7 @@ export async function unlockAudio() {
25
25
  if (isAudioUnlocked) {
26
26
  return;
27
27
  }
28
-
28
+ console.log('Unlocking audio context by playing silent audio');
29
29
  await ctx.resume();
30
30
 
31
31
  const buffer = ctx.createBuffer(1, 1, 22050);
@@ -35,13 +35,16 @@ export async function unlockAudio() {
35
35
  source.connect(ctx.destination);
36
36
  source.start(0);
37
37
  isAudioUnlocked = true;
38
+ console.log('Audio context unlocked');
38
39
  }
39
40
 
40
41
  export async function startStandByAudio() {
41
- const response = await fetch(
42
- loadFile('plugins/AdminForthAgentPlugin/agentAudio/agent-processing.mp3')
43
- );
44
-
42
+ console.log('Starting standby audio');
43
+ const filePath = 'plugins/AdminForthAgentPlugin/agentAudio/agent-processing.mp3';
44
+ const fileUrl = await loadFile(filePath);
45
+ console.log('Standby audio file URL:', fileUrl);
46
+ const response = await fetch(fileUrl);
47
+ console.log('Standby audio file loaded:, response:', response);
45
48
  const arrayBuffer = await response.arrayBuffer();
46
49
  const audioBuffer = await ctx.decodeAudioData(arrayBuffer);
47
50
 
@@ -50,7 +53,7 @@ export async function startStandByAudio() {
50
53
 
51
54
  source.buffer = audioBuffer;
52
55
  source.connect(ctx.destination);
53
-
56
+ console.log('Playing standby audio');
54
57
  source.start();
55
58
  }
56
59
 
@@ -81,6 +84,7 @@ export function playChatResponseCurrentChunks({
81
84
  playback: ChatResponseAudioPlayback;
82
85
  chunks: ArrayBuffer[];
83
86
  }) {
87
+ console.log('Playing chat response audio chunks:', chunks.length);
84
88
  void ctx.resume().catch(() => undefined);
85
89
 
86
90
  for (const chunk of chunks) {
@@ -133,7 +137,7 @@ export function finishChatResponseAudio(playback: ChatResponseAudioPlayback | nu
133
137
  if (!playback || playback.isStopped) {
134
138
  return;
135
139
  }
136
-
140
+ console.log('Finishing chat response audio playback');
137
141
  playback.isDone = true;
138
142
 
139
143
  if (playback.pendingSourceCount === 0) {
@@ -145,7 +149,7 @@ export function stopChatResponseAudio(playback: ChatResponseAudioPlayback | null
145
149
  if (!playback || playback.isStopped) {
146
150
  return;
147
151
  }
148
-
152
+ console.log('Stopping chat response audio playback');
149
153
  playback.isStopped = true;
150
154
 
151
155
  for (const source of playback.activeSources) {
@@ -207,6 +211,7 @@ function concatUint8Arrays(left: Uint8Array, right: Uint8Array) {
207
211
 
208
212
  export function endStandByAudio() {
209
213
  if (standbySource) {
214
+ console.log('Ending standby audio');
210
215
  standbySource.stop();
211
216
  standbySource = null;
212
217
  }
@@ -57,6 +57,7 @@ export const useAgentAudio = defineStore('agentAudio', () => {
57
57
  const fullPath = `${import.meta.env.VITE_ADMINFORTH_PUBLIC_PATH || ''}/adminapi/v1/agent/speech-response`;
58
58
  try {
59
59
  agentAudioMode.value = 'transcribing';
60
+ console.log('Sending audio to server for transcription and response generation');
60
61
  const res = await fetch(fullPath, {
61
62
  method: 'POST',
62
63
  body: formData,
@@ -137,12 +138,12 @@ export const useAgentAudio = defineStore('agentAudio', () => {
137
138
  .filter((line) => line.startsWith('data:'))
138
139
  .map((line) => line.slice(5).trimStart())
139
140
  .join('\n');
140
-
141
141
  if (!data || data === '[DONE]') {
142
142
  return;
143
143
  }
144
144
 
145
145
  const event = JSON.parse(data) as SpeechStreamEvent;
146
+ console.log('Received speech stream event type:', event.type);
146
147
 
147
148
  if (event.type === 'error') {
148
149
 
@@ -25,7 +25,7 @@ export async function unlockAudio() {
25
25
  if (isAudioUnlocked) {
26
26
  return;
27
27
  }
28
-
28
+ console.log('Unlocking audio context by playing silent audio');
29
29
  await ctx.resume();
30
30
 
31
31
  const buffer = ctx.createBuffer(1, 1, 22050);
@@ -35,13 +35,16 @@ export async function unlockAudio() {
35
35
  source.connect(ctx.destination);
36
36
  source.start(0);
37
37
  isAudioUnlocked = true;
38
+ console.log('Audio context unlocked');
38
39
  }
39
40
 
40
41
  export async function startStandByAudio() {
41
- const response = await fetch(
42
- loadFile('plugins/AdminForthAgentPlugin/agentAudio/agent-processing.mp3')
43
- );
44
-
42
+ console.log('Starting standby audio');
43
+ const filePath = 'plugins/AdminForthAgentPlugin/agentAudio/agent-processing.mp3';
44
+ const fileUrl = await loadFile(filePath);
45
+ console.log('Standby audio file URL:', fileUrl);
46
+ const response = await fetch(fileUrl);
47
+ console.log('Standby audio file loaded:, response:', response);
45
48
  const arrayBuffer = await response.arrayBuffer();
46
49
  const audioBuffer = await ctx.decodeAudioData(arrayBuffer);
47
50
 
@@ -50,7 +53,7 @@ export async function startStandByAudio() {
50
53
 
51
54
  source.buffer = audioBuffer;
52
55
  source.connect(ctx.destination);
53
-
56
+ console.log('Playing standby audio');
54
57
  source.start();
55
58
  }
56
59
 
@@ -81,6 +84,7 @@ export function playChatResponseCurrentChunks({
81
84
  playback: ChatResponseAudioPlayback;
82
85
  chunks: ArrayBuffer[];
83
86
  }) {
87
+ console.log('Playing chat response audio chunks:', chunks.length);
84
88
  void ctx.resume().catch(() => undefined);
85
89
 
86
90
  for (const chunk of chunks) {
@@ -133,7 +137,7 @@ export function finishChatResponseAudio(playback: ChatResponseAudioPlayback | nu
133
137
  if (!playback || playback.isStopped) {
134
138
  return;
135
139
  }
136
-
140
+ console.log('Finishing chat response audio playback');
137
141
  playback.isDone = true;
138
142
 
139
143
  if (playback.pendingSourceCount === 0) {
@@ -145,7 +149,7 @@ export function stopChatResponseAudio(playback: ChatResponseAudioPlayback | null
145
149
  if (!playback || playback.isStopped) {
146
150
  return;
147
151
  }
148
-
152
+ console.log('Stopping chat response audio playback');
149
153
  playback.isStopped = true;
150
154
 
151
155
  for (const source of playback.activeSources) {
@@ -207,6 +211,7 @@ function concatUint8Arrays(left: Uint8Array, right: Uint8Array) {
207
211
 
208
212
  export function endStandByAudio() {
209
213
  if (standbySource) {
214
+ console.log('Ending standby audio');
210
215
  standbySource.stop();
211
216
  standbySource = null;
212
217
  }
@@ -57,6 +57,7 @@ export const useAgentAudio = defineStore('agentAudio', () => {
57
57
  const fullPath = `${import.meta.env.VITE_ADMINFORTH_PUBLIC_PATH || ''}/adminapi/v1/agent/speech-response`;
58
58
  try {
59
59
  agentAudioMode.value = 'transcribing';
60
+ console.log('Sending audio to server for transcription and response generation');
60
61
  const res = await fetch(fullPath, {
61
62
  method: 'POST',
62
63
  body: formData,
@@ -137,12 +138,12 @@ export const useAgentAudio = defineStore('agentAudio', () => {
137
138
  .filter((line) => line.startsWith('data:'))
138
139
  .map((line) => line.slice(5).trimStart())
139
140
  .join('\n');
140
-
141
141
  if (!data || data === '[DONE]') {
142
142
  return;
143
143
  }
144
144
 
145
145
  const event = JSON.parse(data) as SpeechStreamEvent;
146
+ console.log('Received speech stream event type:', event.type);
146
147
 
147
148
  if (event.type === 'error') {
148
149
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/agent",
3
- "version": "1.43.14",
3
+ "version": "1.43.16",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",