@adminforth/agent 1.43.14 → 1.43.15

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,464 bytes received 883 bytes 3,332,694.00 bytes/sec
64
+ total size is 1,661,449 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,15 @@ 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() {
42
+ console.log('Starting standby audio');
41
43
  const response = await fetch(
42
44
  loadFile('plugins/AdminForthAgentPlugin/agentAudio/agent-processing.mp3')
43
45
  );
44
-
46
+ console.log('Standby audio file loaded:, response:', response);
45
47
  const arrayBuffer = await response.arrayBuffer();
46
48
  const audioBuffer = await ctx.decodeAudioData(arrayBuffer);
47
49
 
@@ -50,7 +52,7 @@ export async function startStandByAudio() {
50
52
 
51
53
  source.buffer = audioBuffer;
52
54
  source.connect(ctx.destination);
53
-
55
+ console.log('Playing standby audio');
54
56
  source.start();
55
57
  }
56
58
 
@@ -81,6 +83,7 @@ export function playChatResponseCurrentChunks({
81
83
  playback: ChatResponseAudioPlayback;
82
84
  chunks: ArrayBuffer[];
83
85
  }) {
86
+ console.log('Playing chat response audio chunks:', chunks.length);
84
87
  void ctx.resume().catch(() => undefined);
85
88
 
86
89
  for (const chunk of chunks) {
@@ -133,7 +136,7 @@ export function finishChatResponseAudio(playback: ChatResponseAudioPlayback | nu
133
136
  if (!playback || playback.isStopped) {
134
137
  return;
135
138
  }
136
-
139
+ console.log('Finishing chat response audio playback');
137
140
  playback.isDone = true;
138
141
 
139
142
  if (playback.pendingSourceCount === 0) {
@@ -145,7 +148,7 @@ export function stopChatResponseAudio(playback: ChatResponseAudioPlayback | null
145
148
  if (!playback || playback.isStopped) {
146
149
  return;
147
150
  }
148
-
151
+ console.log('Stopping chat response audio playback');
149
152
  playback.isStopped = true;
150
153
 
151
154
  for (const source of playback.activeSources) {
@@ -207,6 +210,7 @@ function concatUint8Arrays(left: Uint8Array, right: Uint8Array) {
207
210
 
208
211
  export function endStandByAudio() {
209
212
  if (standbySource) {
213
+ console.log('Ending standby audio');
210
214
  standbySource.stop();
211
215
  standbySource = null;
212
216
  }
@@ -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,15 @@ 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() {
42
+ console.log('Starting standby audio');
41
43
  const response = await fetch(
42
44
  loadFile('plugins/AdminForthAgentPlugin/agentAudio/agent-processing.mp3')
43
45
  );
44
-
46
+ console.log('Standby audio file loaded:, response:', response);
45
47
  const arrayBuffer = await response.arrayBuffer();
46
48
  const audioBuffer = await ctx.decodeAudioData(arrayBuffer);
47
49
 
@@ -50,7 +52,7 @@ export async function startStandByAudio() {
50
52
 
51
53
  source.buffer = audioBuffer;
52
54
  source.connect(ctx.destination);
53
-
55
+ console.log('Playing standby audio');
54
56
  source.start();
55
57
  }
56
58
 
@@ -81,6 +83,7 @@ export function playChatResponseCurrentChunks({
81
83
  playback: ChatResponseAudioPlayback;
82
84
  chunks: ArrayBuffer[];
83
85
  }) {
86
+ console.log('Playing chat response audio chunks:', chunks.length);
84
87
  void ctx.resume().catch(() => undefined);
85
88
 
86
89
  for (const chunk of chunks) {
@@ -133,7 +136,7 @@ export function finishChatResponseAudio(playback: ChatResponseAudioPlayback | nu
133
136
  if (!playback || playback.isStopped) {
134
137
  return;
135
138
  }
136
-
139
+ console.log('Finishing chat response audio playback');
137
140
  playback.isDone = true;
138
141
 
139
142
  if (playback.pendingSourceCount === 0) {
@@ -145,7 +148,7 @@ export function stopChatResponseAudio(playback: ChatResponseAudioPlayback | null
145
148
  if (!playback || playback.isStopped) {
146
149
  return;
147
150
  }
148
-
151
+ console.log('Stopping chat response audio playback');
149
152
  playback.isStopped = true;
150
153
 
151
154
  for (const source of playback.activeSources) {
@@ -207,6 +210,7 @@ function concatUint8Arrays(left: Uint8Array, right: Uint8Array) {
207
210
 
208
211
  export function endStandByAudio() {
209
212
  if (standbySource) {
213
+ console.log('Ending standby audio');
210
214
  standbySource.stop();
211
215
  standbySource = null;
212
216
  }
@@ -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.15",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",