@athenaintel/react 0.10.20 → 0.10.21
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 +28 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +28 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -638,6 +638,7 @@ export declare const CreateSheetToolUI: ToolCallMessagePartComponent;
|
|
|
638
638
|
export declare function createThread(backendUrl: string, auth: AuthConfig, opts?: {
|
|
639
639
|
systemPrompt?: string;
|
|
640
640
|
enabledTools?: string[];
|
|
641
|
+
appId?: string;
|
|
641
642
|
}): Promise<ThreadCreateResponse>;
|
|
642
643
|
|
|
643
644
|
export declare const DEFAULT_API_URL: string;
|
package/dist/index.js
CHANGED
|
@@ -8150,7 +8150,8 @@ async function createThread(backendUrl, auth, opts = {}) {
|
|
|
8150
8150
|
body: JSON.stringify({
|
|
8151
8151
|
config: {
|
|
8152
8152
|
system_prompt: opts.systemPrompt ?? "",
|
|
8153
|
-
enabled_tools: opts.enabledTools
|
|
8153
|
+
enabled_tools: opts.enabledTools,
|
|
8154
|
+
...opts.appId ? { app_id: opts.appId } : {}
|
|
8154
8155
|
}
|
|
8155
8156
|
})
|
|
8156
8157
|
});
|
|
@@ -8563,20 +8564,32 @@ const useAthenaRuntime = (config2) => {
|
|
|
8563
8564
|
if (isExistingThread && !hasResumedRef.current) {
|
|
8564
8565
|
hasResumedRef.current = true;
|
|
8565
8566
|
(async () => {
|
|
8566
|
-
var _a2;
|
|
8567
|
+
var _a2, _b;
|
|
8567
8568
|
const auth = { apiKey: apiKeyRef.current, token: tokenRef.current };
|
|
8569
|
+
console.log("[AthenaSDK] Loading existing thread state:", {
|
|
8570
|
+
threadId,
|
|
8571
|
+
backendUrl
|
|
8572
|
+
});
|
|
8568
8573
|
try {
|
|
8569
8574
|
const state = await getThreadState(backendUrl, auth, threadId);
|
|
8575
|
+
const messageCount = ((_a2 = state == null ? void 0 : state.messages) == null ? void 0 : _a2.length) ?? 0;
|
|
8576
|
+
console.log("[AthenaSDK] Got thread state:", {
|
|
8577
|
+
threadId,
|
|
8578
|
+
messageCount,
|
|
8579
|
+
hasMessages: messageCount > 0
|
|
8580
|
+
});
|
|
8570
8581
|
runtime.thread.importExternalState({
|
|
8571
8582
|
messages: state.messages
|
|
8572
8583
|
});
|
|
8584
|
+
console.log(
|
|
8585
|
+
"[AthenaSDK] importExternalState completed, runtime messages:",
|
|
8586
|
+
runtime.thread.getState().messages.length
|
|
8587
|
+
);
|
|
8573
8588
|
} catch (err) {
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
);
|
|
8579
|
-
}
|
|
8589
|
+
console.warn(
|
|
8590
|
+
"[AthenaSDK] Failed to load thread state (may be a new streaming thread):",
|
|
8591
|
+
err
|
|
8592
|
+
);
|
|
8580
8593
|
}
|
|
8581
8594
|
try {
|
|
8582
8595
|
const statusRes = await fetch(resolvedStatusApiUrl, {
|
|
@@ -8588,7 +8601,7 @@ const useAthenaRuntime = (config2) => {
|
|
|
8588
8601
|
const status = await statusRes.json();
|
|
8589
8602
|
if (status.isRunning) {
|
|
8590
8603
|
try {
|
|
8591
|
-
const lastMessageId = ((
|
|
8604
|
+
const lastMessageId = ((_b = runtime.thread.getState().messages.at(-1)) == null ? void 0 : _b.id) ?? null;
|
|
8592
8605
|
runtime.thread.unstable_resumeRun({ parentId: lastMessageId });
|
|
8593
8606
|
} catch (resumeErr) {
|
|
8594
8607
|
if (IS_DEV) {
|
|
@@ -13242,18 +13255,18 @@ function AthenaWithThreadList({
|
|
|
13242
13255
|
core.__internal_load();
|
|
13243
13256
|
}
|
|
13244
13257
|
}, [runtime]);
|
|
13245
|
-
const
|
|
13258
|
+
const previousRefreshKeyRef = useRef(null);
|
|
13246
13259
|
const authContext = useContext(AthenaAuthContext);
|
|
13247
13260
|
const authUserId = ((_a2 = authContext == null ? void 0 : authContext.user) == null ? void 0 : _a2.userId) ?? "";
|
|
13248
|
-
const
|
|
13261
|
+
const refreshKey = `${backendUrl}::${apiKey ?? ""}::${authUserId}::${appId ?? ""}`;
|
|
13249
13262
|
useEffect(() => {
|
|
13250
|
-
const
|
|
13251
|
-
|
|
13252
|
-
if (
|
|
13263
|
+
const previousRefreshKey = previousRefreshKeyRef.current;
|
|
13264
|
+
previousRefreshKeyRef.current = refreshKey;
|
|
13265
|
+
if (previousRefreshKey === null || previousRefreshKey === refreshKey) {
|
|
13253
13266
|
return;
|
|
13254
13267
|
}
|
|
13255
13268
|
handleRefresh();
|
|
13256
|
-
}, [
|
|
13269
|
+
}, [refreshKey, handleRefresh]);
|
|
13257
13270
|
const auiTools = useMemo(() => Tools({ toolkit: frontendTools }), [frontendTools]);
|
|
13258
13271
|
const aui = useAui({ tools: auiTools });
|
|
13259
13272
|
const athenaConfig = useAthenaConfigValue({
|