@axiom-lattice/react-sdk 2.1.121 → 2.1.122
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 +16 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -288,6 +288,9 @@ var AuthProvider = ({
|
|
|
288
288
|
window.addEventListener("lattice:unauthorized", handler);
|
|
289
289
|
return () => window.removeEventListener("lattice:unauthorized", handler);
|
|
290
290
|
}, [logout]);
|
|
291
|
+
const handleUnauthorized = (0, import_react.useCallback)(() => {
|
|
292
|
+
logout();
|
|
293
|
+
}, [logout]);
|
|
291
294
|
const selectTenant = (0, import_react.useCallback)(async (tenantId) => {
|
|
292
295
|
if (!user) return;
|
|
293
296
|
setIsLoading(true);
|
|
@@ -303,11 +306,10 @@ var AuthProvider = ({
|
|
|
303
306
|
body: JSON.stringify({ tenantId })
|
|
304
307
|
});
|
|
305
308
|
if (response.status === 401) {
|
|
306
|
-
const data = await response.json().catch(() =>
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}
|
|
309
|
+
const data = await response.json().catch(() => null);
|
|
310
|
+
handleUnauthorized();
|
|
311
|
+
const message35 = data && typeof data === "object" && "error" in data && typeof data.error === "string" ? data.error : "Unauthorized";
|
|
312
|
+
throw new Error(message35);
|
|
311
313
|
}
|
|
312
314
|
if (!response.ok) {
|
|
313
315
|
const data = await response.json();
|
|
@@ -339,10 +341,7 @@ var AuthProvider = ({
|
|
|
339
341
|
} finally {
|
|
340
342
|
setIsLoading(false);
|
|
341
343
|
}
|
|
342
|
-
}, [baseURL, user, onTenantSelected]);
|
|
343
|
-
const handleUnauthorized = (0, import_react.useCallback)(() => {
|
|
344
|
-
logout();
|
|
345
|
-
}, [logout]);
|
|
344
|
+
}, [baseURL, user, onTenantSelected, handleUnauthorized]);
|
|
346
345
|
const fetchUserTenants = (0, import_react.useCallback)(async () => {
|
|
347
346
|
if (!user) return;
|
|
348
347
|
setIsLoading(true);
|
|
@@ -33121,18 +33120,18 @@ var EvalSuiteDetail = ({ projectId, suiteId, onBack, onRun }) => {
|
|
|
33121
33120
|
const [editingCase, setEditingCase] = (0, import_react113.useState)(null);
|
|
33122
33121
|
const [form] = import_antd99.Form.useForm();
|
|
33123
33122
|
const [agents, setAgents] = (0, import_react113.useState)([]);
|
|
33123
|
+
const [agentsLoading, setAgentsLoading] = (0, import_react113.useState)(false);
|
|
33124
33124
|
const suite = suites.find((s) => s.id === suiteId) || {};
|
|
33125
33125
|
const isEditing = !!editingCase;
|
|
33126
33126
|
const loadAgents = async () => {
|
|
33127
|
+
setAgents([]);
|
|
33128
|
+
setAgentsLoading(true);
|
|
33127
33129
|
try {
|
|
33128
|
-
|
|
33129
|
-
const apiKey = client.config?.apiKey || "";
|
|
33130
|
-
const res = await fetch(`${baseURL}/api/assistants`, {
|
|
33131
|
-
headers: apiKey ? { Authorization: `Bearer ${apiKey}` } : {}
|
|
33132
|
-
});
|
|
33133
|
-
const d = await res.json();
|
|
33134
|
-
if (d.success) setAgents(d.data?.records || []);
|
|
33130
|
+
setAgents(await client.assistants.list());
|
|
33135
33131
|
} catch {
|
|
33132
|
+
import_antd99.message.error("Failed to load agents");
|
|
33133
|
+
} finally {
|
|
33134
|
+
setAgentsLoading(false);
|
|
33136
33135
|
}
|
|
33137
33136
|
};
|
|
33138
33137
|
const openCreateModal = () => {
|
|
@@ -33271,6 +33270,7 @@ var EvalSuiteDetail = ({ projectId, suiteId, onBack, onRun }) => {
|
|
|
33271
33270
|
{
|
|
33272
33271
|
placeholder: "Select agent",
|
|
33273
33272
|
showSearch: true,
|
|
33273
|
+
loading: agentsLoading,
|
|
33274
33274
|
optionFilterProp: "label",
|
|
33275
33275
|
options: agents.map((a) => ({
|
|
33276
33276
|
value: a.id,
|