naruka17
Posts: 5
Joined: Fri Aug 04, 2017 12:22 am

Not able to call SIML pa

Fri Aug 04, 2017 12:36 am

Hello Friends

I am using below code to call SIML package from .NET application. I got this code from "https://www.codeproject.com/Articles/86 ... ing-SIML-S" website. It is written in old version. Now I am using latest version of SIML.

Issue : I am getting error on "public SynBot Chatbot;". It says that SynBot not valid. I am missing assembly or references.

Could you please help me to call SIML package from .NET web application?

using System.IO;
using System.Windows;
using Syn.Bot;

namespace SIML_Chatbot_Demo
{
public partial class MainWindow
{
public SynBot Chatbot;
public MainWindow()
{
InitializeComponent();
Chatbot = new SynBot();
Chatbot.PackageManager.LoadFromString(File.ReadAllText("Knowledge.simlpk"));
}

private void SendButton_OnClick(object sender, RoutedEventArgs e)
{
var result = Chatbot.Chat(InputBox.Text);
OutputBox.Text = string.Format("User: {0}\nBot: {1}\n{2}", InputBox.Text, result.BotMessage, OutputBox.Text);
InputBox.Text = string.Empty;
}
}
}

Thanks
Chetan

User avatar
Fantom
Help & Support
Posts: 304
Joined: Fri Oct 25, 2013 9:20 pm

Re: Not able to call SIML pa

Fri Aug 04, 2017 12:47 am

That code is pretty old. Syn Bot Framework now offers SIML and OSCOVA architectures for Bot development.

Instead of SynBot use SimlBot. More information can be found here

naruka17
Posts: 5
Joined: Fri Aug 04, 2017 12:22 am

Not able to run javascript method inside syn bot studio

Tue Aug 08, 2017 2:05 am

Hello friends

I using syn bot studio to create one javascript method to greet user. below is the code
I am getting error on first if condition. could you please let me know how to use IF condition in syn bot studio
code inside method -

var myDate = new Date();
var hrs = myDate.getHours();

var greet;

if (hrs < 12)
greet = 'Good Morning';
else if (hrs >= 12 && hrs <= 17)
greet = 'Good Afternoon';
else if (hrs >= 17 && hrs <= 24)
greet = 'Good Evening';

document.getElementById('lblGreetings').innerHTML =
'<b>' + greet + '</b> and welcome to Encodedna.com!';

return greet;



Thanks
Chetan

User avatar
Fantom
Help & Support
Posts: 304
Joined: Fri Oct 25, 2013 9:20 pm

Re: Not able to call SIML pa

Tue Aug 08, 2017 1:59 pm

I recommend that you do not use IF conditions in your pattern. As SIML Classic in the latest SIML 2.0 specification doesn't encourage its usage. Instead if you are just planning to greet the user initially then you don't need to code that in SIML instead just greet them normally with JavaScript within your application or website. Only when user submits a message then a only go ahead and forward that to SIML Bot for response generation.

I tried to test your code after the error line you mentioned and it works fine for me.

Image

naruka17
Posts: 5
Joined: Fri Aug 04, 2017 12:22 am

Re: Not able to call SIML pa

Wed Aug 09, 2017 12:43 am

Thanks for your reply.
Yes, even I can also run same code in Script Evaluator but I get error in scripts.siml file. is it possible to run code in scripts file.

you said "Instead if you are just planning to greet the user initially then you don't need to code that in SIML instead just greet them normally with JavaScript within your application or website". Could you please share sample code?

I have some more questions
1. How to call database ?
2.How to call my application or website code instead siml pkg?
3. How to create "form dialog" using SIML
4. Is it possible to preserver previous user values/selection ?
5. how to provide multiple options to user.
6. is it possible to send/receive image or attachment from/to user?
7. Is it possible to send HTML url ?
8. Is it possible to format Text message?
9. Is it possible to send HTML page?

Thanks
Chetan Singh

Return to “Feature Request and Suggestions”

Who is online

Users browsing this forum: No registered users and 1 guest