@athenaintel/react 0.9.3 → 0.9.5
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 +16 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20669,7 +20669,11 @@ async function listThreads(backendUrl, auth, opts = {}) {
|
|
|
20669
20669
|
const res = await fetch(`${base2}/api/conversations/threads/list`, {
|
|
20670
20670
|
method: "POST",
|
|
20671
20671
|
headers: { "Content-Type": "application/json", ...getAuthHeaders(auth) },
|
|
20672
|
-
body: JSON.stringify({
|
|
20672
|
+
body: JSON.stringify({
|
|
20673
|
+
limit: opts.limit ?? 50,
|
|
20674
|
+
offset: opts.offset ?? 0,
|
|
20675
|
+
exclude_triggered: opts.exclude_triggered ?? true
|
|
20676
|
+
})
|
|
20673
20677
|
});
|
|
20674
20678
|
if (!res.ok) {
|
|
20675
20679
|
throw new Error(`[AthenaSDK] Failed to list threads: ${res.status}`);
|
|
@@ -24296,7 +24300,7 @@ function useAthenaThreadListAdapter(config2) {
|
|
|
24296
24300
|
);
|
|
24297
24301
|
return useMemo(() => ({
|
|
24298
24302
|
async list() {
|
|
24299
|
-
if (!auth.token) {
|
|
24303
|
+
if (!auth.token && !auth.apiKey) {
|
|
24300
24304
|
return { threads: [] };
|
|
24301
24305
|
}
|
|
24302
24306
|
try {
|
|
@@ -24638,6 +24642,16 @@ function AthenaWithThreadList({
|
|
|
24638
24642
|
core.__internal_load();
|
|
24639
24643
|
}
|
|
24640
24644
|
}, [runtime]);
|
|
24645
|
+
const previousAuthRefreshKeyRef = useRef(null);
|
|
24646
|
+
const authRefreshKey = `${backendUrl}::${apiKey ?? ""}::${token ?? ""}`;
|
|
24647
|
+
useEffect(() => {
|
|
24648
|
+
const previousAuthRefreshKey = previousAuthRefreshKeyRef.current;
|
|
24649
|
+
previousAuthRefreshKeyRef.current = authRefreshKey;
|
|
24650
|
+
if (previousAuthRefreshKey === null || previousAuthRefreshKey === authRefreshKey) {
|
|
24651
|
+
return;
|
|
24652
|
+
}
|
|
24653
|
+
handleRefresh();
|
|
24654
|
+
}, [authRefreshKey, handleRefresh]);
|
|
24641
24655
|
const auiTools = useMemo(() => Tools({ toolkit: frontendTools }), [frontendTools]);
|
|
24642
24656
|
const aui = useAui({ tools: auiTools });
|
|
24643
24657
|
const athenaConfig = useMemo(
|