@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.
- package/dist/index.js +2 -3
- 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 (
|
|
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"));
|