@athenaintel/react 0.9.10 → 0.9.12

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
@@ -23837,6 +23837,10 @@ const nullableToOptionalString = preprocessType(
23837
23837
  stringType().optional()
23838
23838
  );
23839
23839
  const metadataRecordSchema = recordType(stringType(), unknownType());
23840
+ const nullableToOptionalMetadataRecord = preprocessType(
23841
+ (val) => val === null ? void 0 : val,
23842
+ metadataRecordSchema.optional()
23843
+ );
23840
23844
  const systemMessageSchema = objectType({
23841
23845
  id: nullableToOptionalString,
23842
23846
  type: literalType("system"),
@@ -23875,8 +23879,8 @@ const aiMessageSchema = objectType({
23875
23879
  tool_calls: arrayType(anyType()).optional(),
23876
23880
  status: anyType().optional(),
23877
23881
  additional_kwargs: metadataRecordSchema.optional(),
23878
- usage_metadata: metadataRecordSchema.optional(),
23879
- response_metadata: metadataRecordSchema.optional()
23882
+ usage_metadata: nullableToOptionalMetadataRecord,
23883
+ response_metadata: nullableToOptionalMetadataRecord
23880
23884
  });
23881
23885
  const formatValidationError = (error2, msg) => {
23882
23886
  const msgObj = msg && typeof msg === "object" ? msg : {};
@@ -64344,16 +64348,21 @@ const AthenaReasoningPart = ({
64344
64348
  }) => {
64345
64349
  const inheritedTextComponent = useContext(AthenaReasoningTextComponentContext);
64346
64350
  const EffectiveTextComponent = TextComponent ?? inheritedTextComponent ?? TiptapText;
64351
+ const isMessageRunning = useAuiState((state) => {
64352
+ var _a2;
64353
+ return ((_a2 = state.message.status) == null ? void 0 : _a2.type) === "running";
64354
+ });
64347
64355
  const reasoningTokens = useAuiState(
64348
64356
  (state) => getReasoningTokensFromMetadata(state.message.metadata)
64349
64357
  );
64350
- const isRunning = (status == null ? void 0 : status.type) === "running";
64358
+ const isRunning = isMessageRunning || (status == null ? void 0 : status.type) === "running";
64351
64359
  const [isCollapsed, setIsCollapsed] = useState(!isRunning);
64352
64360
  const userOverrodeOpenStateRef = useRef(false);
64361
+ const hasText = text2.trim().length > 0;
64353
64362
  const reasoningTextProps = {
64354
64363
  type: "text",
64355
64364
  text: text2,
64356
- status
64365
+ status: isRunning ? { type: "running" } : status
64357
64366
  };
64358
64367
  useEffect(() => {
64359
64368
  if (userOverrodeOpenStateRef.current) {
@@ -64361,7 +64370,7 @@ const AthenaReasoningPart = ({
64361
64370
  }
64362
64371
  setIsCollapsed(!isRunning);
64363
64372
  }, [isRunning]);
64364
- if (!text2 && !isRunning) {
64373
+ if (!hasText && !isRunning) {
64365
64374
  return null;
64366
64375
  }
64367
64376
  return /* @__PURE__ */ jsxs(
@@ -64402,10 +64411,7 @@ const AthenaReasoningPart = ({
64402
64411
  ]
64403
64412
  }
64404
64413
  ) }),
64405
- /* @__PURE__ */ jsx(CollapsibleContent, { className: "pt-3", children: isRunning && !text2 ? /* @__PURE__ */ jsx("span", { className: "shimmer text-sm text-muted-foreground", children: "Analyzing..." }) : /* @__PURE__ */ jsxs("div", { className: "aui-assistant-reasoning-body text-sm", children: [
64406
- /* @__PURE__ */ jsx(EffectiveTextComponent, { ...reasoningTextProps }),
64407
- isRunning && /* @__PURE__ */ jsx("span", { className: "mt-2 inline-block shimmer text-sm text-muted-foreground", children: "Thinking..." })
64408
- ] }) })
64414
+ /* @__PURE__ */ jsx(CollapsibleContent, { className: "pt-3", children: isRunning && !hasText ? /* @__PURE__ */ jsx("span", { className: "shimmer text-sm text-muted-foreground", children: "Analyzing..." }) : isRunning ? /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground", children: text2 }) : /* @__PURE__ */ jsx("div", { className: "aui-assistant-reasoning-body text-sm", children: /* @__PURE__ */ jsx(EffectiveTextComponent, { ...reasoningTextProps }) }) })
64409
64415
  ]
64410
64416
  }
64411
64417
  );