@agentscope-ai/chat 1.1.45-beta.1766388936317 → 1.1.45-beta.1766389993910
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.
|
@@ -4,9 +4,9 @@ import { useProviderContext, ChatInput, uuid, Sender, Attachments } from '@agent
|
|
|
4
4
|
import cls from 'classnames';
|
|
5
5
|
import { useChatAnywhere } from '../hooks/ChatAnywhereProvider';
|
|
6
6
|
import { useInput } from '../hooks/useInput';
|
|
7
|
-
import {
|
|
7
|
+
import { GetProp, Space, Upload } from 'antd';
|
|
8
8
|
import Style from './style';
|
|
9
|
-
import { IconButton } from '@agentscope-ai/design';
|
|
9
|
+
import { IconButton, Button } from '@agentscope-ai/design';
|
|
10
10
|
import { AIGC } from '@agentscope-ai/chat';
|
|
11
11
|
import { PlusOutlined } from '@ant-design/icons';
|
|
12
12
|
|
|
@@ -91,6 +91,23 @@ export default forwardRef(function (_, ref) {
|
|
|
91
91
|
return [];
|
|
92
92
|
}
|
|
93
93
|
const nodes = onUpload.map((item, index) => {
|
|
94
|
+
|
|
95
|
+
let trigger;
|
|
96
|
+
|
|
97
|
+
if (item.trigger) {
|
|
98
|
+
trigger = item.trigger;
|
|
99
|
+
} else if (item.title || item.description) {
|
|
100
|
+
trigger = <Button type='text' icon={item.icon} >
|
|
101
|
+
{item.title && <span>{item.title}</span>}
|
|
102
|
+
{item.description && <span style={{ fontSize: '0.8em', opacity: 0.8 }}>{item.description}</span>}
|
|
103
|
+
</Button>
|
|
104
|
+
} else {
|
|
105
|
+
trigger = <IconButton
|
|
106
|
+
icon={item.icon}
|
|
107
|
+
bordered={false}
|
|
108
|
+
/>
|
|
109
|
+
}
|
|
110
|
+
|
|
94
111
|
return <Upload
|
|
95
112
|
{...item}
|
|
96
113
|
fileList={attachedFiles[index]}
|
|
@@ -107,10 +124,7 @@ export default forwardRef(function (_, ref) {
|
|
|
107
124
|
showUploadList={false}
|
|
108
125
|
>
|
|
109
126
|
{
|
|
110
|
-
|
|
111
|
-
icon={item.icon}
|
|
112
|
-
bordered={false}
|
|
113
|
-
/>
|
|
127
|
+
trigger
|
|
114
128
|
}
|
|
115
129
|
</Upload>
|
|
116
130
|
});
|
|
@@ -118,7 +132,7 @@ export default forwardRef(function (_, ref) {
|
|
|
118
132
|
if (nodes.length === 1) return nodes;
|
|
119
133
|
return <Popover content={<Flex vertical>
|
|
120
134
|
{nodes}
|
|
121
|
-
</Flex>} trigger="click">
|
|
135
|
+
</Flex>} trigger="click" styles={{ body: { padding: 4 } }}>
|
|
122
136
|
<IconButton
|
|
123
137
|
icon={<PlusOutlined />}
|
|
124
138
|
bordered={false}
|
|
@@ -25,13 +25,13 @@ import { useChatAnywhere } from "../hooks/ChatAnywhereProvider";
|
|
|
25
25
|
import { useInput } from "../hooks/useInput";
|
|
26
26
|
import { Upload } from 'antd';
|
|
27
27
|
import Style from "./style";
|
|
28
|
-
import { IconButton } from '@agentscope-ai/design';
|
|
28
|
+
import { IconButton, Button } from '@agentscope-ai/design';
|
|
29
29
|
import { AIGC } from "../..";
|
|
30
30
|
import { PlusOutlined } from "@agentscope-ai/icons-override-antd";
|
|
31
31
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
32
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
32
33
|
import { createElement as _createElement } from "react";
|
|
33
34
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
34
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
35
35
|
export default /*#__PURE__*/forwardRef(function (_, ref) {
|
|
36
36
|
var _React$useState = React.useState(''),
|
|
37
37
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -130,6 +130,29 @@ export default /*#__PURE__*/forwardRef(function (_, ref) {
|
|
|
130
130
|
return [];
|
|
131
131
|
}
|
|
132
132
|
var nodes = onUpload.map(function (item, index) {
|
|
133
|
+
var trigger;
|
|
134
|
+
if (item.trigger) {
|
|
135
|
+
trigger = item.trigger;
|
|
136
|
+
} else if (item.title || item.description) {
|
|
137
|
+
trigger = /*#__PURE__*/_jsxs(Button, {
|
|
138
|
+
type: "text",
|
|
139
|
+
icon: item.icon,
|
|
140
|
+
children: [item.title && /*#__PURE__*/_jsx("span", {
|
|
141
|
+
children: item.title
|
|
142
|
+
}), item.description && /*#__PURE__*/_jsx("span", {
|
|
143
|
+
style: {
|
|
144
|
+
fontSize: '0.8em',
|
|
145
|
+
opacity: 0.8
|
|
146
|
+
},
|
|
147
|
+
children: item.description
|
|
148
|
+
})]
|
|
149
|
+
});
|
|
150
|
+
} else {
|
|
151
|
+
trigger = /*#__PURE__*/_jsx(IconButton, {
|
|
152
|
+
icon: item.icon,
|
|
153
|
+
bordered: false
|
|
154
|
+
});
|
|
155
|
+
}
|
|
133
156
|
return /*#__PURE__*/_createElement(Upload, _objectSpread(_objectSpread({}, item), {}, {
|
|
134
157
|
fileList: attachedFiles[index],
|
|
135
158
|
key: index,
|
|
@@ -142,10 +165,7 @@ export default /*#__PURE__*/forwardRef(function (_, ref) {
|
|
|
142
165
|
}
|
|
143
166
|
},
|
|
144
167
|
showUploadList: false
|
|
145
|
-
}),
|
|
146
|
-
icon: item.icon,
|
|
147
|
-
bordered: false
|
|
148
|
-
}));
|
|
168
|
+
}), trigger);
|
|
149
169
|
});
|
|
150
170
|
if (nodes.length === 1) return nodes;
|
|
151
171
|
return /*#__PURE__*/_jsx(Popover, {
|
|
@@ -154,6 +174,11 @@ export default /*#__PURE__*/forwardRef(function (_, ref) {
|
|
|
154
174
|
children: nodes
|
|
155
175
|
}),
|
|
156
176
|
trigger: "click",
|
|
177
|
+
styles: {
|
|
178
|
+
body: {
|
|
179
|
+
padding: 4
|
|
180
|
+
}
|
|
181
|
+
},
|
|
157
182
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
158
183
|
icon: /*#__PURE__*/_jsx(PlusOutlined, {}),
|
|
159
184
|
bordered: false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentscope-ai/chat",
|
|
3
|
-
"version": "1.1.45-beta.
|
|
3
|
+
"version": "1.1.45-beta.1766389993910",
|
|
4
4
|
"description": "a free and open-source chat framework for building excellent LLM-powered chat experiences",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": [
|