Fantom wrote: ↑Fri May 01, 2020 2:53 pm
Can you tell us what is the actually issue? is it the performance? how slow is the bot compared to the above metrics.
https://imgur.com/DoQzmBC
This is my chatbot app in action. The first part is the 14kb SIML and it works perfectly, being able to send a message instantly. The second part is the 2mb SIML and you realize that it basically freezes the app i.e. the Textbox freezes, the tap effect on the send button freezes and it takes approximately 10 seconds for the message to be sent.
Now, I am developing my app with Xamarin Forms and the chatbot is being in one out of four of the pages, so it is a full-fledged app with other features and many components.
This is the code that I'm using to integrate Oscova and get the chatbot to work in the ViewModel, idk, maybe I'm doing something wrong?:
CSharp Code
public ChatbotPageViewModel()
{
SendCommand = new RelayCommand(Send);
BackArrowCommand = new RelayCommand(Back);
chatbot = new OscovaBot();
var assembly = IntrospectionExtensions.GetTypeInfo(typeof(MainPage)).Assembly;
Stream stream = assembly.GetManifestResourceStream("BluePillApp.Helpers.new3.siml");
chatbot.Import(XDocument.Load(stream));
chatbot.Trainer.StartTraining();
//This gets the chatbots response for each message
chatbot.MainUser.ResponseReceived += (sender, args) =>
{
//await Task.Delay(1000);
Messages.Add(new ChatMessageModel() { Text = args.Response.Text, User = App.ChatBot });
};
}
/// <summary>
/// This function sends a message
/// </summary>
public void Send()
{
if (!string.IsNullOrEmpty(TextToSend))
{
var msgModel = new ChatMessageModel() { Text = TextToSend, User = App.User };
//This adds a new message to the messages collection
Messages.Add(msgModel);
var result = chatbot.Evaluate(TextToSend);
result.Invoke();
//Removes the text in the Entry after message is sent
TextToSend = string.Empty;
}
}