@fe-free/ai 6.0.18 → 6.0.20

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
+ ## 6.0.20
4
+
5
+ ### Patch Changes
6
+
7
+ - ai
8
+ - @fe-free/core@6.0.20
9
+ - @fe-free/icons@6.0.20
10
+ - @fe-free/tool@6.0.20
11
+
12
+ ## 6.0.19
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+ - @fe-free/core@6.0.19
18
+ - @fe-free/icons@6.0.19
19
+ - @fe-free/tool@6.0.19
20
+
3
21
  ## 6.0.18
4
22
 
5
23
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/ai",
3
- "version": "6.0.18",
3
+ "version": "6.0.20",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -17,7 +17,7 @@
17
17
  "lodash-es": "^4.17.21",
18
18
  "uuid": "^13.0.0",
19
19
  "zustand": "^4.5.7",
20
- "@fe-free/core": "6.0.18"
20
+ "@fe-free/core": "6.0.20"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "antd": "^6.2.1",
@@ -27,8 +27,8 @@
27
27
  "i18next-icu": "^2.4.1",
28
28
  "react": "^19.2.0",
29
29
  "react-i18next": "^16.4.0",
30
- "@fe-free/icons": "6.0.18",
31
- "@fe-free/tool": "6.0.18"
30
+ "@fe-free/icons": "6.0.20",
31
+ "@fe-free/tool": "6.0.20"
32
32
  },
33
33
  "scripts": {
34
34
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -1,6 +1,7 @@
1
1
  import { PageLayout } from '@fe-free/core';
2
2
 
3
3
  function Chat({
4
+ className,
4
5
  start,
5
6
  startClassName,
6
7
  end,
@@ -8,6 +9,7 @@ function Chat({
8
9
  children,
9
10
  childrenClassName,
10
11
  }: {
12
+ className?: string;
11
13
  start?: React.ReactNode;
12
14
  startClassName?: string;
13
15
  end?: React.ReactNode;
@@ -18,6 +20,7 @@ function Chat({
18
20
  return (
19
21
  <PageLayout
20
22
  direction="vertical"
23
+ className={className}
21
24
  start={start}
22
25
  startClassName={startClassName}
23
26
  end={end}
@@ -9,7 +9,12 @@ import {
9
9
  } from '@fe-free/icons';
10
10
  import { App, Button, Tooltip } from 'antd';
11
11
  import classNames from 'classnames';
12
- import { useCallback, useEffect, useState } from 'react';
12
+ import { type ReactNode, useCallback, useEffect, useState } from 'react';
13
+
14
+ type MessageActionIconProps = {
15
+ activeIcon?: ReactNode;
16
+ icon?: ReactNode;
17
+ };
13
18
 
14
19
  function MessageActionOfCopy({
15
20
  value,
@@ -51,11 +56,13 @@ function MessageActionOfLike({
51
56
  active: propsActive,
52
57
  onClick,
53
58
  className,
59
+ activeIcon,
60
+ icon,
54
61
  }: {
55
62
  active?: boolean;
56
63
  onClick?: (active: boolean) => Promise<void>;
57
64
  className?: string;
58
- }) {
65
+ } & MessageActionIconProps) {
59
66
  const { message } = App.useApp();
60
67
  const [active, setActive] = useState(propsActive || false);
61
68
 
@@ -76,7 +83,19 @@ function MessageActionOfLike({
76
83
  onClick={handleClick}
77
84
  size="small"
78
85
  className={classNames('text-03', className)}
79
- icon={active ? <LikeFilled /> : <LikeOutlined />}
86
+ icon={
87
+ active ? (
88
+ activeIcon !== undefined ? (
89
+ activeIcon
90
+ ) : (
91
+ <LikeFilled />
92
+ )
93
+ ) : icon !== undefined ? (
94
+ icon
95
+ ) : (
96
+ <LikeOutlined />
97
+ )
98
+ }
80
99
  />
81
100
  </Tooltip>
82
101
  );
@@ -86,11 +105,13 @@ function MessageActionOfDislike({
86
105
  active: propsActive,
87
106
  onClick,
88
107
  className,
108
+ activeIcon,
109
+ icon,
89
110
  }: {
90
111
  active?: boolean;
91
112
  onClick?: (active: boolean) => Promise<void>;
92
113
  className?: string;
93
- }) {
114
+ } & MessageActionIconProps) {
94
115
  const [active, setActive] = useState(propsActive || false);
95
116
  const { message } = App.useApp();
96
117
 
@@ -111,7 +132,19 @@ function MessageActionOfDislike({
111
132
  onClick={handleClick}
112
133
  size="small"
113
134
  className={classNames('text-03', className)}
114
- icon={active ? <DislikeFilled /> : <DislikeOutlined />}
135
+ icon={
136
+ active ? (
137
+ activeIcon !== undefined ? (
138
+ activeIcon
139
+ ) : (
140
+ <DislikeFilled />
141
+ )
142
+ ) : icon !== undefined ? (
143
+ icon
144
+ ) : (
145
+ <DislikeOutlined />
146
+ )
147
+ }
115
148
  />
116
149
  </Tooltip>
117
150
  );
@@ -121,10 +154,18 @@ function MessageActionOfLikeAndDislike({
121
154
  value: propsValue,
122
155
  onChange,
123
156
  className,
157
+ likeActiveIcon,
158
+ likeIcon,
159
+ dislikeActiveIcon,
160
+ dislikeIcon,
124
161
  }: {
125
162
  value?: -1 | 0 | 1;
126
163
  onChange?: (value: -1 | 0 | 1) => void;
127
164
  className?: string;
165
+ likeActiveIcon?: ReactNode;
166
+ likeIcon?: ReactNode;
167
+ dislikeActiveIcon?: ReactNode;
168
+ dislikeIcon?: ReactNode;
128
169
  }) {
129
170
  const [value, setValue] = useState<(-1 | 0 | 1) | undefined>(propsValue);
130
171
 
@@ -136,6 +177,8 @@ function MessageActionOfLikeAndDislike({
136
177
  <>
137
178
  <MessageActionOfLike
138
179
  active={value === 1}
180
+ activeIcon={likeActiveIcon}
181
+ icon={likeIcon}
139
182
  onClick={async () => {
140
183
  const newValue = value === 1 ? 0 : 1;
141
184
  await Promise.resolve(onChange?.(newValue));
@@ -145,6 +188,8 @@ function MessageActionOfLikeAndDislike({
145
188
  />
146
189
  <MessageActionOfDislike
147
190
  active={value === -1}
191
+ activeIcon={dislikeActiveIcon}
192
+ icon={dislikeIcon}
148
193
  onClick={async () => {
149
194
  const newValue = value === -1 ? 0 : -1;
150
195
  await Promise.resolve(onChange?.(newValue));