@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.js CHANGED
@@ -24164,6 +24164,21 @@ async function listThreads(backendUrl, auth, opts = {}) {
24164
24164
  }
24165
24165
  return res.json();
24166
24166
  }
24167
+ function deserializeMessage(msg) {
24168
+ if (msg && typeof msg === "object" && "lc" in msg && "kwargs" in msg && msg.type === "constructor") {
24169
+ const kwargs = msg.kwargs;
24170
+ if (Array.isArray(kwargs.tool_calls)) {
24171
+ kwargs.tool_calls = kwargs.tool_calls.map((tc) => {
24172
+ if (tc && typeof tc === "object" && "lc" in tc && "kwargs" in tc) {
24173
+ return tc.kwargs;
24174
+ }
24175
+ return tc;
24176
+ });
24177
+ }
24178
+ return kwargs;
24179
+ }
24180
+ return msg;
24181
+ }
24167
24182
  async function getThreadState(backendUrl, auth, threadId) {
24168
24183
  const base2 = getAgoraBaseUrl(backendUrl);
24169
24184
  const res = await fetch(`${base2}/api/unstable/threads/${threadId}`, {
@@ -24173,7 +24188,11 @@ async function getThreadState(backendUrl, auth, threadId) {
24173
24188
  if (!res.ok) {
24174
24189
  throw new Error(`[AthenaSDK] Failed to get thread state: ${res.status}`);
24175
24190
  }
24176
- return res.json();
24191
+ const data = await res.json();
24192
+ if (Array.isArray(data.messages)) {
24193
+ data.messages = data.messages.map(deserializeMessage);
24194
+ }
24195
+ return data;
24177
24196
  }
24178
24197
  async function archiveThread(backendUrl, auth, threadId) {
24179
24198
  const base2 = getAgoraBaseUrl(backendUrl);