@crestapps/ai-chat-ui 2.0.0-preview.223 → 2.0.0-preview.224

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.
@@ -622,10 +622,10 @@
622
622
  else this.audioChunks.push(bytes);
623
623
  }
624
624
  });
625
- this.connection.on("ReceiveAudioComplete", (itemId) => {
625
+ this.connection.on("ReceiveAudioComplete", () => {
626
626
  this.playCollectedAudio();
627
627
  });
628
- this.connection.on("HistoryCleared", (itemId) => {
628
+ this.connection.on("HistoryCleared", () => {
629
629
  this.messages = [];
630
630
  this.showPlaceholder();
631
631
  const clearHistoryBtn = document.getElementById("clearHistoryBtn");
@@ -846,7 +846,7 @@
846
846
  icons[i].classList.add("ai-bot-icon");
847
847
  }
848
848
  }
849
- for (var i = 0; i < this.messages.length; i++) if (this.messages[i].isStreaming) this.messages[i].isStreaming = false;
849
+ for (i = 0; i < this.messages.length; i++) if (this.messages[i].isStreaming) this.messages[i].isStreaming = false;
850
850
  if (this.settingsDirty) this.debouncedSaveSettings();
851
851
  },
852
852
  handleExternalTtsStop(e) {
@@ -1252,7 +1252,7 @@
1252
1252
  getSettingInputs() {
1253
1253
  const explicitInputs = document.querySelectorAll(".setting-input[data-setting]");
1254
1254
  if (explicitInputs.length > 0) return explicitInputs;
1255
- return document.querySelectorAll("input[name^=\"ChatInteraction.\"]:not([name*=\".Tools[\"]):not([name*=\".Connections[\"]), select[name^=\"ChatInteraction.\"]:not([name*=\".Tools[\"]):not([name*=\".Connections[\"]), textarea[name^=\"ChatInteraction.\"]:not([name*=\".Tools[\"]):not([name*=\".Connections[\"])");
1255
+ return document.querySelectorAll("input[name^=\"ChatInteraction.\"]:not([name*=\".Tools[\"]):not([name*=\".Connections[\"]):not([name*=\".Instances[\"]), select[name^=\"ChatInteraction.\"]:not([name*=\".Tools[\"]):not([name*=\".Connections[\"]):not([name*=\".Instances[\"]), textarea[name^=\"ChatInteraction.\"]:not([name*=\".Tools[\"]):not([name*=\".Connections[\"]):not([name*=\".Instances[\"])");
1256
1256
  },
1257
1257
  getSelectedGroupValues(groupName, fallbackSelector) {
1258
1258
  const explicitSelections = document.querySelectorAll(`.capability-checkbox[data-save-group="${groupName}"]:checked, .capability-checkbox[data-group="${groupName}"]:checked`);
@@ -1361,7 +1361,7 @@
1361
1361
  if (e.target.value.trim()) this.buttonElement.removeAttribute("disabled");
1362
1362
  else this.buttonElement.setAttribute("disabled", true);
1363
1363
  });
1364
- this.inputElement.addEventListener("paste", (e) => {
1364
+ this.inputElement.addEventListener("paste", () => {
1365
1365
  setTimeout(() => {
1366
1366
  this.prompt = this.inputElement.value;
1367
1367
  if (this.inputElement.value.trim()) this.buttonElement.removeAttribute("disabled");
@@ -1633,6 +1633,12 @@
1633
1633
  getSelectedAgentNames() {
1634
1634
  return this.getSelectedGroupValues("agentNames", "input[type=\"checkbox\"][name$=\"].IsSelected\"][name^=\"ChatInteraction.Agents[\"]:checked");
1635
1635
  },
1636
+ hasToolInstanceSelector() {
1637
+ return document.querySelector(".capability-checkbox[data-save-group=\"toolInstanceNames\"], .capability-checkbox[data-group=\"toolInstanceNames\"]") !== null;
1638
+ },
1639
+ getSelectedToolInstanceNames() {
1640
+ return this.getSelectedGroupValues("toolInstanceNames");
1641
+ },
1636
1642
  saveSettings() {
1637
1643
  const itemId = this.getItemId();
1638
1644
  if (!itemId) return Promise.resolve();
@@ -1652,6 +1658,7 @@
1652
1658
  settings.mcpConnectionIds = this.getSelectedMcpConnectionIds();
1653
1659
  settings.a2aConnectionIds = this.getSelectedA2AConnectionIds();
1654
1660
  settings.agentNames = this.getSelectedAgentNames();
1661
+ if (this.hasToolInstanceSelector()) settings.toolInstanceNames = this.getSelectedToolInstanceNames();
1655
1662
  const promptTemplates = this.getPromptTemplateSelections();
1656
1663
  if (promptTemplates.length > 0) {
1657
1664
  settings.promptTemplates = promptTemplates;