@alicloud/appflow-chat 0.0.4-alpha.3 → 0.0.4-alpha.5
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/appflow-chat.cjs.js +168 -189
- package/dist/appflow-chat.esm.js +11195 -15541
- package/package.json +3 -3
- package/src/components/MessageAttachments.tsx +13 -2
- package/src/components/MessageBubble.tsx +1 -0
- package/src/services/ChatService.ts +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alicloud/appflow-chat",
|
|
3
|
-
"version": "0.0.4-alpha.
|
|
3
|
+
"version": "0.0.4-alpha.5",
|
|
4
4
|
"description": "Appflow-Chat AI聊天机器人组件库,提供聊天服务和UI组件",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/appflow-chat.cjs.js",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"@fortawesome/react-fontawesome": "^0.2.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@ant-design/x": "^1.6.1",
|
|
44
43
|
"@eslint/js": "^9.13.0",
|
|
45
44
|
"@types/js-cookie": "^3.0.6",
|
|
46
45
|
"@types/lodash-es": "^4.17.12",
|
|
@@ -61,7 +60,8 @@
|
|
|
61
60
|
"peerDependencies": {
|
|
62
61
|
"antd": "^5.0.0",
|
|
63
62
|
"react": "^18.0.0",
|
|
64
|
-
"react-dom": "^18.0.0"
|
|
63
|
+
"react-dom": "^18.0.0",
|
|
64
|
+
"@ant-design/x": "1.6.1"
|
|
65
65
|
},
|
|
66
66
|
"files": [
|
|
67
67
|
"dist",
|
|
@@ -41,13 +41,23 @@ const ImageCard = styled.div<{ $role: 'user' | 'bot' }>`
|
|
|
41
41
|
display: inline-flex;
|
|
42
42
|
flex-direction: column;
|
|
43
43
|
gap: 6px;
|
|
44
|
-
max-width:
|
|
44
|
+
max-width: 180px;
|
|
45
45
|
color: #333;
|
|
46
46
|
|
|
47
47
|
.image-preview {
|
|
48
48
|
border-radius: 6px;
|
|
49
49
|
overflow: hidden;
|
|
50
50
|
cursor: pointer;
|
|
51
|
+
|
|
52
|
+
.ant-image {
|
|
53
|
+
display: block;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
img {
|
|
57
|
+
max-width: 100%;
|
|
58
|
+
height: auto;
|
|
59
|
+
display: block;
|
|
60
|
+
}
|
|
51
61
|
}
|
|
52
62
|
`;
|
|
53
63
|
|
|
@@ -67,7 +77,8 @@ const FileCard = styled.a<{ $role: 'user' | 'bot' }>`
|
|
|
67
77
|
text-decoration: none;
|
|
68
78
|
color: #333;
|
|
69
79
|
transition: background 0.2s;
|
|
70
|
-
max-width:
|
|
80
|
+
max-width: 100%;
|
|
81
|
+
box-sizing: border-box;
|
|
71
82
|
|
|
72
83
|
&:hover {
|
|
73
84
|
background: ${props => props.$role === 'user' ? '#e2e5ff' : '#d6ecf8'};
|
|
@@ -88,6 +88,7 @@ const StyledBubble = styled.div<{ $role: 'user' | 'bot' }>`
|
|
|
88
88
|
background: ${props => props.$role === 'user' ? '#e5effe' : 'rgba(205, 208, 220, 0.15)'};
|
|
89
89
|
color: '#333';
|
|
90
90
|
word-break: break-word;
|
|
91
|
+
overflow: hidden;
|
|
91
92
|
|
|
92
93
|
/* 样式隔离 */
|
|
93
94
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
@@ -270,16 +270,18 @@ class ChatService {
|
|
|
270
270
|
this.sendMessage(message, callbacks);
|
|
271
271
|
|
|
272
272
|
// 返回链式调用对象
|
|
273
|
-
|
|
273
|
+
const stream: ChatStream = {
|
|
274
274
|
onMessage: (callback) => {
|
|
275
275
|
callbacks.onMessage = callback;
|
|
276
|
-
return
|
|
276
|
+
return stream;
|
|
277
277
|
},
|
|
278
278
|
onError: (callback) => {
|
|
279
279
|
callbacks.onError = callback;
|
|
280
|
-
return
|
|
280
|
+
return stream;
|
|
281
281
|
}
|
|
282
282
|
};
|
|
283
|
+
|
|
284
|
+
return stream;
|
|
283
285
|
}
|
|
284
286
|
|
|
285
287
|
/**
|