@athenaintel/react 0.4.3 → 0.4.4

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
@@ -24182,6 +24182,21 @@ async function listThreads(backendUrl, auth, opts = {}) {
24182
24182
  }
24183
24183
  return res.json();
24184
24184
  }
24185
+ function deserializeMessage(msg) {
24186
+ if (msg && typeof msg === "object" && "lc" in msg && "kwargs" in msg && msg.type === "constructor") {
24187
+ const kwargs = msg.kwargs;
24188
+ if (Array.isArray(kwargs.tool_calls)) {
24189
+ kwargs.tool_calls = kwargs.tool_calls.map((tc) => {
24190
+ if (tc && typeof tc === "object" && "lc" in tc && "kwargs" in tc) {
24191
+ return tc.kwargs;
24192
+ }
24193
+ return tc;
24194
+ });
24195
+ }
24196
+ return kwargs;
24197
+ }
24198
+ return msg;
24199
+ }
24185
24200
  async function getThreadState(backendUrl, auth, threadId) {
24186
24201
  const base2 = getAgoraBaseUrl(backendUrl);
24187
24202
  const res = await fetch(`${base2}/api/unstable/threads/${threadId}`, {
@@ -24191,7 +24206,11 @@ async function getThreadState(backendUrl, auth, threadId) {
24191
24206
  if (!res.ok) {
24192
24207
  throw new Error(`[AthenaSDK] Failed to get thread state: ${res.status}`);
24193
24208
  }
24194
- return res.json();
24209
+ const data = await res.json();
24210
+ if (Array.isArray(data.messages)) {
24211
+ data.messages = data.messages.map(deserializeMessage);
24212
+ }
24213
+ return data;
24195
24214
  }
24196
24215
  async function archiveThread(backendUrl, auth, threadId) {
24197
24216
  const base2 = getAgoraBaseUrl(backendUrl);