@adminforth/agent 1.41.3 → 1.42.1

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
@@ -58,5 +58,5 @@ custom/speech_recognition_frontend/voiceActivityDetection.ts
58
58
  custom/speech_recognition_frontend/types/
59
59
  custom/speech_recognition_frontend/types/voice-activity-detection.d.ts
60
60
 
61
- sent 1,660,390 bytes received 860 bytes 3,322,500.00 bytes/sec
62
- total size is 1,656,528 speedup is 1.00
61
+ sent 1,661,051 bytes received 860 bytes 3,323,822.00 bytes/sec
62
+ total size is 1,657,135 speedup is 1.00
@@ -5,7 +5,7 @@
5
5
  class="bg-white w-[0.2rem] rounded-sm transition-all duration-100 ease-out"
6
6
  :style="{ height }"
7
7
  />
8
- <p v-if="isRecording" class="text-white ml-2">End</p>
8
+ <p v-if="isRecording" class="text-white ml-2">{{ $t('End') }}</p>
9
9
  </template>
10
10
 
11
11
  <script setup lang="ts">
@@ -1,27 +1,39 @@
1
1
  <template>
2
- <button
3
- class="absolute bottom-2 h-9 bg-lightPrimary dark:bg-darkPrimary
4
- hover:opacity-90 rounded-full flex items-center justify-center
5
- transition-all duration-300 ease-in-out overflow-hidden"
6
- :class="[isAudioChatMode ? 'w-32 px-2': 'w-9', !agentStore.isAudioChatMode ? 'right-16': 'right-1/2 translate-x-1/2']"
7
- @click="toggleChatMode"
8
- >
9
- <div class="w-5 h-5 flex items-center justify-center">
10
- <div v-if="microphoneButtonMode === 'listen' || microphoneButtonMode === 'off'" class="flex justify-evenly items-center gap-[0.1rem]">
11
- <AudioLines
12
- :showAnimation="showAudioWavesAnimation"
13
- :isRecording="microphoneButtonMode === 'listen'"
14
- :amplitude="audioAmplitude"
15
- />
2
+ <div
3
+ class="absolute bottom-2 flex items-center justify-center z-10 gap-4"
4
+ :class="[!agentStore.isAudioChatMode ? 'right-16': 'right-1/2 translate-x-1/2']"
5
+ >
6
+ <button
7
+ v-if="isAudioChatMode && microphoneButtonMode === 'generating'"
8
+ class="bg-red-500 hover:bg-red-600 dark:bg-red-700 dark:hover:bg-red-800 h-9 flex items-center justify-center rounded-full gap-2 text-white px-4"
9
+ @click="stopCurrentGeneration()"
10
+ >
11
+ <div class="w-3 h-3 bg-white rounded-full"/>
12
+ {{ $t('Break') }}
13
+ </button>
14
+ <button
15
+ class="h-9 bg-lightPrimary dark:bg-darkPrimary
16
+ hover:opacity-90 rounded-full flex items-center justify-center
17
+ transition-all duration-300 ease-in-out overflow-hidden"
18
+ :class="[isAudioChatMode ? 'w-32 px-2': 'w-9']"
19
+ @click="toggleChatMode"
20
+ >
21
+ <div class="w-5 h-5 flex items-center justify-center">
22
+ <div v-if="microphoneButtonMode === 'listen' || microphoneButtonMode === 'off'" class="flex justify-evenly items-center gap-[0.1rem]">
23
+ <AudioLines
24
+ :showAnimation="showAudioWavesAnimation"
25
+ :isRecording="microphoneButtonMode === 'listen'"
26
+ :amplitude="audioAmplitude"
27
+ />
28
+ </div>
29
+ <div v-else-if="microphoneButtonMode === 'generating'" class="flex items-center justify-center gap-2 text-white text-sm">
30
+ <span class="w-3 h-3 bg-white rounded-sm" />
31
+ {{ $t('End') }}
32
+ </div>
33
+ <Spinner v-else class="w-4 h-4 text-lightButtonsText dark:text-darkButtonsText fill-lightButtonsBackground dark:fill-darkPrimary" />
16
34
  </div>
17
- <div v-else-if="microphoneButtonMode === 'generating'" class="flex items-center justify-center gap-2 text-white text-sm">
18
- <span class="w-3 h-3 bg-white rounded-sm" />
19
- {{ $t('Stop') }}
20
- </div>
21
- <Spinner v-else class="w-4 h-4 text-lightButtonsText dark:text-darkButtonsText fill-lightButtonsBackground dark:fill-darkPrimary" />
22
- </div>
23
-
24
- </button>
35
+ </button>
36
+ </div>
25
37
  </template>
26
38
 
27
39
 
@@ -83,6 +95,11 @@ watch(agentAudioMode, async (newVal) => {
83
95
  }
84
96
  })
85
97
 
98
+ function stopCurrentGeneration() {
99
+ stopGenerationAndAudio();
100
+ agentAudio.playBeep(1000);
101
+ }
102
+
86
103
  function toggleChatMode() {
87
104
  agentStore.setIsAudioChatMode(!isAudioChatMode.value);
88
105
  if (isAudioChatMode.value) {
@@ -5,7 +5,7 @@
5
5
  class="bg-white w-[0.2rem] rounded-sm transition-all duration-100 ease-out"
6
6
  :style="{ height }"
7
7
  />
8
- <p v-if="isRecording" class="text-white ml-2">End</p>
8
+ <p v-if="isRecording" class="text-white ml-2">{{ $t('End') }}</p>
9
9
  </template>
10
10
 
11
11
  <script setup lang="ts">
@@ -1,27 +1,39 @@
1
1
  <template>
2
- <button
3
- class="absolute bottom-2 h-9 bg-lightPrimary dark:bg-darkPrimary
4
- hover:opacity-90 rounded-full flex items-center justify-center
5
- transition-all duration-300 ease-in-out overflow-hidden"
6
- :class="[isAudioChatMode ? 'w-32 px-2': 'w-9', !agentStore.isAudioChatMode ? 'right-16': 'right-1/2 translate-x-1/2']"
7
- @click="toggleChatMode"
8
- >
9
- <div class="w-5 h-5 flex items-center justify-center">
10
- <div v-if="microphoneButtonMode === 'listen' || microphoneButtonMode === 'off'" class="flex justify-evenly items-center gap-[0.1rem]">
11
- <AudioLines
12
- :showAnimation="showAudioWavesAnimation"
13
- :isRecording="microphoneButtonMode === 'listen'"
14
- :amplitude="audioAmplitude"
15
- />
2
+ <div
3
+ class="absolute bottom-2 flex items-center justify-center z-10 gap-4"
4
+ :class="[!agentStore.isAudioChatMode ? 'right-16': 'right-1/2 translate-x-1/2']"
5
+ >
6
+ <button
7
+ v-if="isAudioChatMode && microphoneButtonMode === 'generating'"
8
+ class="bg-red-500 hover:bg-red-600 dark:bg-red-700 dark:hover:bg-red-800 h-9 flex items-center justify-center rounded-full gap-2 text-white px-4"
9
+ @click="stopCurrentGeneration()"
10
+ >
11
+ <div class="w-3 h-3 bg-white rounded-full"/>
12
+ {{ $t('Break') }}
13
+ </button>
14
+ <button
15
+ class="h-9 bg-lightPrimary dark:bg-darkPrimary
16
+ hover:opacity-90 rounded-full flex items-center justify-center
17
+ transition-all duration-300 ease-in-out overflow-hidden"
18
+ :class="[isAudioChatMode ? 'w-32 px-2': 'w-9']"
19
+ @click="toggleChatMode"
20
+ >
21
+ <div class="w-5 h-5 flex items-center justify-center">
22
+ <div v-if="microphoneButtonMode === 'listen' || microphoneButtonMode === 'off'" class="flex justify-evenly items-center gap-[0.1rem]">
23
+ <AudioLines
24
+ :showAnimation="showAudioWavesAnimation"
25
+ :isRecording="microphoneButtonMode === 'listen'"
26
+ :amplitude="audioAmplitude"
27
+ />
28
+ </div>
29
+ <div v-else-if="microphoneButtonMode === 'generating'" class="flex items-center justify-center gap-2 text-white text-sm">
30
+ <span class="w-3 h-3 bg-white rounded-sm" />
31
+ {{ $t('End') }}
32
+ </div>
33
+ <Spinner v-else class="w-4 h-4 text-lightButtonsText dark:text-darkButtonsText fill-lightButtonsBackground dark:fill-darkPrimary" />
16
34
  </div>
17
- <div v-else-if="microphoneButtonMode === 'generating'" class="flex items-center justify-center gap-2 text-white text-sm">
18
- <span class="w-3 h-3 bg-white rounded-sm" />
19
- {{ $t('Stop') }}
20
- </div>
21
- <Spinner v-else class="w-4 h-4 text-lightButtonsText dark:text-darkButtonsText fill-lightButtonsBackground dark:fill-darkPrimary" />
22
- </div>
23
-
24
- </button>
35
+ </button>
36
+ </div>
25
37
  </template>
26
38
 
27
39
 
@@ -83,6 +95,11 @@ watch(agentAudioMode, async (newVal) => {
83
95
  }
84
96
  })
85
97
 
98
+ function stopCurrentGeneration() {
99
+ stopGenerationAndAudio();
100
+ agentAudio.playBeep(1000);
101
+ }
102
+
86
103
  function toggleChatMode() {
87
104
  agentStore.setIsAudioChatMode(!isAudioChatMode.value);
88
105
  if (isAudioChatMode.value) {
package/dist/index.js CHANGED
@@ -483,13 +483,13 @@ export default class AdminForthAgentPlugin extends AdminForthPlugin {
483
483
  stream.audioStart(speech.mimeType, speech.format);
484
484
  const reader = speech.audioStream.getReader();
485
485
  const cancelAudioStream = () => {
486
- void reader.cancel();
486
+ void reader.cancel().catch(() => undefined);
487
487
  };
488
488
  try {
489
489
  abortSignal.addEventListener("abort", cancelAudioStream, { once: true });
490
490
  while (true) {
491
491
  if (abortSignal.aborted) {
492
- yield reader.cancel();
492
+ yield reader.cancel().catch(() => undefined);
493
493
  break;
494
494
  }
495
495
  const { value, done } = yield reader.read();
package/index.ts CHANGED
@@ -551,7 +551,7 @@ export default class AdminForthAgentPlugin extends AdminForthPlugin {
551
551
 
552
552
  const reader = speech.audioStream.getReader();
553
553
  const cancelAudioStream = () => {
554
- void reader.cancel();
554
+ void reader.cancel().catch(() => undefined);
555
555
  };
556
556
 
557
557
  try {
@@ -559,7 +559,7 @@ export default class AdminForthAgentPlugin extends AdminForthPlugin {
559
559
 
560
560
  while (true) {
561
561
  if (abortSignal.aborted) {
562
- await reader.cancel();
562
+ await reader.cancel().catch(() => undefined);
563
563
  break;
564
564
  }
565
565
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/agent",
3
- "version": "1.41.3",
3
+ "version": "1.42.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",