OvidijusParsiunas / deep-chat

Fully customizable AI chatbot component for your website
https://deepchat.dev
MIT License
1.26k stars 170 forks source link

deep-chat how to connect with .net bot framework ? #198

Closed delsoul6104 closed 1 month ago

delsoul6104 commented 1 month ago

HI ~

I'm currently using Bot Framework .NET Core version as a bot service and I want to use Deep-Chat as the frontend service for my bot. The issue I'm encountering is that Bot Framework defines an Activity, and I tried to populate it. When sending a conversation from Deep-Chat to the bot service, it can be received. However, in the following code:

protected override async Task OnMessageActivityAsync(ITurnContext turnContext, CancellationToken cancellationToken) { var replyText = $"Echo: {turnContext.Activity.Text}"; await turnContext.SendActivityAsync(MessageFactory.Text(replyText, replyText), cancellationToken); }

an error occurs saying "Operation returned an invalid status code 'NotFound'". Has anyone integrated these two services successfully?

Thank you!

OvidijusParsiunas commented 1 month ago

Hi @delsoul6104.

I have unfortunately not used the Bot Framework, hence it is difficult to pinpoint where the problem is. I would suggest trying out the following steps:

  1. Try to call your server using Postman or other tool to call your server and see if there are any issues with the configuration of the server itself.
  2. If the above is valid, then the likely problem is the outgoing Deep Chat message format as the Bot Framework is expecting something else. You will either need to use the requestInterceptor to change the outgoing message or create a new message object inside your server. I also recommend checking if the request property is set up correctly, but if your server internals are getting called then I assume that it is.

Note, the following tip has nothing to do with your error, but Deep Chat expects a certain response format from the server, hence I would recommend either setting up the response message in your server or using the responseInterceptor to change it to the correct format.

Let me know if you are able to resolve your issue.

delsoul6104 commented 1 month ago

嗨。

不幸的是,我沒有使用機器人框架,因此很難確定問題出在哪裡。我建議嘗試以下步驟:

  1. 嘗試使用 Postman 或其他工具調用您的伺服器來調用您的伺服器,看看伺服器本身的配置是否存在任何問題。
  2. 如果上述內容有效,則可能的問題是傳出的深度聊天消息格式,因為 Bot Framework 需要其他內容。您需要使用 requestInterceptor 更改傳出消息,或者在伺服器內創建新的消息物件。我還建議檢查請求屬性是否設置正確,但是如果您的伺服器內部正在被調用,那麼我假設它是。

請注意,以下提示與您的錯誤無關,但深度聊天需要伺服器提供某種回應格式,因此我建議您在伺服器中設置回應消息或使用 responseInterceptor 將其更改為正確的格式。

如果您能夠解決您的問題,請告訴我。

Hi @delsoul6104.

I have unfortunately not used the Bot Framework, hence it is difficult to pinpoint where the problem is. I would suggest trying out the following steps:

  1. Try to call your server using Postman or other tool to call your server and see if there are any issues with the configuration of the server itself.
  2. If the above is valid, then the likely problem is the outgoing Deep Chat message format as the Bot Framework is expecting something else. You will either need to use the requestInterceptor to change the outgoing message or create a new message object inside your server. I also recommend checking if the request property is set up correctly, but if your server internals are getting called then I assume that it is.

Note, the following tip has nothing to do with your error, but Deep Chat expects a certain response format from the server, hence I would recommend either setting up the response message in your server or using the responseInterceptor to change it to the correct format.

Let me know if you are able to resolve your issue.

Currently, using Postman, I am still unable to get the correct JSON data from the bot framework response. At this point, I am considering abandoning the use of this framework for backend processing of BOT SERVICE. Thank you.

OvidijusParsiunas commented 1 month ago

Sorry to hear that, hope your issue get resolved!