@cloudflare/ai-search-snippet 0.0.32 → 0.0.34

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.
@@ -1,6 +1,6 @@
1
- var U = Object.defineProperty;
2
- var O = (n, i, e) => i in n ? U(n, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[i] = e;
3
- var a = (n, i, e) => O(n, typeof i != "symbol" ? i + "" : i, e);
1
+ var P = Object.defineProperty;
2
+ var U = (n, i, e) => i in n ? P(n, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[i] = e;
3
+ var a = (n, i, e) => U(n, typeof i != "symbol" ? i + "" : i, e);
4
4
  const g = [
5
5
  "Searching...",
6
6
  "Digging through results...",
@@ -36,7 +36,7 @@ function q(n) {
36
36
  function E(n) {
37
37
  return new DOMParser().parseFromString(n, "text/html").documentElement.textContent || "";
38
38
  }
39
- function _(n) {
39
+ function O(n) {
40
40
  const i = new Date(n), t = (/* @__PURE__ */ new Date()).getTime() - i.getTime();
41
41
  if (t < 6e4)
42
42
  return "Just now";
@@ -157,7 +157,7 @@ class K {
157
157
  ai_search_options: {
158
158
  retrieval: {
159
159
  metadata_only: !0,
160
- max_results: e.maxResults ?? 30
160
+ max_num_results: e.maxResults ?? 30
161
161
  }
162
162
  }
163
163
  },
@@ -180,7 +180,10 @@ class K {
180
180
  timestamp: l.item.timestamp ?? void 0,
181
181
  url: l.item.key,
182
182
  image: l.item.metadata?.image || void 0,
183
- metadata: l.item.metadata
183
+ metadata: {
184
+ ...l.item.metadata,
185
+ instance_id: l.instance_id
186
+ }
184
187
  })
185
188
  );
186
189
  throw c.success === !1 ? new Error(c.error) : new Error("Unknown error");
@@ -196,7 +199,7 @@ class K {
196
199
  messages: [{ role: "user", content: i }],
197
200
  stream: !0,
198
201
  ...e.maxResults !== void 0 && {
199
- max_results: e.maxResults
202
+ max_num_results: e.maxResults
200
203
  }
201
204
  },
202
205
  "ai-search",
@@ -213,8 +216,8 @@ class K {
213
216
  const { done: u, value: S } = await l.read();
214
217
  if (u)
215
218
  break;
216
- const P = p.decode(S, { stream: !0 });
217
- c += P;
219
+ const _ = p.decode(S, { stream: !0 });
220
+ c += _;
218
221
  }
219
222
  yield {
220
223
  type: "result",
@@ -1270,7 +1273,7 @@ class N {
1270
1273
  ${e ? `<div class="chat-streaming"><span class="chat-streaming-dot"></span><span class="chat-streaming-dot"></span><span class="chat-streaming-dot"></span><span class="loading-text">${g[this.loadingMessageIndex]}</span></div>` : ""}
1271
1274
  </div>
1272
1275
  <div class="chat-message-metadata">
1273
- <span class="chat-message-time">${_(i.timestamp)}</span>
1276
+ <span class="chat-message-time">${O(i.timestamp)}</span>
1274
1277
  </div>
1275
1278
  </div>
1276
1279
  </div>