vue-element-ui-x 1.0.41-beta → 1.0.43-beta
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/lib/components/Sender/index.js +1 -1
- package/lib/components/ThoughtChain/index.js +30 -30
- package/lib/index.common.js +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +774 -774
- package/lib/index.ssr.js +90 -0
- package/lib/index.umd.js +1 -1
- package/package.json +5 -5
- package/src/components/Attachments/index.js +0 -8
- package/src/components/Attachments/src/main.vue +0 -529
- package/src/components/Bubble/index.js +0 -6
- package/src/components/Bubble/src/main.vue +0 -288
- package/src/components/BubbleList/index.js +0 -8
- package/src/components/BubbleList/src/loading.vue +0 -75
- package/src/components/BubbleList/src/main.vue +0 -444
- package/src/components/Conversations/index.js +0 -8
- package/src/components/Conversations/src/components/item.vue +0 -350
- package/src/components/Conversations/src/main.vue +0 -587
- package/src/components/FilesCard/index.js +0 -8
- package/src/components/FilesCard/src/fileSvg/audio.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/changeFileName.bat +0 -18
- package/src/components/FilesCard/src/fileSvg/code.vue +0 -35
- package/src/components/FilesCard/src/fileSvg/database.vue +0 -94
- package/src/components/FilesCard/src/fileSvg/excel.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/file.vue +0 -40
- package/src/components/FilesCard/src/fileSvg/image.vue +0 -40
- package/src/components/FilesCard/src/fileSvg/index.js +0 -46
- package/src/components/FilesCard/src/fileSvg/link.vue +0 -54
- package/src/components/FilesCard/src/fileSvg/mark.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/pdf.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/ppt.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/three.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/txt.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/unknown.vue +0 -54
- package/src/components/FilesCard/src/fileSvg/video.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/word.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/zip.vue +0 -38
- package/src/components/FilesCard/src/main.vue +0 -403
- package/src/components/FilesCard/src/options.js +0 -18
- package/src/components/Prompts/index.js +0 -8
- package/src/components/Prompts/src/main.vue +0 -248
- package/src/components/Sender/index.js +0 -8
- package/src/components/Sender/src/components/ClearButton.vue +0 -28
- package/src/components/Sender/src/components/Loading.vue +0 -53
- package/src/components/Sender/src/components/LoadingButton.vue +0 -37
- package/src/components/Sender/src/components/SendButton.vue +0 -26
- package/src/components/Sender/src/components/SpeechButton.vue +0 -24
- package/src/components/Sender/src/components/SpeechLoading.vue +0 -87
- package/src/components/Sender/src/components/SpeechLoadingButton.vue +0 -41
- package/src/components/Sender/src/main.vue +0 -803
- package/src/components/Thinking/index.js +0 -8
- package/src/components/Thinking/src/main.vue +0 -199
- package/src/components/ThoughtChain/index.js +0 -8
- package/src/components/ThoughtChain/src/main.vue +0 -291
- package/src/components/Typewriter/index.js +0 -8
- package/src/components/Typewriter/src/main.vue +0 -255
- package/src/components/Welcome/index.js +0 -8
- package/src/components/Welcome/src/main.vue +0 -151
- package/src/index.js +0 -104
- package/src/locale/index.js +0 -97
- package/src/locale/lang/ar.js +0 -18
- package/src/locale/lang/de.js +0 -18
- package/src/locale/lang/en.js +0 -18
- package/src/locale/lang/es.js +0 -18
- package/src/locale/lang/fr.js +0 -18
- package/src/locale/lang/index.js +0 -62
- package/src/locale/lang/it.js +0 -18
- package/src/locale/lang/ja.js +0 -18
- package/src/locale/lang/ko.js +0 -18
- package/src/locale/lang/pt-br.js +0 -18
- package/src/locale/lang/ru-RU.js +0 -18
- package/src/locale/lang/zh-CN.js +0 -18
- package/src/locale/lang/zh-TW.js +0 -18
- package/src/locale/mixin.js +0 -9
- package/src/mixins/index.js +0 -49
- package/src/mixins/recordMixin.js +0 -117
- package/src/mixins/sendMixin.js +0 -450
- package/src/mixins/streamMixin.js +0 -497
- package/src/styles/Attachments.scss +0 -236
- package/src/styles/Bubble.scss +0 -158
- package/src/styles/BubbleList.scss +0 -148
- package/src/styles/Conversations.scss +0 -283
- package/src/styles/FilesCard.scss +0 -222
- package/src/styles/Prompts.scss +0 -197
- package/src/styles/Sender.scss +0 -207
- package/src/styles/Thinking.scss +0 -142
- package/src/styles/ThoughtChain.scss +0 -113
- package/src/styles/Typewriter.scss +0 -66
- package/src/styles/Welcome.scss +0 -283
- package/src/theme/var.scss +0 -183
- package/src/utils/index.js +0 -199
- package/src/utils/scrollDetector.js +0 -34
package/src/mixins/sendMixin.js
DELETED
|
@@ -1,450 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* XRequest 类 - 用于处理 SSE 和 Fetch 请求
|
|
3
|
-
*/
|
|
4
|
-
export class XRequest {
|
|
5
|
-
constructor(options = {}) {
|
|
6
|
-
const {
|
|
7
|
-
baseURL,
|
|
8
|
-
onAbort,
|
|
9
|
-
onMessage,
|
|
10
|
-
onError,
|
|
11
|
-
baseOptions,
|
|
12
|
-
transformer,
|
|
13
|
-
type,
|
|
14
|
-
onFinish,
|
|
15
|
-
onOpen,
|
|
16
|
-
} = options;
|
|
17
|
-
|
|
18
|
-
this._instance = null;
|
|
19
|
-
this._transformer = transformer;
|
|
20
|
-
this._baseURL = baseURL || '';
|
|
21
|
-
this._baseOptions = baseOptions || {};
|
|
22
|
-
this._onAbort = onAbort;
|
|
23
|
-
this._onMessage = onMessage;
|
|
24
|
-
this._onError = onError;
|
|
25
|
-
this._onOpen = onOpen;
|
|
26
|
-
this._type = type || 'sse';
|
|
27
|
-
this._controller = null;
|
|
28
|
-
this._onFinish = onFinish;
|
|
29
|
-
this._messages = [];
|
|
30
|
-
// 添加结束标志和超时控制
|
|
31
|
-
this._isFinished = false;
|
|
32
|
-
this._finishTimeout = null;
|
|
33
|
-
|
|
34
|
-
// 绑定方法上下文
|
|
35
|
-
this.abort = this.abort.bind(this);
|
|
36
|
-
this.send = this.send.bind(this);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
_sendWithFetch(url, options = {}) {
|
|
40
|
-
this._controller = new AbortController();
|
|
41
|
-
const signal = this._controller.signal;
|
|
42
|
-
const fetchOptions = {
|
|
43
|
-
...options,
|
|
44
|
-
signal,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// 用于存储跨 chunk 的不完整数据
|
|
48
|
-
let buffer = '';
|
|
49
|
-
|
|
50
|
-
return fetch(this._baseURL + url, fetchOptions)
|
|
51
|
-
.then(res => res.body)
|
|
52
|
-
.then(async body => {
|
|
53
|
-
if (!body) {
|
|
54
|
-
return Promise.reject(new Error('Response body is null in stream mode'));
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const reader = body.getReader();
|
|
58
|
-
const decoder = new TextDecoder('utf-8');
|
|
59
|
-
let done = false;
|
|
60
|
-
|
|
61
|
-
while (!done) {
|
|
62
|
-
const { value, done: streamDone } = await reader.read();
|
|
63
|
-
done = streamDone;
|
|
64
|
-
|
|
65
|
-
if (streamDone) {
|
|
66
|
-
// 处理缓冲区中剩余的数据
|
|
67
|
-
if (buffer.trim()) {
|
|
68
|
-
this.processBufferData(buffer);
|
|
69
|
-
}
|
|
70
|
-
this._onFinish && this._onFinish(this._messages);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (value) {
|
|
75
|
-
const chunk = decoder.decode(value, {
|
|
76
|
-
stream: true,
|
|
77
|
-
});
|
|
78
|
-
// console.log('chunk:', chunk);
|
|
79
|
-
// 将新数据添加到缓冲区
|
|
80
|
-
buffer += chunk;
|
|
81
|
-
|
|
82
|
-
// 处理缓冲区中的完整行
|
|
83
|
-
buffer = this.processBuffer(buffer);
|
|
84
|
-
// const chunkUse = chunk.startsWith('data: ') ? chunk.slice(6) : chunk;
|
|
85
|
-
|
|
86
|
-
// try {
|
|
87
|
-
// const res = this._transformer ? this._transformer(chunkUse) : chunkUse;
|
|
88
|
-
// this._messages.push(res);
|
|
89
|
-
// this._onMessage && this._onMessage(res);
|
|
90
|
-
// } catch (error) {
|
|
91
|
-
// this._onError && this._onError(error);
|
|
92
|
-
// this._controller && this._controller.abort();
|
|
93
|
-
// return Promise.reject(error);
|
|
94
|
-
// }
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
})
|
|
98
|
-
.catch(err => {
|
|
99
|
-
if (err.name === 'AbortError') {
|
|
100
|
-
this._onAbort && this._onAbort(this._messages);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
this._onError && this._onError(err);
|
|
104
|
-
this._controller && this._controller.abort();
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* 处理缓冲区数据,提取完整的行
|
|
109
|
-
* @param {string} buffer - 缓冲区数据
|
|
110
|
-
* @returns {string} 剩余的不完整数据
|
|
111
|
-
*/
|
|
112
|
-
processBuffer(buffer) {
|
|
113
|
-
const lines = buffer.split('\n');
|
|
114
|
-
// console.log('lines:', lines);
|
|
115
|
-
// 保留最后一行(可能不完整)
|
|
116
|
-
const remainingData = lines.pop();
|
|
117
|
-
|
|
118
|
-
// 处理完整的行
|
|
119
|
-
for (const line of lines) {
|
|
120
|
-
this.processLine(line);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return remainingData || '';
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* 处理单行数据
|
|
128
|
-
* @param {string} line - 单行数据
|
|
129
|
-
*/
|
|
130
|
-
processLine(line) {
|
|
131
|
-
// 跳过空行
|
|
132
|
-
if (!line.trim()) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// 处理 data: 开头的行
|
|
137
|
-
if (line.startsWith('data: ')) {
|
|
138
|
-
const dataContent = line.slice(6);
|
|
139
|
-
|
|
140
|
-
// 检查是否是结束标识
|
|
141
|
-
if (dataContent.trim() === '[DONE]') {
|
|
142
|
-
this._isFinished = true;
|
|
143
|
-
this._onFinish && this._onFinish(this._messages);
|
|
144
|
-
this.abort();
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// 跳过空数据
|
|
149
|
-
if (!dataContent.trim()) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
try {
|
|
154
|
-
// 尝试解析和处理数据
|
|
155
|
-
let processedData;
|
|
156
|
-
try {
|
|
157
|
-
// 首先尝试作为 JSON 解析
|
|
158
|
-
processedData = JSON.parse(dataContent);
|
|
159
|
-
} catch {
|
|
160
|
-
// 如果不是 JSON,使用原始数据
|
|
161
|
-
processedData = dataContent;
|
|
162
|
-
}
|
|
163
|
-
// console.log('processedData:', processedData, processedData.answer);
|
|
164
|
-
|
|
165
|
-
const res = this._transformer ? this._transformer(processedData) : processedData;
|
|
166
|
-
this._messages.push(res);
|
|
167
|
-
this._onMessage && this._onMessage(res);
|
|
168
|
-
} catch (error) {
|
|
169
|
-
console.error('Error processing line:', line, error);
|
|
170
|
-
this._onError && this._onError(error);
|
|
171
|
-
this._controller && this._controller.abort();
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
// 可以在这里处理其他类型的行(如果需要)
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* 处理缓冲区中剩余的数据(在流结束时调用)
|
|
179
|
-
* @param {string} buffer - 剩余的缓冲区数据
|
|
180
|
-
*/
|
|
181
|
-
processBufferData(buffer) {
|
|
182
|
-
const lines = buffer.split('\n');
|
|
183
|
-
for (const line of lines) {
|
|
184
|
-
this.processLine(line);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
_sendWithSSE(url, options = {}) {
|
|
189
|
-
const es = new EventSource(this._baseURL + url, {
|
|
190
|
-
...this._baseOptions,
|
|
191
|
-
...options,
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
es.onmessage = e => {
|
|
195
|
-
// 检查是否是结束消息
|
|
196
|
-
if (e.data === '[DONE]' || e.data === 'data: [DONE]') {
|
|
197
|
-
this._isFinished = true;
|
|
198
|
-
this._onFinish && this._onFinish(this._messages);
|
|
199
|
-
this.abort();
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
const res = this._transformer ? this._transformer(e.data) : e;
|
|
204
|
-
this._messages.push(res);
|
|
205
|
-
this._onMessage && this._onMessage(res);
|
|
206
|
-
|
|
207
|
-
// 重置超时定时器
|
|
208
|
-
if (this._finishTimeout) {
|
|
209
|
-
clearTimeout(this._finishTimeout);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// 设置超时检测:如果 10 秒内没有新消息,认为连接可能已结束
|
|
213
|
-
this._finishTimeout = setTimeout(() => {
|
|
214
|
-
if (!this._isFinished && es.readyState !== EventSource.CONNECTING) {
|
|
215
|
-
this._isFinished = true;
|
|
216
|
-
this._onFinish && this._onFinish(this._messages);
|
|
217
|
-
this.abort();
|
|
218
|
-
}
|
|
219
|
-
}, 10000);
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
es.onopen = () => {
|
|
223
|
-
this._onOpen && this._onOpen();
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
es.onerror = ev => {
|
|
227
|
-
// 清除超时定时器
|
|
228
|
-
if (this._finishTimeout) {
|
|
229
|
-
clearTimeout(this._finishTimeout);
|
|
230
|
-
this._finishTimeout = null;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// 如果已经标记为结束,直接返回
|
|
234
|
-
if (this._isFinished) {
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// 更可靠的结束检测逻辑
|
|
239
|
-
if (
|
|
240
|
-
es.readyState === EventSource.CLOSED ||
|
|
241
|
-
(this._messages.length > 0 && es.readyState !== EventSource.CONNECTING)
|
|
242
|
-
) {
|
|
243
|
-
// 有消息且连接状态不是正在连接,很可能是正常结束
|
|
244
|
-
this._isFinished = true;
|
|
245
|
-
this._onFinish && this._onFinish(this._messages);
|
|
246
|
-
} else {
|
|
247
|
-
// 真正的错误情况
|
|
248
|
-
this._onError && this._onError(es, ev);
|
|
249
|
-
}
|
|
250
|
-
this.abort();
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
this._instance = es;
|
|
254
|
-
return es;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
send(url, options = {}) {
|
|
258
|
-
switch (this._type) {
|
|
259
|
-
case 'fetch':
|
|
260
|
-
this._sendWithFetch(url, options);
|
|
261
|
-
break;
|
|
262
|
-
default:
|
|
263
|
-
this._sendWithSSE(url, options);
|
|
264
|
-
}
|
|
265
|
-
return this;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
abort() {
|
|
269
|
-
// 清除超时定时器
|
|
270
|
-
if (this._finishTimeout) {
|
|
271
|
-
clearTimeout(this._finishTimeout);
|
|
272
|
-
this._finishTimeout = null;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
if (this._instance && this._instance.close) {
|
|
276
|
-
this._instance.close();
|
|
277
|
-
}
|
|
278
|
-
this._instance = null;
|
|
279
|
-
|
|
280
|
-
if (this._controller) {
|
|
281
|
-
this._controller.abort();
|
|
282
|
-
}
|
|
283
|
-
this._controller = null;
|
|
284
|
-
|
|
285
|
-
// 只有在未正常结束时才调用 onAbort
|
|
286
|
-
if (!this._isFinished) {
|
|
287
|
-
this._onAbort && this._onAbort(this._messages);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
this._messages = [];
|
|
291
|
-
this._isFinished = false;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* sendMixin -
|
|
297
|
-
* 用于处理发送操作管理请求状态的 mixin,支持可选的中止功能,同时支持 Promise 和 SSE(服务端事件)
|
|
298
|
-
*/
|
|
299
|
-
export const sendMixin = {
|
|
300
|
-
data() {
|
|
301
|
-
return {
|
|
302
|
-
loading: false,
|
|
303
|
-
_sendPromise: null,
|
|
304
|
-
_sendController: null,
|
|
305
|
-
};
|
|
306
|
-
},
|
|
307
|
-
|
|
308
|
-
methods: {
|
|
309
|
-
/**
|
|
310
|
-
* 初始化发送配置
|
|
311
|
-
* @param {Object} options - 配置选项
|
|
312
|
-
* @param {Function} options.onAbort - 中止回调
|
|
313
|
-
* @param {Function} options.sendHandler - 发送处理器
|
|
314
|
-
* @param {Function} options.abortHandler - 中止处理器
|
|
315
|
-
* @param {Function} options.finishHandler - 完成处理器
|
|
316
|
-
*/
|
|
317
|
-
initSend(options = {}) {
|
|
318
|
-
this._sendOptions = {
|
|
319
|
-
onAbort: options.onAbort,
|
|
320
|
-
sendHandler: options.sendHandler,
|
|
321
|
-
abortHandler: options.abortHandler,
|
|
322
|
-
finishHandler: options.finishHandler,
|
|
323
|
-
};
|
|
324
|
-
},
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* 发送操作
|
|
328
|
-
* @param {...any} args - 传递给 sendHandler 的参数
|
|
329
|
-
*/
|
|
330
|
-
handleSend(...args) {
|
|
331
|
-
if (this.loading) {
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
if (this._sendOptions && this._sendOptions.sendHandler) {
|
|
336
|
-
this._sendOptions.sendHandler(...args);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
this.loading = true;
|
|
340
|
-
},
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* 中止操作
|
|
344
|
-
*/
|
|
345
|
-
handleAbort() {
|
|
346
|
-
this.loading = false;
|
|
347
|
-
|
|
348
|
-
if (this._sendOptions && this._sendOptions.abortHandler) {
|
|
349
|
-
this._sendOptions.abortHandler();
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
if (this._sendOptions && this._sendOptions.onAbort) {
|
|
353
|
-
this._sendOptions.onAbort();
|
|
354
|
-
}
|
|
355
|
-
},
|
|
356
|
-
|
|
357
|
-
/**
|
|
358
|
-
* 完成操作
|
|
359
|
-
*/
|
|
360
|
-
handleFinish() {
|
|
361
|
-
this.loading = false;
|
|
362
|
-
|
|
363
|
-
if (this._sendOptions && this._sendOptions.finishHandler) {
|
|
364
|
-
this._sendOptions.finishHandler();
|
|
365
|
-
}
|
|
366
|
-
},
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* 创建 XRequest 实例的便捷方法
|
|
370
|
-
* @param {Object} options - XRequest 配置选项
|
|
371
|
-
* @returns {XRequest} XRequest 实例
|
|
372
|
-
*/
|
|
373
|
-
createXRequest(options = {}) {
|
|
374
|
-
return new XRequest({
|
|
375
|
-
...options,
|
|
376
|
-
onAbort: (...args) => {
|
|
377
|
-
this.handleAbort();
|
|
378
|
-
if (options.onAbort) {
|
|
379
|
-
options.onAbort(...args);
|
|
380
|
-
}
|
|
381
|
-
},
|
|
382
|
-
onFinish: (...args) => {
|
|
383
|
-
this.handleFinish();
|
|
384
|
-
if (options.onFinish) {
|
|
385
|
-
options.onFinish(...args);
|
|
386
|
-
}
|
|
387
|
-
},
|
|
388
|
-
});
|
|
389
|
-
},
|
|
390
|
-
},
|
|
391
|
-
|
|
392
|
-
beforeDestroy() {
|
|
393
|
-
// 组件销毁时清理资源
|
|
394
|
-
if (this._sendController) {
|
|
395
|
-
this._sendController.abort();
|
|
396
|
-
}
|
|
397
|
-
},
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* 工具函数版本 - 用于非组件场景
|
|
402
|
-
* @param {Object} options - 配置选项
|
|
403
|
-
* @returns {Object} 包含发送相关方法的对象
|
|
404
|
-
*/
|
|
405
|
-
export function createSendUtils(options = {}) {
|
|
406
|
-
const state = {
|
|
407
|
-
loading: false,
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
const handleSend = (...args) => {
|
|
411
|
-
if (state.loading) {
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
if (options.sendHandler) {
|
|
416
|
-
options.sendHandler(...args);
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
state.loading = true;
|
|
420
|
-
};
|
|
421
|
-
|
|
422
|
-
const handleAbort = () => {
|
|
423
|
-
state.loading = false;
|
|
424
|
-
|
|
425
|
-
if (options.abortHandler) {
|
|
426
|
-
options.abortHandler();
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
if (options.onAbort) {
|
|
430
|
-
options.onAbort();
|
|
431
|
-
}
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
const handleFinish = () => {
|
|
435
|
-
state.loading = false;
|
|
436
|
-
|
|
437
|
-
if (options.finishHandler) {
|
|
438
|
-
options.finishHandler();
|
|
439
|
-
}
|
|
440
|
-
};
|
|
441
|
-
|
|
442
|
-
return {
|
|
443
|
-
state,
|
|
444
|
-
send: handleSend,
|
|
445
|
-
abort: handleAbort,
|
|
446
|
-
finish: handleFinish,
|
|
447
|
-
};
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
export default sendMixin;
|