microsoft / microsoft/BotFramework-DirectLineJS
postActivity responses to an Invoke return the string 'retry'
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- TypeScript
- Star
- 199
- Fork
- 133
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
If you send an InvokeActivity to postActivity via dljs, a success will return an id with the activity ID. However, an Invoke can return other status codes for error/failure cases. When this happens, postActivity still calls the "success" trigger but with an id of 'retry'.
Repro code:
directLine.postActivity({
type: 'invoke',
name: 'good'
}).subscribe(
id => {
console.log("Posted activity, assigned ID ", id); // this is called with a real id
},
error => {
console.log("Error posting activity", error);
}
);
directLine.postActivity({
type: 'invoke',
name: 'bad'
}).subscribe(
id => {
console.log("Posted activity, assigned ID ", id); // this is called with an id of 'retry'
},
error => {
console.log("Error posting activity", error);
}
);
For the boy, just handle invokes and return an InvokeResponse of 409 or whatnot in that bad case, and an InvokeResponse of 200 in the good case:
Here is some C# code to do this:
protected override async Task OnInvokeActivityAsync(ITurnContext turnContext, CancellationToken cancellationToken)
{
await turnContext.SendActivityAsync("Got an invoke: " + turnContext.Activity.Name);
if (turnContext.Activity.Name == "good")
{
await turnContext.SendActivityAsync(
new Activity
{
Type = ActivityTypesEx.InvokeResponse,
Value = new InvokeResponse
{
Status = 200
},
}, cancellationToken).ConfigureAwait(false);
}
else if (turnContext.Activity.Name == "bad")
{
await turnContext.SendActivityAsync(
new Activity
{
Type = ActivityTypesEx.InvokeResponse,
Value = new InvokeResponse
{
Status = 409
},
}, cancellationToken).ConfigureAwait(false);
}
else
{
await base.OnInvokeActivityAsync(turnContext, cancellationToken);
}
}
Expected behavior:
(1) At least the error case should be called.
(2) It'd be nice to get the actual result code, or the 502 saying message wasn't processed properly by the bot if that's all DirectLine returns
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu từ điểm vào postActivity và theo dõi cách các phản hồi Invoke được ánh xạ vào các nhánh thành công và lỗi của observable. Tái hiện các trường hợp Invoke tốt và xấu từ issue, sau đó xác minh rằng các phản hồi có trạng thái không thành công không còn phát ra literal 'retry' dưới dạng activity ID thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- typescript
- Lĩnh vực
- api
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100