@fe-free/ai 4.1.32 → 4.1.34

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @fe-free/ai
2
2
 
3
+ ## 4.1.34
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: ai
8
+ - @fe-free/core@4.1.34
9
+ - @fe-free/icons@4.1.34
10
+ - @fe-free/tool@4.1.34
11
+
12
+ ## 4.1.33
13
+
14
+ ### Patch Changes
15
+
16
+ - feat: ai
17
+ - @fe-free/core@4.1.33
18
+ - @fe-free/icons@4.1.33
19
+ - @fe-free/tool@4.1.33
20
+
3
21
  ## 4.1.32
4
22
 
5
23
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/ai",
3
- "version": "4.1.32",
3
+ "version": "4.1.34",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -19,7 +19,7 @@
19
19
  "lodash-es": "^4.17.21",
20
20
  "uuid": "^13.0.0",
21
21
  "zustand": "^4.5.7",
22
- "@fe-free/core": "4.1.32"
22
+ "@fe-free/core": "4.1.34"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "antd": "^5.27.1",
@@ -29,8 +29,8 @@
29
29
  "i18next-icu": "^2.4.1",
30
30
  "react": "^19.2.0",
31
31
  "react-i18next": "^16.4.0",
32
- "@fe-free/icons": "4.1.32",
33
- "@fe-free/tool": "4.1.32"
32
+ "@fe-free/icons": "4.1.34",
33
+ "@fe-free/tool": "4.1.34"
34
34
  },
35
35
  "scripts": {
36
36
  "test": "echo \"Error: no test specified\" && exit 1",
package/src/index.ts CHANGED
@@ -7,7 +7,7 @@ export { MSender } from './m_sender';
7
7
  export type { MSenderProps, MSenderRef } from './m_sender';
8
8
  export { CustomMarkdown, Markdown } from './markdown';
9
9
  export type { CustomMarkdownProps, MarkdownProps } from './markdown';
10
- export { MessageActions, MessageThink, Messages } from './messages';
10
+ export { MessageActions, MessageThink, MessageThinkOfDeepSeek, Messages } from './messages';
11
11
  export type { MessageThinkProps, MessagesProps } from './messages';
12
12
  export { Sender } from './sender';
13
13
  export type { SenderProps, SenderRef } from './sender';
@@ -1,10 +1,8 @@
1
1
  import { CodeHighlighter, Mermaid } from '@ant-design/x';
2
2
  import type { ComponentProps } from '@ant-design/x-markdown';
3
- import classNames from 'classnames';
4
3
  import { memo } from 'react';
5
4
  import { ChartBlock } from './chart';
6
5
  import { HMChartBlock } from './hm_chart';
7
- import { PartialHtml } from './partial_html';
8
6
 
9
7
  const CodeComponent = memo((props: ComponentProps) => {
10
8
  const { className, children } = props;
@@ -25,12 +23,6 @@ const CodeComponent = memo((props: ComponentProps) => {
25
23
  return <HMChartBlock>{children}</HMChartBlock>;
26
24
  }
27
25
 
28
- if (lang === 'pptpartialhtml') {
29
- return (
30
- <PartialHtml srcDoc={children} className={classNames('aspect-[16/9] w-full', className)} />
31
- );
32
- }
33
-
34
26
  return <CodeHighlighter lang={lang}>{children}</CodeHighlighter>;
35
27
  });
36
28
 
@@ -86,8 +86,9 @@ function CustomMarkdown(props: CustomMarkdownProps) {
86
86
  const { content: propsContent = '', knowledgeRefs, onKnowledgeRef } = props;
87
87
 
88
88
  const content = useMemo(() => {
89
- return processWithKnowledgeRef(compatibleWithDeepSeek(propsContent));
90
- }, [propsContent]);
89
+ const newContent = compatibleWithDeepSeek(propsContent);
90
+ return processWithKnowledgeRef(newContent, knowledgeRefs);
91
+ }, [propsContent, knowledgeRefs]);
91
92
 
92
93
  const KnowledgeRefComponent = useMemo(
93
94
  () => (p: any) => {
@@ -45,7 +45,7 @@ function processWithKnowledgeRef(text: string, knowledgeRefs?: { id: string }[])
45
45
  });
46
46
 
47
47
  if (count > 0 && knowledgeRefs && knowledgeRefs.length > 0) {
48
- newText = `${newText}\n\n<knowledge-ref>来源&gt;&gt;</knowledge>`;
48
+ newText = `${newText}\n\n<knowledge-ref>来源&gt;&gt;</knowledge-ref>`;
49
49
  }
50
50
 
51
51
  return newText;
@@ -57,7 +57,12 @@ function MessageThink({
57
57
  }
58
58
 
59
59
  function MessageThinkOfDeepSeek(props: MessageThinkProps) {
60
- return <MessageThink {...props} className="fea-message-think-deep-seek" />;
60
+ return (
61
+ <MessageThink
62
+ {...props}
63
+ className={classNames('fea-message-think-deep-seek', props.className)}
64
+ />
65
+ );
61
66
  }
62
67
 
63
68
  export { MessageThink, MessageThinkOfDeepSeek };
@@ -1,29 +0,0 @@
1
- import classNames from 'classnames';
2
- import { useEffect, useMemo, useRef } from 'react';
3
- import { completeHtml } from '../helper/complete';
4
-
5
- function PartialHtml({ srcDoc: propsSrcDoc, className }: { srcDoc: string; className?: string }) {
6
- const ref = useRef<HTMLIFrameElement>(null);
7
-
8
- const srcDoc = useMemo(() => {
9
- return completeHtml(propsSrcDoc);
10
- }, [propsSrcDoc]);
11
-
12
- useEffect(() => {
13
- if (ref.current?.contentDocument) {
14
- ref.current.contentDocument.open();
15
- ref.current.contentDocument.write(srcDoc);
16
- ref.current.contentDocument.close();
17
- }
18
- }, [srcDoc]);
19
-
20
- return (
21
- <iframe
22
- ref={ref}
23
- className={classNames('border border-01', className)}
24
- sandbox="allow-scripts allow-same-origin"
25
- />
26
- );
27
- }
28
-
29
- export { PartialHtml };