@icos-react/largemodel 1.0.29 → 1.0.30

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
@@ -587,6 +587,9 @@ BubbleList.displayName = "BubbleList";
587
587
  // src/core/BubbleList/StandardMessageRenderer.tsx
588
588
  var import_react4 = __toESM(require("react"));
589
589
  var import_react_markdown = __toESM(require("react-markdown"));
590
+ var import_remark_math = __toESM(require("remark-math"));
591
+ var import_rehype_katex = __toESM(require("rehype-katex"));
592
+ var import_katex_min = require("katex/dist/katex.min.css");
590
593
 
591
594
  // src/core/utils/index.ts
592
595
  var import_react3 = __toESM(require("react"));
@@ -661,6 +664,8 @@ var StandardMessageRenderer = ({ message, eventContent = {}, components, classNa
661
664
  import_react_markdown.default,
662
665
  {
663
666
  key: index,
667
+ remarkPlugins: [import_remark_math.default],
668
+ rehypePlugins: [import_rehype_katex.default],
664
669
  components: {
665
670
  p: ({ node, ...props }) => /* @__PURE__ */ import_react4.default.createElement("p", { style: { margin: "0.5em 0" }, ...props }),
666
671
  pre: ({ node, ...props }) => /* @__PURE__ */ import_react4.default.createElement(
@@ -4455,6 +4460,9 @@ init_apiHandler();
4455
4460
  var import_react20 = __toESM(require("react"));
4456
4461
  var import_react_markdown2 = __toESM(require("react-markdown"));
4457
4462
  var import_rehype_raw = __toESM(require("rehype-raw"));
4463
+ var import_remark_math2 = __toESM(require("remark-math"));
4464
+ var import_rehype_katex2 = __toESM(require("rehype-katex"));
4465
+ var import_katex_min2 = require("katex/dist/katex.min.css");
4458
4466
  var rightIcon = `data:image/svg+xml,${encodeURIComponent(`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
4459
4467
  <path d="M8 15C11.866 15 15 11.866 15 8C15 4.134 11.866 1 8 1C4.134 1 1 4.134 1 8C1 11.866 4.134 15 8 15ZM11.82 6.21998L7.3 10.7399L4.35502 7.79497L5.34498 6.80503L7.3 8.76006L10.83 5.23002L11.82 6.21998Z" fill="#00FFFF"/>
4460
4468
  </svg>`)}`;
@@ -4672,7 +4680,7 @@ var ThinkingContent = ({
4672
4680
  style: customStyle?.thinkingContent,
4673
4681
  "data-custom-color": ""
4674
4682
  },
4675
- /* @__PURE__ */ import_react20.default.createElement(import_react_markdown2.default, { components: markdownComponents, rehypePlugins: [import_rehype_raw.default] }, content)
4683
+ /* @__PURE__ */ import_react20.default.createElement(import_react_markdown2.default, { components: markdownComponents, remarkPlugins: [import_remark_math2.default], rehypePlugins: [import_rehype_katex2.default, import_rehype_raw.default] }, content)
4676
4684
  ));
4677
4685
  };
4678
4686
  if (typeof window !== "undefined") {
@@ -4705,12 +4713,12 @@ var renderContentWithAnchors = (content, messageId, eventContent, styles) => {
4705
4713
  img: CustomImageComponent
4706
4714
  };
4707
4715
  if (!hasAnchors) {
4708
- return /* @__PURE__ */ import_react20.default.createElement("div", { className: styles.messageText }, /* @__PURE__ */ import_react20.default.createElement(import_react_markdown2.default, { components: markdownComponents, rehypePlugins: [import_rehype_raw.default] }, content));
4716
+ return /* @__PURE__ */ import_react20.default.createElement("div", { className: styles.messageText }, /* @__PURE__ */ import_react20.default.createElement(import_react_markdown2.default, { components: markdownComponents, remarkPlugins: [import_remark_math2.default], rehypePlugins: [import_rehype_katex2.default, import_rehype_raw.default] }, content));
4709
4717
  }
4710
4718
  const parts = parseContentWithAnchors2(content, messageId, eventContent || {});
4711
4719
  return /* @__PURE__ */ import_react20.default.createElement("div", { className: styles.messageText }, parts.map((part, index) => {
4712
4720
  if (typeof part === "string") {
4713
- return /* @__PURE__ */ import_react20.default.createElement(import_react_markdown2.default, { key: index, components: markdownComponents, rehypePlugins: [import_rehype_raw.default] }, part);
4721
+ return /* @__PURE__ */ import_react20.default.createElement(import_react_markdown2.default, { key: index, components: markdownComponents, remarkPlugins: [import_remark_math2.default], rehypePlugins: [import_rehype_katex2.default, import_rehype_raw.default] }, part);
4714
4722
  }
4715
4723
  return part;
4716
4724
  }));
@@ -4745,11 +4753,11 @@ function renderCustomTagStreamRoot(message, styles, customTagRenderers, eventCon
4745
4753
  return null;
4746
4754
  const hasAnchors = text.includes("[ANCHOR:");
4747
4755
  if (!hasAnchors) {
4748
- return /* @__PURE__ */ import_react20.default.createElement("div", { className: styles.messageText, key }, /* @__PURE__ */ import_react20.default.createElement(import_react_markdown2.default, { components: markdownComponents, rehypePlugins: [import_rehype_raw.default] }, text));
4756
+ return /* @__PURE__ */ import_react20.default.createElement("div", { className: styles.messageText, key }, /* @__PURE__ */ import_react20.default.createElement(import_react_markdown2.default, { components: markdownComponents, remarkPlugins: [import_remark_math2.default], rehypePlugins: [import_rehype_katex2.default, import_rehype_raw.default] }, text));
4749
4757
  }
4750
4758
  const parts = parseContentWithAnchors2(text, message.id, eventContent || {});
4751
4759
  return /* @__PURE__ */ import_react20.default.createElement("div", { className: styles.messageText, key }, parts.map(
4752
- (part, index) => typeof part === "string" ? /* @__PURE__ */ import_react20.default.createElement(import_react_markdown2.default, { key: index, components: markdownComponents, rehypePlugins: [import_rehype_raw.default] }, part) : part
4760
+ (part, index) => typeof part === "string" ? /* @__PURE__ */ import_react20.default.createElement(import_react_markdown2.default, { key: index, components: markdownComponents, remarkPlugins: [import_remark_math2.default], rehypePlugins: [import_rehype_katex2.default, import_rehype_raw.default] }, part) : part
4753
4761
  ));
4754
4762
  };
4755
4763
  const renderSegmentNode = (segmentId) => {
package/dist/index.mjs CHANGED
@@ -532,6 +532,9 @@ BubbleList.displayName = "BubbleList";
532
532
  // src/core/BubbleList/StandardMessageRenderer.tsx
533
533
  import React4 from "react";
534
534
  import ReactMarkdown from "react-markdown";
535
+ import remarkMath from "remark-math";
536
+ import rehypeKatex from "rehype-katex";
537
+ import "katex/dist/katex.min.css";
535
538
 
536
539
  // src/core/utils/index.ts
537
540
  import React3 from "react";
@@ -606,6 +609,8 @@ var StandardMessageRenderer = ({ message, eventContent = {}, components, classNa
606
609
  ReactMarkdown,
607
610
  {
608
611
  key: index,
612
+ remarkPlugins: [remarkMath],
613
+ rehypePlugins: [rehypeKatex],
609
614
  components: {
610
615
  p: ({ node, ...props }) => /* @__PURE__ */ React4.createElement("p", { style: { margin: "0.5em 0" }, ...props }),
611
616
  pre: ({ node, ...props }) => /* @__PURE__ */ React4.createElement(
@@ -4406,6 +4411,9 @@ init_apiHandler();
4406
4411
  import React10, { useEffect as useEffect8, useRef as useRef9, useState as useState8 } from "react";
4407
4412
  import ReactMarkdown2 from "react-markdown";
4408
4413
  import rehypeRaw from "rehype-raw";
4414
+ import remarkMath2 from "remark-math";
4415
+ import rehypeKatex2 from "rehype-katex";
4416
+ import "katex/dist/katex.min.css";
4409
4417
  var rightIcon = `data:image/svg+xml,${encodeURIComponent(`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
4410
4418
  <path d="M8 15C11.866 15 15 11.866 15 8C15 4.134 11.866 1 8 1C4.134 1 1 4.134 1 8C1 11.866 4.134 15 8 15ZM11.82 6.21998L7.3 10.7399L4.35502 7.79497L5.34498 6.80503L7.3 8.76006L10.83 5.23002L11.82 6.21998Z" fill="#00FFFF"/>
4411
4419
  </svg>`)}`;
@@ -4623,7 +4631,7 @@ var ThinkingContent = ({
4623
4631
  style: customStyle?.thinkingContent,
4624
4632
  "data-custom-color": ""
4625
4633
  },
4626
- /* @__PURE__ */ React10.createElement(ReactMarkdown2, { components: markdownComponents, rehypePlugins: [rehypeRaw] }, content)
4634
+ /* @__PURE__ */ React10.createElement(ReactMarkdown2, { components: markdownComponents, remarkPlugins: [remarkMath2], rehypePlugins: [rehypeKatex2, rehypeRaw] }, content)
4627
4635
  ));
4628
4636
  };
4629
4637
  if (typeof window !== "undefined") {
@@ -4656,12 +4664,12 @@ var renderContentWithAnchors = (content, messageId, eventContent, styles) => {
4656
4664
  img: CustomImageComponent
4657
4665
  };
4658
4666
  if (!hasAnchors) {
4659
- return /* @__PURE__ */ React10.createElement("div", { className: styles.messageText }, /* @__PURE__ */ React10.createElement(ReactMarkdown2, { components: markdownComponents, rehypePlugins: [rehypeRaw] }, content));
4667
+ return /* @__PURE__ */ React10.createElement("div", { className: styles.messageText }, /* @__PURE__ */ React10.createElement(ReactMarkdown2, { components: markdownComponents, remarkPlugins: [remarkMath2], rehypePlugins: [rehypeKatex2, rehypeRaw] }, content));
4660
4668
  }
4661
4669
  const parts = parseContentWithAnchors2(content, messageId, eventContent || {});
4662
4670
  return /* @__PURE__ */ React10.createElement("div", { className: styles.messageText }, parts.map((part, index) => {
4663
4671
  if (typeof part === "string") {
4664
- return /* @__PURE__ */ React10.createElement(ReactMarkdown2, { key: index, components: markdownComponents, rehypePlugins: [rehypeRaw] }, part);
4672
+ return /* @__PURE__ */ React10.createElement(ReactMarkdown2, { key: index, components: markdownComponents, remarkPlugins: [remarkMath2], rehypePlugins: [rehypeKatex2, rehypeRaw] }, part);
4665
4673
  }
4666
4674
  return part;
4667
4675
  }));
@@ -4696,11 +4704,11 @@ function renderCustomTagStreamRoot(message, styles, customTagRenderers, eventCon
4696
4704
  return null;
4697
4705
  const hasAnchors = text.includes("[ANCHOR:");
4698
4706
  if (!hasAnchors) {
4699
- return /* @__PURE__ */ React10.createElement("div", { className: styles.messageText, key }, /* @__PURE__ */ React10.createElement(ReactMarkdown2, { components: markdownComponents, rehypePlugins: [rehypeRaw] }, text));
4707
+ return /* @__PURE__ */ React10.createElement("div", { className: styles.messageText, key }, /* @__PURE__ */ React10.createElement(ReactMarkdown2, { components: markdownComponents, remarkPlugins: [remarkMath2], rehypePlugins: [rehypeKatex2, rehypeRaw] }, text));
4700
4708
  }
4701
4709
  const parts = parseContentWithAnchors2(text, message.id, eventContent || {});
4702
4710
  return /* @__PURE__ */ React10.createElement("div", { className: styles.messageText, key }, parts.map(
4703
- (part, index) => typeof part === "string" ? /* @__PURE__ */ React10.createElement(ReactMarkdown2, { key: index, components: markdownComponents, rehypePlugins: [rehypeRaw] }, part) : part
4711
+ (part, index) => typeof part === "string" ? /* @__PURE__ */ React10.createElement(ReactMarkdown2, { key: index, components: markdownComponents, remarkPlugins: [remarkMath2], rehypePlugins: [rehypeKatex2, rehypeRaw] }, part) : part
4704
4712
  ));
4705
4713
  };
4706
4714
  const renderSegmentNode = (segmentId) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icos-react/largemodel",
3
3
  "displayName": "大模型组件",
4
- "version": "1.0.29",
4
+ "version": "1.0.30",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
@@ -39,9 +39,12 @@
39
39
  "@ant-design/x": "^1.0.0",
40
40
  "antd-style": "^3.7.1",
41
41
  "immer": "^10.1.1",
42
+ "katex": "^0.17.0",
42
43
  "ldrs": "^1.1.7",
43
44
  "react-markdown": "^10.1.0",
44
- "rehype-raw": "^7.0.0"
45
+ "rehype-katex": "^7.0.1",
46
+ "rehype-raw": "^7.0.0",
47
+ "remark-math": "^6.0.0"
45
48
  },
46
49
  "publishConfig": {
47
50
  "access": "public",