@vettvangur/ai-sdk 0.1.5 → 0.1.7

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.
Files changed (2) hide show
  1. package/dist/index.js +2 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -905,6 +905,7 @@ function bindChat(root, options = {}) {
905
905
  ...options.classes
906
906
  };
907
907
  const initialThread = chatThread.cloneNode(true);
908
+ const initialNodes = Array.from(chatThread.childNodes);
908
909
  const endpoint = options.endpoint ?? root.dataset.aiChatEndpoint ?? form.action;
909
910
  const header = options.antiforgeryHeader ?? root.dataset.aiChatAntiforgeryHeader;
910
911
  const token = options.antiforgeryToken ?? root.dataset.aiChatAntiforgeryToken;
@@ -1008,7 +1009,7 @@ function bindChat(root, options = {}) {
1008
1009
  const question = input.value.trim();
1009
1010
  if (!question || session.status !== "idle") return;
1010
1011
  input.value = "";
1011
- chatThread.replaceChildren();
1012
+ for (const node of initialNodes) node.remove();
1012
1013
  appendMarkdown(appendMessage("user"), question);
1013
1014
  activeAssistant = appendMessage("assistant");
1014
1015
  root.setAttribute("aria-busy", "true");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vettvangur/ai-sdk",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Framework-agnostic AI chat client for server-rendered shells",
5
5
  "type": "module",
6
6
  "access": "public",