@athenaintel/react 0.10.14 → 0.10.15
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 +26 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24558,12 +24558,23 @@ const useAthenaRuntime = (config2) => {
|
|
|
24558
24558
|
if (isExistingThread && !hasResumedRef.current) {
|
|
24559
24559
|
hasResumedRef.current = true;
|
|
24560
24560
|
(async () => {
|
|
24561
|
+
var _a2;
|
|
24561
24562
|
try {
|
|
24562
24563
|
const auth = { apiKey: apiKeyRef.current, token: tokenRef.current };
|
|
24563
24564
|
const state = await getThreadState(backendUrl, auth, threadId);
|
|
24564
24565
|
runtime.thread.importExternalState({
|
|
24565
24566
|
messages: state.messages
|
|
24566
24567
|
});
|
|
24568
|
+
if (state.status === "running") {
|
|
24569
|
+
try {
|
|
24570
|
+
const lastMessageId = ((_a2 = runtime.thread.getState().messages.at(-1)) == null ? void 0 : _a2.id) ?? null;
|
|
24571
|
+
runtime.thread.unstable_resumeRun({ parentId: lastMessageId });
|
|
24572
|
+
} catch (resumeErr) {
|
|
24573
|
+
if (IS_DEV) {
|
|
24574
|
+
console.error("[AthenaSDK] Failed to resume running thread:", resumeErr);
|
|
24575
|
+
}
|
|
24576
|
+
}
|
|
24577
|
+
}
|
|
24567
24578
|
} catch (err) {
|
|
24568
24579
|
if (IS_DEV) {
|
|
24569
24580
|
console.error("[AthenaSDK] Failed to load thread state:", err);
|
|
@@ -25326,12 +25337,16 @@ const useAthenaConfigValue = ({
|
|
|
25326
25337
|
linkClicksRef.current = linkClicks;
|
|
25327
25338
|
const citationLinksRef = useRef(citationLinks);
|
|
25328
25339
|
citationLinksRef.current = citationLinks;
|
|
25340
|
+
const tokenRef = useRef(token);
|
|
25341
|
+
tokenRef.current = token;
|
|
25329
25342
|
return useMemo(
|
|
25330
25343
|
() => ({
|
|
25331
25344
|
backendUrl,
|
|
25332
25345
|
appUrl,
|
|
25333
25346
|
apiKey,
|
|
25334
|
-
token
|
|
25347
|
+
get token() {
|
|
25348
|
+
return tokenRef.current;
|
|
25349
|
+
},
|
|
25335
25350
|
get linkClicks() {
|
|
25336
25351
|
return linkClicksRef.current;
|
|
25337
25352
|
},
|
|
@@ -25339,7 +25354,7 @@ const useAthenaConfigValue = ({
|
|
|
25339
25354
|
return citationLinksRef.current;
|
|
25340
25355
|
}
|
|
25341
25356
|
}),
|
|
25342
|
-
[backendUrl, appUrl, apiKey
|
|
25357
|
+
[backendUrl, appUrl, apiKey]
|
|
25343
25358
|
);
|
|
25344
25359
|
};
|
|
25345
25360
|
function AthenaStandalone({
|
|
@@ -65548,7 +65563,10 @@ const TooltipIconButton = forwardRef(
|
|
|
65548
65563
|
TooltipIconButton.displayName = "TooltipIconButton";
|
|
65549
65564
|
const MAX_FILE_SIZE = 5 * 1024 * 1024 * 1024;
|
|
65550
65565
|
function useFileUpload() {
|
|
65551
|
-
const
|
|
65566
|
+
const config2 = useAthenaConfig();
|
|
65567
|
+
const configRef = useRef(config2);
|
|
65568
|
+
configRef.current = config2;
|
|
65569
|
+
const { backendUrl, apiKey } = config2;
|
|
65552
65570
|
const [isUploading, setIsUploading] = useState(false);
|
|
65553
65571
|
const [progress, setProgress] = useState(null);
|
|
65554
65572
|
const [error2, setError] = useState(null);
|
|
@@ -65581,9 +65599,10 @@ function useFileUpload() {
|
|
|
65581
65599
|
}
|
|
65582
65600
|
const baseUrl = backendUrl.replace(/\/api\/assistant-ui\/?$/, "");
|
|
65583
65601
|
const uploadUrl = `${baseUrl}/api/upload/`;
|
|
65602
|
+
const currentToken = configRef.current.token;
|
|
65584
65603
|
const headers = {};
|
|
65585
|
-
if (
|
|
65586
|
-
headers["Authorization"] = `Bearer ${
|
|
65604
|
+
if (currentToken) {
|
|
65605
|
+
headers["Authorization"] = `Bearer ${currentToken}`;
|
|
65587
65606
|
} else if (apiKey) {
|
|
65588
65607
|
headers["X-API-KEY"] = apiKey;
|
|
65589
65608
|
}
|
|
@@ -65633,7 +65652,7 @@ function useFileUpload() {
|
|
|
65633
65652
|
for (const [key, value] of Object.entries(headers)) {
|
|
65634
65653
|
xhr.setRequestHeader(key, value);
|
|
65635
65654
|
}
|
|
65636
|
-
xhr.withCredentials = !
|
|
65655
|
+
xhr.withCredentials = !currentToken && !apiKey;
|
|
65637
65656
|
xhr.send(formData);
|
|
65638
65657
|
});
|
|
65639
65658
|
if (result.errors.length > 0) {
|
|
@@ -65655,7 +65674,7 @@ function useFileUpload() {
|
|
|
65655
65674
|
setProgress(null);
|
|
65656
65675
|
}
|
|
65657
65676
|
},
|
|
65658
|
-
[backendUrl, apiKey
|
|
65677
|
+
[backendUrl, apiKey]
|
|
65659
65678
|
);
|
|
65660
65679
|
return { upload, isUploading, progress, error: error2, clearError };
|
|
65661
65680
|
}
|