@vettvangur/ai-sdk 0.1.7 → 0.1.9

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 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -978,12 +978,11 @@ function bindChat(root, options = {}) {
978
978
  };
979
979
  let content = null;
980
980
  try {
981
- const registered = registryEntries(options.registry)?.renderers.get(event.data.name);
982
- content = registered?.(context) ?? null;
983
981
  const templateName = dataString(event.data.data, "template");
984
982
  const surfaceName = dataString(event.data.data, "surface");
985
- if (!content && templateName) content = root.querySelector(`template[data-template="${CSS.escape(templateName)}"]`)?.content.cloneNode(true) ?? null;
983
+ if (templateName) content = root.querySelector(`template[data-template="${CSS.escape(templateName)}"]`)?.content.cloneNode(true) ?? null;
986
984
  if (!content && surfaceName) content = registryEntries(options.registry)?.surfaces.get(surfaceName)?.(context) ?? root.querySelector(`template[data-ai-surface="${CSS.escape(surfaceName)}"]`)?.content.cloneNode(true) ?? null;
985
+ if (!content) content = registryEntries(options.registry)?.renderers.get(event.data.name)?.(context) ?? null;
987
986
  content ??= renderAnswerCard(root.ownerDocument, event.data.data, labels);
988
987
  } catch (caught) {
989
988
  options.onError?.(caught instanceof Error ? caught : /* @__PURE__ */ new Error("AI chat extension failed"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vettvangur/ai-sdk",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Framework-agnostic AI chat client for server-rendered shells",
5
5
  "type": "module",
6
6
  "access": "public",