@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.cjs CHANGED
@@ -24317,6 +24317,22 @@ const useAthenaRuntime = (config2) => {
24317
24317
  tokenRef.current = token;
24318
24318
  const apiKeyRef = React.useRef(apiKey);
24319
24319
  apiKeyRef.current = apiKey;
24320
+ const runConfigRef = React.useRef({
24321
+ enabledTools,
24322
+ agent: agent2,
24323
+ model,
24324
+ workbench,
24325
+ knowledgeBase,
24326
+ systemPrompt
24327
+ });
24328
+ runConfigRef.current = {
24329
+ enabledTools,
24330
+ agent: agent2,
24331
+ model,
24332
+ workbench,
24333
+ knowledgeBase,
24334
+ systemPrompt
24335
+ };
24320
24336
  const isExistingThread = !!threadIdProp;
24321
24337
  const runtime = useAssistantTransportRuntime({
24322
24338
  initialState: { messages: [] },
@@ -24415,16 +24431,17 @@ const useAthenaRuntime = (config2) => {
24415
24431
  return true;
24416
24432
  },
24417
24433
  get runConfig() {
24434
+ const currentRunConfig = runConfigRef.current;
24418
24435
  return {
24419
24436
  custom: {
24420
- enabled_tools: enabledTools,
24421
- agent: agent2,
24422
- model,
24437
+ enabled_tools: currentRunConfig.enabledTools,
24438
+ agent: currentRunConfig.agent,
24439
+ model: currentRunConfig.model,
24423
24440
  effort_dial_duration: -1,
24424
24441
  plan_mode_enabled: false,
24425
- workbench,
24426
- knowledge_base: knowledgeBase,
24427
- ...systemPrompt ? { system_prompt: systemPrompt } : {}
24442
+ workbench: currentRunConfig.workbench,
24443
+ knowledge_base: currentRunConfig.knowledgeBase,
24444
+ ...currentRunConfig.systemPrompt ? { system_prompt: currentRunConfig.systemPrompt } : {}
24428
24445
  },
24429
24446
  persistToolInvocationLogs: true
24430
24447
  };
@@ -64905,7 +64922,9 @@ const AthenaChat = ({
64905
64922
  {
64906
64923
  turnAnchor: "top",
64907
64924
  className: "aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4",
64925
+ "data-aui-thread-viewport": "",
64908
64926
  children: [
64927
+ /* @__PURE__ */ jsxRuntime.jsx(ThreadScrollToTop, {}),
64909
64928
  /* @__PURE__ */ jsxRuntime.jsx(AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "aui-thread-welcome-message flex size-full flex-col justify-center px-4", children: [
64910
64929
  /* @__PURE__ */ jsxRuntime.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 }),
64911
64930
  welcomeSubtext && /* @__PURE__ */ jsxRuntime.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 }),
@@ -64951,6 +64970,50 @@ const ThreadLoadingOverlay = () => {
64951
64970
  if (!remoteId || timedOut) return null;
64952
64971
  return /* @__PURE__ */ jsxRuntime.jsx(AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 z-10 flex items-center justify-center bg-background/80", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-5 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent" }) }) });
64953
64972
  };
64973
+ const THREAD_VIEWPORT_ATTR = "data-aui-thread-viewport";
64974
+ const useScrollToTop = () => {
64975
+ const [isAtTop, setIsAtTop] = React.useState(true);
64976
+ const [buttonEl, setButtonEl] = React.useState(null);
64977
+ const containerRef = React.useCallback((node) => {
64978
+ setButtonEl(node);
64979
+ }, []);
64980
+ const getViewport = React.useCallback(() => {
64981
+ if (!buttonEl) return null;
64982
+ return buttonEl.closest(`[${THREAD_VIEWPORT_ATTR}]`);
64983
+ }, [buttonEl]);
64984
+ React.useEffect(() => {
64985
+ const viewport = getViewport();
64986
+ if (!viewport) return;
64987
+ const handleScroll2 = () => {
64988
+ setIsAtTop(viewport.scrollTop <= 50);
64989
+ };
64990
+ handleScroll2();
64991
+ viewport.addEventListener("scroll", handleScroll2, { passive: true });
64992
+ return () => viewport.removeEventListener("scroll", handleScroll2);
64993
+ }, [getViewport]);
64994
+ const handleClick2 = React.useCallback(() => {
64995
+ const viewport = getViewport();
64996
+ if (!viewport) return;
64997
+ viewport.scrollTo({ top: 0, behavior: "smooth" });
64998
+ }, [getViewport]);
64999
+ return { isAtTop, containerRef, handleClick: handleClick2 };
65000
+ };
65001
+ const ThreadScrollToTop = () => {
65002
+ const { isAtTop, containerRef, handleClick: handleClick2 } = useScrollToTop();
65003
+ const isEmpty3 = useAuiState((s) => s.thread.isEmpty);
65004
+ if (isEmpty3) return null;
65005
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sticky top-0 z-10 mx-auto flex h-0 w-full max-w-(--thread-max-width) justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
65006
+ TooltipIconButton,
65007
+ {
65008
+ ref: containerRef,
65009
+ tooltip: "Scroll to top",
65010
+ variant: "outline",
65011
+ className: cn("aui-thread-scroll-to-top absolute top-2 rounded-full p-4 dark:bg-background dark:hover:bg-accent", isAtTop && "invisible"),
65012
+ onClick: handleClick2,
65013
+ children: /* @__PURE__ */ jsxRuntime.jsx(ArrowUp, {})
65014
+ }
65015
+ ) });
65016
+ };
64954
65017
  const ThreadScrollToBottom = () => /* @__PURE__ */ jsxRuntime.jsx(ThreadPrimitiveScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
64955
65018
  TooltipIconButton,
64956
65019
  {