@usecrow/ui 0.1.22 → 0.1.24

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.cjs CHANGED
@@ -152,6 +152,9 @@ function useChat({
152
152
  signal: abortControllerRef.current.signal
153
153
  });
154
154
  if (!response.ok) {
155
+ if (response.status === 401 && typeof window !== "undefined") {
156
+ window.dispatchEvent(new CustomEvent("crow:token-refresh-needed"));
157
+ }
155
158
  throw new Error(`HTTP error! status: ${response.status}`);
156
159
  }
157
160
  const reader = response.body?.getReader();
@@ -272,6 +275,15 @@ function useChat({
272
275
  )
273
276
  );
274
277
  break;
278
+ case "tool_result_links":
279
+ if (parsed.links && Array.isArray(parsed.links)) {
280
+ setMessages(
281
+ (prev) => prev.map(
282
+ (msg) => msg.id === botMsgId ? { ...msg, links: [...msg.links || [], ...parsed.links] } : msg
283
+ )
284
+ );
285
+ }
286
+ break;
275
287
  case "client_tool_call":
276
288
  pendingClientTools.push({
277
289
  toolName: parsed.tool_name,
@@ -425,6 +437,9 @@ function useChat({
425
437
  })
426
438
  });
427
439
  if (!response.ok) {
440
+ if (response.status === 401 && typeof window !== "undefined") {
441
+ window.dispatchEvent(new CustomEvent("crow:token-refresh-needed"));
442
+ }
428
443
  throw new Error(`HTTP error! status: ${response.status}`);
429
444
  }
430
445
  const reader = response.body?.getReader();