@sinequa/assistant 3.10.10 → 3.10.11

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.
@@ -2613,7 +2613,9 @@ class AssistantWsFramesService {
2613
2613
  context.setStoppingGenerationStatus(true);
2614
2614
  // Create a Subject to hold the result of the CancelTasks method
2615
2615
  const stopGenerationSubject$ = new Subject();
2616
- connection.on('CancelTasks', (res) => {
2616
+ // Use a named handler so it can be removed after firing, preventing listener accumulation across multiple stop operations
2617
+ const cancelHandler = (res) => {
2618
+ connection.off('CancelTasks', cancelHandler);
2617
2619
  // When the generation is stopped before streaming any VISIBLE assistant message, this means that $progress, $attachment and $debug properties will be lost.
2618
2620
  // However, the "ContextMessage" frames will be persisted in the chatHistory and the assistant may reference them in the next generation.
2619
2621
  // This leads to the problem of referencing undisplayed attachments in the next generation.
@@ -2637,11 +2639,13 @@ class AssistantWsFramesService {
2637
2639
  stopGenerationSubject$.complete();
2638
2640
  // Complete stopping generation
2639
2641
  context.setStoppingGenerationStatus(false);
2640
- });
2642
+ };
2643
+ connection.on('CancelTasks', cancelHandler);
2641
2644
  // Invoke the CancelTasks method and handle errors
2642
2645
  connection.invoke('CancelTasks')
2643
2646
  .catch(error => {
2644
2647
  console.error('Error invoking CancelTasks:', error);
2648
+ connection.off('CancelTasks', cancelHandler);
2645
2649
  stopGenerationSubject$.error(new Error(error));
2646
2650
  context.setStoppingGenerationStatus(false);
2647
2651
  return Promise.resolve();
@@ -2701,7 +2705,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
2701
2705
  }], ctorParameters: () => [] });
2702
2706
 
2703
2707
  // Auto-generated
2704
- const LIB_VERSION = '3.10.10';
2708
+ const LIB_VERSION = '3.10.11';
2705
2709
 
2706
2710
  class ChatService {
2707
2711
  /** Name of the assistant websocket endpoint. */