@microsoft/agents-hosting 1.1.4-geb1c05c291 → 1.2.0-alpha.19.g21cf68366a
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/package.json +4 -4
- package/dist/src/activityHandler.js +7 -4
- package/dist/src/activityHandler.js.map +1 -1
- package/dist/src/app/index.d.ts +1 -0
- package/dist/src/app/index.js +1 -0
- package/dist/src/app/index.js.map +1 -1
- package/dist/src/app/streaming/streamingResponse.d.ts +138 -88
- package/dist/src/app/streaming/streamingResponse.js +241 -107
- package/dist/src/app/streaming/streamingResponse.js.map +1 -1
- package/dist/src/app/teamsAttachmentDownloader.d.ts +36 -0
- package/dist/src/app/teamsAttachmentDownloader.js +103 -0
- package/dist/src/app/teamsAttachmentDownloader.js.map +1 -0
- package/dist/src/auth/authConfiguration.d.ts +6 -0
- package/dist/src/auth/authConfiguration.js +15 -9
- package/dist/src/auth/authConfiguration.js.map +1 -1
- package/dist/src/auth/authProvider.d.ts +7 -1
- package/dist/src/auth/msalTokenProvider.d.ts +7 -1
- package/dist/src/auth/msalTokenProvider.js +48 -3
- package/dist/src/auth/msalTokenProvider.js.map +1 -1
- package/dist/src/cloudAdapter.d.ts +39 -14
- package/dist/src/cloudAdapter.js +52 -26
- package/dist/src/cloudAdapter.js.map +1 -1
- package/dist/src/connector-client/connectorClient.js +10 -9
- package/dist/src/connector-client/connectorClient.js.map +1 -1
- package/dist/src/errorHelper.d.ts +4 -0
- package/dist/src/errorHelper.js +588 -0
- package/dist/src/errorHelper.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +3 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/oauth/userTokenClient.js.map +1 -1
- package/package.json +4 -4
- package/src/activityHandler.ts +8 -5
- package/src/app/index.ts +1 -0
- package/src/app/streaming/streamingResponse.ts +252 -107
- package/src/app/teamsAttachmentDownloader.ts +110 -0
- package/src/auth/authConfiguration.ts +13 -2
- package/src/auth/authProvider.ts +8 -1
- package/src/auth/msalTokenProvider.ts +62 -3
- package/src/cloudAdapter.ts +56 -29
- package/src/connector-client/connectorClient.ts +11 -10
- package/src/errorHelper.ts +674 -0
- package/src/index.ts +1 -0
- package/src/oauth/userTokenClient.ts +2 -2
|
@@ -4,11 +4,33 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.StreamingResponse = void 0;
|
|
7
|
+
exports.StreamingResponse = exports.StreamingResponseResult = void 0;
|
|
8
8
|
const agents_activity_1 = require("@microsoft/agents-activity");
|
|
9
9
|
const citationUtil_1 = require("./citationUtil");
|
|
10
10
|
const logger_1 = require("@microsoft/agents-activity/logger");
|
|
11
11
|
const logger = (0, logger_1.debug)('agents:streamingResponse');
|
|
12
|
+
/**
|
|
13
|
+
* Results for streaming response operations.
|
|
14
|
+
*/
|
|
15
|
+
var StreamingResponseResult;
|
|
16
|
+
(function (StreamingResponseResult) {
|
|
17
|
+
/**
|
|
18
|
+
* The operation was successful.
|
|
19
|
+
*/
|
|
20
|
+
StreamingResponseResult["Success"] = "success";
|
|
21
|
+
/**
|
|
22
|
+
* The stream has already ended.
|
|
23
|
+
*/
|
|
24
|
+
StreamingResponseResult["AlreadyEnded"] = "alreadyEnded";
|
|
25
|
+
/**
|
|
26
|
+
* The user canceled the streaming response.
|
|
27
|
+
*/
|
|
28
|
+
StreamingResponseResult["UserCanceled"] = "userCanceled";
|
|
29
|
+
/**
|
|
30
|
+
* An error occurred during the streaming response.
|
|
31
|
+
*/
|
|
32
|
+
StreamingResponseResult["Error"] = "error";
|
|
33
|
+
})(StreamingResponseResult || (exports.StreamingResponseResult = StreamingResponseResult = {}));
|
|
12
34
|
/**
|
|
13
35
|
* A helper class for streaming responses to the client.
|
|
14
36
|
*
|
|
@@ -22,16 +44,19 @@ const logger = (0, logger_1.debug)('agents:streamingResponse');
|
|
|
22
44
|
*/
|
|
23
45
|
class StreamingResponse {
|
|
24
46
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
47
|
+
* Creates a new StreamingResponse instance.
|
|
48
|
+
*
|
|
49
|
+
* @param {TurnContext} context - Context for the current turn of conversation with the user.
|
|
50
|
+
* @returns {TurnContext} - The context for the current turn of conversation with the user.
|
|
51
|
+
*/
|
|
30
52
|
constructor(context) {
|
|
31
53
|
this._nextSequence = 1;
|
|
32
54
|
this._message = '';
|
|
33
55
|
this._ended = false;
|
|
34
|
-
this._delayInMs =
|
|
56
|
+
this._delayInMs = 250;
|
|
57
|
+
this._isStreamingChannel = true;
|
|
58
|
+
this._canceled = false;
|
|
59
|
+
this._userCanceled = false;
|
|
35
60
|
// Queue for outgoing activities
|
|
36
61
|
this._queue = [];
|
|
37
62
|
this._chunkQueued = false;
|
|
@@ -40,15 +65,16 @@ class StreamingResponse {
|
|
|
40
65
|
this._enableGeneratedByAILabel = false;
|
|
41
66
|
this._citations = [];
|
|
42
67
|
this._context = context;
|
|
68
|
+
this.loadDefaults(context.activity);
|
|
43
69
|
}
|
|
44
70
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
71
|
+
* Gets the stream ID of the current response.
|
|
72
|
+
*
|
|
73
|
+
* @returns {string | undefined} - The stream ID of the current response.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* Assigned after the initial update is sent.
|
|
77
|
+
*/
|
|
52
78
|
get streamId() {
|
|
53
79
|
return this._streamId;
|
|
54
80
|
}
|
|
@@ -59,25 +85,38 @@ class StreamingResponse {
|
|
|
59
85
|
return this._citations;
|
|
60
86
|
}
|
|
61
87
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
88
|
+
* Gets the number of updates sent for the stream.
|
|
89
|
+
*
|
|
90
|
+
* @returns {number} - The number of updates sent for the stream.
|
|
91
|
+
*/
|
|
66
92
|
get updatesSent() {
|
|
67
93
|
return this._nextSequence - 1;
|
|
68
94
|
}
|
|
69
95
|
/**
|
|
70
96
|
* Gets the delay in milliseconds between chunks.
|
|
97
|
+
* @remarks
|
|
98
|
+
* Teams default: 1000 ms
|
|
99
|
+
* Web Chat / Direct Line default: 500 ms
|
|
100
|
+
* Other channels: 250 ms
|
|
71
101
|
*/
|
|
72
102
|
get delayInMs() {
|
|
73
103
|
return this._delayInMs;
|
|
74
104
|
}
|
|
75
105
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
106
|
+
* Gets whether the channel supports streaming.
|
|
107
|
+
*/
|
|
108
|
+
get isStreamingChannel() {
|
|
109
|
+
return this._isStreamingChannel;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Queues an informative update to be sent to the client.
|
|
113
|
+
*
|
|
114
|
+
* @param {string} text Text of the update to send.
|
|
115
|
+
*/
|
|
80
116
|
queueInformativeUpdate(text) {
|
|
117
|
+
if (!this.isStreamingChannel || !text.trim() || this._canceled) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
81
120
|
if (this._ended) {
|
|
82
121
|
throw new Error('The stream has already ended.');
|
|
83
122
|
}
|
|
@@ -93,17 +132,20 @@ class StreamingResponse {
|
|
|
93
132
|
}));
|
|
94
133
|
}
|
|
95
134
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
135
|
+
* Queues a chunk of partial message text to be sent to the client
|
|
136
|
+
*
|
|
137
|
+
* @param {string} text Partial text of the message to send.
|
|
138
|
+
* @param {Citation[]} citations Citations to be included in the message.
|
|
139
|
+
*
|
|
140
|
+
* @remarks
|
|
141
|
+
* The text we be sent as quickly as possible to the client. Chunks may be combined before
|
|
142
|
+
* delivery to the client.
|
|
143
|
+
*
|
|
144
|
+
*/
|
|
106
145
|
queueTextChunk(text, citations) {
|
|
146
|
+
if (!text.trim() || this._canceled) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
107
149
|
if (this._ended) {
|
|
108
150
|
throw new Error('The stream has already ended.');
|
|
109
151
|
}
|
|
@@ -111,45 +153,79 @@ class StreamingResponse {
|
|
|
111
153
|
this._message += text;
|
|
112
154
|
// If there are citations, modify the content so that the sources are numbers instead of [doc1], [doc2], etc.
|
|
113
155
|
this._message = citationUtil_1.CitationUtil.formatCitationsResponse(this._message);
|
|
156
|
+
if (!this.isStreamingChannel) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
114
159
|
// Queue the next chunk
|
|
115
160
|
this.queueNextChunk();
|
|
116
161
|
}
|
|
117
162
|
/**
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
endStream() {
|
|
163
|
+
* Ends the stream by sending the final message to the client.
|
|
164
|
+
*
|
|
165
|
+
* @returns {Promise<StreamingResponseResult>} - StreamingResponseResult with the result of the streaming response.
|
|
166
|
+
*/
|
|
167
|
+
async endStream() {
|
|
123
168
|
if (this._ended) {
|
|
124
|
-
|
|
169
|
+
return StreamingResponseResult.AlreadyEnded;
|
|
170
|
+
}
|
|
171
|
+
if (this._canceled) {
|
|
172
|
+
return this._userCanceled ? StreamingResponseResult.UserCanceled : StreamingResponseResult.Error;
|
|
125
173
|
}
|
|
126
174
|
// Queue final message
|
|
127
175
|
this._ended = true;
|
|
176
|
+
if (!this.isStreamingChannel) {
|
|
177
|
+
await this.sendActivity(this.createFinalMessage());
|
|
178
|
+
return StreamingResponseResult.Success;
|
|
179
|
+
}
|
|
180
|
+
// Queue final message
|
|
128
181
|
this.queueNextChunk();
|
|
129
182
|
// Wait for the queue to drain
|
|
130
|
-
|
|
183
|
+
await this.waitForQueue();
|
|
184
|
+
return StreamingResponseResult.Success;
|
|
131
185
|
}
|
|
132
186
|
/**
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
187
|
+
* Resets the streaming response to its initial state.
|
|
188
|
+
* If the stream is still running, this will wait for completion.
|
|
189
|
+
*/
|
|
190
|
+
async reset() {
|
|
191
|
+
await this.waitForQueue();
|
|
192
|
+
this._queueSync = undefined;
|
|
193
|
+
this._queue = [];
|
|
194
|
+
this._chunkQueued = false;
|
|
195
|
+
this._ended = false;
|
|
196
|
+
this._canceled = false;
|
|
197
|
+
this._userCanceled = false;
|
|
198
|
+
this._message = '';
|
|
199
|
+
this._nextSequence = 1;
|
|
200
|
+
this._streamId = undefined;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Set Activity that will be (optionally) used for the final streaming message.
|
|
204
|
+
*/
|
|
205
|
+
setFinalMessage(activity) {
|
|
206
|
+
this._finalMessage = activity;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Sets the attachments to attach to the final chunk.
|
|
210
|
+
*
|
|
211
|
+
* @param attachments List of attachments.
|
|
212
|
+
*/
|
|
137
213
|
setAttachments(attachments) {
|
|
138
214
|
this._attachments = attachments;
|
|
139
215
|
}
|
|
140
216
|
/**
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
217
|
+
* Sets the sensitivity label to attach to the final chunk.
|
|
218
|
+
*
|
|
219
|
+
* @param sensitivityLabel The sensitivty label.
|
|
220
|
+
*/
|
|
145
221
|
setSensitivityLabel(sensitivityLabel) {
|
|
146
222
|
this._sensitivityLabel = sensitivityLabel;
|
|
147
223
|
}
|
|
148
224
|
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
225
|
+
* Sets the citations for the full message.
|
|
226
|
+
*
|
|
227
|
+
* @param {Citation[]} citations Citations to be included in the message.
|
|
228
|
+
*/
|
|
153
229
|
setCitations(citations) {
|
|
154
230
|
if (citations.length > 0) {
|
|
155
231
|
if (!this._citations) {
|
|
@@ -173,29 +249,29 @@ class StreamingResponse {
|
|
|
173
249
|
}
|
|
174
250
|
}
|
|
175
251
|
/**
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
252
|
+
* Sets the Feedback Loop in Teams that allows a user to
|
|
253
|
+
* give thumbs up or down to a response.
|
|
254
|
+
* Default is `false`.
|
|
255
|
+
*
|
|
256
|
+
* @param enableFeedbackLoop If true, the feedback loop is enabled.
|
|
257
|
+
*/
|
|
182
258
|
setFeedbackLoop(enableFeedbackLoop) {
|
|
183
259
|
this._enableFeedbackLoop = enableFeedbackLoop;
|
|
184
260
|
}
|
|
185
261
|
/**
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
262
|
+
* Sets the type of UI to use for the feedback loop.
|
|
263
|
+
*
|
|
264
|
+
* @param feedbackLoopType The type of the feedback loop.
|
|
265
|
+
*/
|
|
190
266
|
setFeedbackLoopType(feedbackLoopType) {
|
|
191
267
|
this._feedbackLoopType = feedbackLoopType;
|
|
192
268
|
}
|
|
193
269
|
/**
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
270
|
+
* Sets the the Generated by AI label in Teams
|
|
271
|
+
* Default is `false`.
|
|
272
|
+
*
|
|
273
|
+
* @param enableGeneratedByAILabel If true, the label is added.
|
|
274
|
+
*/
|
|
199
275
|
setGeneratedByAILabel(enableGeneratedByAILabel) {
|
|
200
276
|
this._enableGeneratedByAILabel = enableGeneratedByAILabel;
|
|
201
277
|
}
|
|
@@ -207,26 +283,26 @@ class StreamingResponse {
|
|
|
207
283
|
this._delayInMs = delayInMs;
|
|
208
284
|
}
|
|
209
285
|
/**
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
286
|
+
* Returns the most recently streamed message.
|
|
287
|
+
*
|
|
288
|
+
* @returns The streamed message.
|
|
289
|
+
*/
|
|
214
290
|
getMessage() {
|
|
215
291
|
return this._message;
|
|
216
292
|
}
|
|
217
293
|
/**
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
294
|
+
* Waits for the outgoing activity queue to be empty.
|
|
295
|
+
*
|
|
296
|
+
* @returns {Promise<void>} - A promise representing the async operation.
|
|
297
|
+
*/
|
|
222
298
|
waitForQueue() {
|
|
223
299
|
return this._queueSync || Promise.resolve();
|
|
224
300
|
}
|
|
225
301
|
/**
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
302
|
+
* Queues the next chunk of text to be sent to the client.
|
|
303
|
+
*
|
|
304
|
+
* @private
|
|
305
|
+
*/
|
|
230
306
|
queueNextChunk() {
|
|
231
307
|
// Are we already waiting to send a chunk?
|
|
232
308
|
if (this._chunkQueued) {
|
|
@@ -238,16 +314,7 @@ class StreamingResponse {
|
|
|
238
314
|
this._chunkQueued = false;
|
|
239
315
|
if (this._ended) {
|
|
240
316
|
// Send final message
|
|
241
|
-
return
|
|
242
|
-
type: 'message',
|
|
243
|
-
text: this._message || 'end of stream response',
|
|
244
|
-
attachments: this._attachments,
|
|
245
|
-
entities: [{
|
|
246
|
-
type: 'streaminfo',
|
|
247
|
-
streamType: 'final',
|
|
248
|
-
streamSequence: this._nextSequence++
|
|
249
|
-
}]
|
|
250
|
-
});
|
|
317
|
+
return this.createFinalMessage();
|
|
251
318
|
}
|
|
252
319
|
else {
|
|
253
320
|
// Send typing activity
|
|
@@ -264,8 +331,8 @@ class StreamingResponse {
|
|
|
264
331
|
});
|
|
265
332
|
}
|
|
266
333
|
/**
|
|
267
|
-
|
|
268
|
-
|
|
334
|
+
* Queues an activity to be sent to the client.
|
|
335
|
+
*/
|
|
269
336
|
queueActivity(factory) {
|
|
270
337
|
this._queue.push(factory);
|
|
271
338
|
// If there's no sync in progress, start one
|
|
@@ -277,11 +344,11 @@ class StreamingResponse {
|
|
|
277
344
|
}
|
|
278
345
|
}
|
|
279
346
|
/**
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
347
|
+
* Sends any queued activities to the client until the queue is empty.
|
|
348
|
+
*
|
|
349
|
+
* @returns {Promise<void>} - A promise that will be resolved once the queue is empty.
|
|
350
|
+
* @private
|
|
351
|
+
*/
|
|
285
352
|
async drainQueue() {
|
|
286
353
|
// eslint-disable-next-line no-async-promise-executor
|
|
287
354
|
return new Promise(async (resolve, reject) => {
|
|
@@ -303,12 +370,34 @@ class StreamingResponse {
|
|
|
303
370
|
});
|
|
304
371
|
}
|
|
305
372
|
/**
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
373
|
+
* Creates the final message to be sent at the end of the stream.
|
|
374
|
+
*/
|
|
375
|
+
createFinalMessage() {
|
|
376
|
+
var _a, _b;
|
|
377
|
+
const activity = (_a = this._finalMessage) !== null && _a !== void 0 ? _a : new agents_activity_1.Activity('message');
|
|
378
|
+
activity.type = 'message';
|
|
379
|
+
if (!this._finalMessage) {
|
|
380
|
+
activity.text = this._message || 'end of stream response';
|
|
381
|
+
}
|
|
382
|
+
(_b = activity.entities) !== null && _b !== void 0 ? _b : (activity.entities = []);
|
|
383
|
+
activity.attachments = this._attachments;
|
|
384
|
+
this._nextSequence++; // Increment sequence for final message, even if not streaming.
|
|
385
|
+
if (this.isStreamingChannel) {
|
|
386
|
+
activity.entities.push({
|
|
387
|
+
type: 'streaminfo',
|
|
388
|
+
streamType: 'final',
|
|
389
|
+
streamSequence: this._nextSequence
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
return activity;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Sends an activity to the client and saves the stream ID returned.
|
|
396
|
+
*
|
|
397
|
+
* @param {Activity} activity - The activity to send.
|
|
398
|
+
* @returns {Promise<void>} - A promise representing the async operation.
|
|
399
|
+
* @private
|
|
400
|
+
*/
|
|
312
401
|
async sendActivity(activity) {
|
|
313
402
|
var _a, _b;
|
|
314
403
|
// Set activity ID to the assigned stream ID
|
|
@@ -344,12 +433,57 @@ class StreamingResponse {
|
|
|
344
433
|
(0, agents_activity_1.addAIToActivity)(activity, this._citations, this._sensitivityLabel);
|
|
345
434
|
}
|
|
346
435
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
436
|
+
try {
|
|
437
|
+
const response = await this._context.sendActivity(activity);
|
|
438
|
+
if (!this._streamId) {
|
|
439
|
+
this._streamId = response === null || response === void 0 ? void 0 : response.id;
|
|
440
|
+
}
|
|
441
|
+
await new Promise((resolve) => setTimeout(resolve, this.delayInMs));
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
const { message } = error;
|
|
445
|
+
this._canceled = true;
|
|
446
|
+
this._queueSync = undefined;
|
|
447
|
+
this._queue = [];
|
|
448
|
+
// MS Teams code list: https://learn.microsoft.com/en-us/microsoftteams/platform/bots/streaming-ux?tabs=jsts#error-codes
|
|
449
|
+
if (message.includes('ContentStreamNotAllowed')) {
|
|
450
|
+
logger.warn('Streaming content is not allowed by the client side.', { originalError: message });
|
|
451
|
+
this._userCanceled = true;
|
|
452
|
+
}
|
|
453
|
+
else if (message.includes('BadArgument') && message.toLowerCase().includes('streaming api is not enabled')) {
|
|
454
|
+
logger.warn('Interaction does not support streaming. Defaulting to non-streaming response.', { originalError: message });
|
|
455
|
+
this._canceled = false;
|
|
456
|
+
this._isStreamingChannel = false;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Loads default values for the streaming response.
|
|
462
|
+
*/
|
|
463
|
+
loadDefaults(activity) {
|
|
464
|
+
if (!activity) {
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
if (activity.deliveryMode === agents_activity_1.DeliveryModes.ExpectReplies) {
|
|
468
|
+
this._isStreamingChannel = false;
|
|
469
|
+
}
|
|
470
|
+
else if (agents_activity_1.Channels.Msteams === activity.channelId) {
|
|
471
|
+
if (activity.isAgenticRequest()) {
|
|
472
|
+
// Agentic requests do not support streaming responses at this time.
|
|
473
|
+
// TODO: Enable streaming for agentic requests when supported.
|
|
474
|
+
this._isStreamingChannel = false;
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
this._isStreamingChannel = true;
|
|
478
|
+
this._delayInMs = 1000;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
else if (agents_activity_1.Channels.Webchat === activity.channelId || agents_activity_1.Channels.Directline === activity.channelId) {
|
|
482
|
+
this._isStreamingChannel = true;
|
|
483
|
+
this._delayInMs = 500;
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
this._isStreamingChannel = false;
|
|
353
487
|
}
|
|
354
488
|
}
|
|
355
489
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamingResponse.js","sourceRoot":"","sources":["../../../../src/app/streaming/streamingResponse.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"streamingResponse.js","sourceRoot":"","sources":["../../../../src/app/streaming/streamingResponse.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,gEAAyJ;AAGzJ,iDAA6C;AAC7C,8DAAyD;AAEzD,MAAM,MAAM,GAAG,IAAA,cAAK,EAAC,0BAA0B,CAAC,CAAA;AAEhD;;GAEG;AACH,IAAY,uBAiBX;AAjBD,WAAY,uBAAuB;IACjC;;OAEG;IACH,8CAAmB,CAAA;IACnB;;OAEG;IACH,wDAA6B,CAAA;IAC7B;;OAEG;IACH,wDAA6B,CAAA;IAC7B;;OAEG;IACH,0CAAe,CAAA;AACjB,CAAC,EAjBW,uBAAuB,uCAAvB,uBAAuB,QAiBlC;AAED;;;;;;;;;;GAUG;AACH,MAAa,iBAAiB;IAyB5B;;;;;OAKG;IACH,YAAoB,OAAoB;QA7BhC,kBAAa,GAAW,CAAC,CAAA;QAEzB,aAAQ,GAAW,EAAE,CAAA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GAAG,KAAK,CAAA;gBACtB,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAA;YAClC,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACK,YAAY,CAAE,QAAkB;QACtC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAM;QACR,CAAC;QAED,IAAI,QAAQ,CAAC,YAAY,KAAK,+BAAa,CAAC,aAAa,EAAE,CAAC;YAC1D,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAA;QAClC,CAAC;aAAM,IAAI,0BAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,SAAS,EAAE,CAAC;YACnD,IAAI,QAAQ,CAAC,gBAAgB,EAAE,EAAE,CAAC;gBAChC,oEAAoE;gBACpE,8DAA8D;gBAC9D,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAA;YAClC,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAA;gBAC/B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;YACxB,CAAC;QACH,CAAC;aAAM,IAAI,0BAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,SAAS,IAAI,0BAAQ,CAAC,UAAU,KAAK,QAAQ,CAAC,SAAS,EAAE,CAAC;YACjG,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAA;YAC/B,IAAI,CAAC,UAAU,GAAG,GAAG,CAAA;QACvB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAA;QAClC,CAAC;IACH,CAAC;CACF;AA/eD,8CA+eC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { InputFile, InputFileDownloader } from './inputFileDownloader';
|
|
6
|
+
import { TurnContext } from '../turnContext';
|
|
7
|
+
import { TurnState } from './turnState';
|
|
8
|
+
/**
|
|
9
|
+
* Downloads attachments from Teams using the bots access token.
|
|
10
|
+
*/
|
|
11
|
+
export declare class TeamsAttachmentDownloader<TState extends TurnState = TurnState> implements InputFileDownloader<TState> {
|
|
12
|
+
private _httpClient;
|
|
13
|
+
private _stateKey;
|
|
14
|
+
constructor(stateKey?: string);
|
|
15
|
+
/**
|
|
16
|
+
* Download any files relative to the current user's input.
|
|
17
|
+
*
|
|
18
|
+
* @param {TurnContext} context Context for the current turn of conversation.
|
|
19
|
+
* @returns {Promise<InputFile[]>} Promise that resolves to an array of downloaded input files.
|
|
20
|
+
*/
|
|
21
|
+
downloadFiles(context: TurnContext): Promise<InputFile[]>;
|
|
22
|
+
/**
|
|
23
|
+
* @private
|
|
24
|
+
* @param {Attachment} attachment - Attachment to download.
|
|
25
|
+
* @returns {Promise<InputFile>} - Promise that resolves to the downloaded input file.
|
|
26
|
+
*/
|
|
27
|
+
private downloadFile;
|
|
28
|
+
/**
|
|
29
|
+
* Downloads files from the attachments in the current turn context and stores them in state.
|
|
30
|
+
*
|
|
31
|
+
* @param context The turn context containing the activity with attachments.
|
|
32
|
+
* @param state The turn state to store the files in.
|
|
33
|
+
* @returns A promise that resolves when the downloaded files are stored.
|
|
34
|
+
*/
|
|
35
|
+
downloadAndStoreFiles(context: TurnContext, state: TState): Promise<void>;
|
|
36
|
+
}
|