@athenaintel/react 0.9.17 → 0.9.19

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
@@ -24299,6 +24299,22 @@ const useAthenaRuntime = (config2) => {
24299
24299
  tokenRef.current = token;
24300
24300
  const apiKeyRef = useRef(apiKey);
24301
24301
  apiKeyRef.current = apiKey;
24302
+ const runConfigRef = useRef({
24303
+ enabledTools,
24304
+ agent: agent2,
24305
+ model,
24306
+ workbench,
24307
+ knowledgeBase,
24308
+ systemPrompt
24309
+ });
24310
+ runConfigRef.current = {
24311
+ enabledTools,
24312
+ agent: agent2,
24313
+ model,
24314
+ workbench,
24315
+ knowledgeBase,
24316
+ systemPrompt
24317
+ };
24302
24318
  const isExistingThread = !!threadIdProp;
24303
24319
  const runtime = useAssistantTransportRuntime({
24304
24320
  initialState: { messages: [] },
@@ -24397,16 +24413,17 @@ const useAthenaRuntime = (config2) => {
24397
24413
  return true;
24398
24414
  },
24399
24415
  get runConfig() {
24416
+ const currentRunConfig = runConfigRef.current;
24400
24417
  return {
24401
24418
  custom: {
24402
- enabled_tools: enabledTools,
24403
- agent: agent2,
24404
- model,
24419
+ enabled_tools: currentRunConfig.enabledTools,
24420
+ agent: currentRunConfig.agent,
24421
+ model: currentRunConfig.model,
24405
24422
  effort_dial_duration: -1,
24406
24423
  plan_mode_enabled: false,
24407
- workbench,
24408
- knowledge_base: knowledgeBase,
24409
- ...systemPrompt ? { system_prompt: systemPrompt } : {}
24424
+ workbench: currentRunConfig.workbench,
24425
+ knowledge_base: currentRunConfig.knowledgeBase,
24426
+ ...currentRunConfig.systemPrompt ? { system_prompt: currentRunConfig.systemPrompt } : {}
24410
24427
  },
24411
24428
  persistToolInvocationLogs: true
24412
24429
  };
@@ -64887,7 +64904,9 @@ const AthenaChat = ({
64887
64904
  {
64888
64905
  turnAnchor: "top",
64889
64906
  className: "aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4",
64907
+ "data-aui-thread-viewport": "",
64890
64908
  children: [
64909
+ /* @__PURE__ */ jsx(ThreadScrollToTop, {}),
64891
64910
  /* @__PURE__ */ jsx(AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsx("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: /* @__PURE__ */ jsx("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "aui-thread-welcome-message flex size-full flex-col justify-center px-4", children: [
64892
64911
  /* @__PURE__ */ jsx("h1", { className: "aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both font-semibold text-2xl duration-200", children: welcomeMessage }),
64893
64912
  welcomeSubtext && /* @__PURE__ */ jsx("p", { className: "aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-muted-foreground text-lg delay-75 duration-200", children: welcomeSubtext }),
@@ -64933,6 +64952,50 @@ const ThreadLoadingOverlay = () => {
64933
64952
  if (!remoteId || timedOut) return null;
64934
64953
  return /* @__PURE__ */ jsx(AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-10 flex items-center justify-center bg-background/80", children: /* @__PURE__ */ jsx("div", { className: "size-5 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent" }) }) });
64935
64954
  };
64955
+ const THREAD_VIEWPORT_ATTR = "data-aui-thread-viewport";
64956
+ const useScrollToTop = () => {
64957
+ const [isAtTop, setIsAtTop] = useState(true);
64958
+ const [buttonEl, setButtonEl] = useState(null);
64959
+ const containerRef = useCallback((node) => {
64960
+ setButtonEl(node);
64961
+ }, []);
64962
+ const getViewport = useCallback(() => {
64963
+ if (!buttonEl) return null;
64964
+ return buttonEl.closest(`[${THREAD_VIEWPORT_ATTR}]`);
64965
+ }, [buttonEl]);
64966
+ useEffect(() => {
64967
+ const viewport = getViewport();
64968
+ if (!viewport) return;
64969
+ const handleScroll2 = () => {
64970
+ setIsAtTop(viewport.scrollTop <= 50);
64971
+ };
64972
+ handleScroll2();
64973
+ viewport.addEventListener("scroll", handleScroll2, { passive: true });
64974
+ return () => viewport.removeEventListener("scroll", handleScroll2);
64975
+ }, [getViewport]);
64976
+ const handleClick2 = useCallback(() => {
64977
+ const viewport = getViewport();
64978
+ if (!viewport) return;
64979
+ viewport.scrollTo({ top: 0, behavior: "smooth" });
64980
+ }, [getViewport]);
64981
+ return { isAtTop, containerRef, handleClick: handleClick2 };
64982
+ };
64983
+ const ThreadScrollToTop = () => {
64984
+ const { isAtTop, containerRef, handleClick: handleClick2 } = useScrollToTop();
64985
+ const isEmpty3 = useAuiState((s) => s.thread.isEmpty);
64986
+ if (isEmpty3) return null;
64987
+ return /* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 mx-auto flex h-0 w-full max-w-(--thread-max-width) justify-center", children: /* @__PURE__ */ jsx(
64988
+ TooltipIconButton,
64989
+ {
64990
+ ref: containerRef,
64991
+ tooltip: "Scroll to top",
64992
+ variant: "outline",
64993
+ className: cn("aui-thread-scroll-to-top absolute top-2 rounded-full p-4 dark:bg-background dark:hover:bg-accent", isAtTop && "invisible"),
64994
+ onClick: handleClick2,
64995
+ children: /* @__PURE__ */ jsx(ArrowUp, {})
64996
+ }
64997
+ ) });
64998
+ };
64936
64999
  const ThreadScrollToBottom = () => /* @__PURE__ */ jsx(ThreadPrimitiveScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx(
64937
65000
  TooltipIconButton,
64938
65001
  {