GithubHelp home page GithubHelp logo

Comments (12)

pierredavidbelanger avatar pierredavidbelanger commented on July 18, 2024

This seems strange. What language are you using ? Also, are you sure you are using the latest version of the lib ? Do you have a small bit of code that you can show me to replicate the problem ?

from chatter-bot-api.

Zephyrrus avatar Zephyrrus commented on July 18, 2024

I'm using .NET, in my own code I have several instances of a class with a bot in each class and a single factory, but I replicated the bug in the example too, it freezes at line 75 in cleverbot.cs and some minutes later it throws: "An unhandled exception of type 'System.Net.WebException' occurred in System.dll. Additional information: The operation has timed out".

ChatterBotFactory factory = new ChatterBotFactory();
ChatterBot bot1 = factory.Create(ChatterBotType.CLEVERBOT);
ChatterBotSession bot1session = bot1.CreateSession();

ChatterBot bot2 = factory.Create(ChatterBotType.CLEVERBOT);
ChatterBotSession bot2session = bot2.CreateSession();

After the first Hi (which is not from any of the bots), as soon as

s = bot2session.Think(s);

is called, it freezes.

from chatter-bot-api.

pierredavidbelanger avatar pierredavidbelanger commented on July 18, 2024

Thank you for your feedback. I appreciate.

When you say

it freezes at line 75 in cleverbot.cs

Is this cleverbot.cs file in your project or in my lib ?

Because, my line 75 in Cleverbot.cs from the master branch, is not supposed to throw System.Net.WebException, it is only a simple Split().

So, I guess, you maybe not using the latest version of my .NET code lib.

Are you able to copy/paste me a stacktrace of your exception ?

Thank you.

from chatter-bot-api.

Zephyrrus avatar Zephyrrus commented on July 18, 2024

It's on line 73

var response = Utils.Post(url, vars, cookies);

and I cloned the libs yesterday again so it's the latest one. This is the exception and the stacktrace and IntelliTrace call stack.

A first chance exception of type 'System.Net.WebException' occurred in System.dll

Stack Trace from exception details:

   at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at ChatterBotAPI.Utils.Post(String url, IDictionary`2 parameters, CookieCollection cookies) in d:\GIT\chatter-bot-api-master\dotnet\ChatterBotAPI\Utils.cs:line 98
   at ChatterBotAPI.CleverbotSession.Think(ChatterBotThought thought) in d:\GIT\chatter-bot-api-master\dotnet\ChatterBotAPI\Cleverbot.cs:line 75
   at ChatterBotAPI.CleverbotSession.Think(String text) in d:\GIT\chatter-bot-api-master\dotnet\ChatterBotAPI\Cleverbot.cs:line 113
   at ChatterBotAPITest.MainClass.Main(String[] args) in d:\GIT\chatter-bot-api-master\dotnet\ChatterBotAPITest\Main.cs:line 39
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

IntelliTrace

Call Stack for "Debugger:Stopped at Exception: GetRequestStream"
    ChatterBotAPI.dll!ChatterBotAPI.Utils.Post(string url = {unknown}, System.Collections.Generic.IDictionary<string,string> parameters = {unknown}, System.Net.CookieCollection cookies = {unknown})   C#
    ChatterBotAPI.dll!ChatterBotAPI.CleverbotSession.Think(ChatterBotAPI.ChatterBotThought thought = {unknown}) C#
    ChatterBotAPI.dll!ChatterBotAPI.CleverbotSession.Think(string text = {unknown}) C#
    ChatterBotAPITest.exe!ChatterBotAPITest.MainClass.Main(string[] args = {unknown})   C#

Call Stack for "Debugger:Exception Intercepted"
    ChatterBotAPI.dll!ChatterBotAPI.Utils.Post(string url, System.Collections.Generic.IDictionary<string,string> parameters, System.Net.CookieCollection cookies) Line 98   C#
    ChatterBotAPI.dll!ChatterBotAPI.CleverbotSession.Think(ChatterBotAPI.ChatterBotThought thought) Line 75 C#
    ChatterBotAPI.dll!ChatterBotAPI.CleverbotSession.Think(string text) Line 113    C#
    ChatterBotAPITest.exe!ChatterBotAPITest.MainClass.Main(string[] args) Line 39   C#

Also is clever bot's 'api' dead or they changed the way how it works ?

from chatter-bot-api.

pierredavidbelanger avatar pierredavidbelanger commented on July 18, 2024

It may be Windows that mess with line numbers, but as far as I can understand those stacktrace, you are not using the latest version of the lib.

Just to be sure, can you open your file

d:\GIT\chatter-bot-api-master\dotnet\ChatterBotAPI\Cleverbot.cs

And tel me what is at line 61 (the last expression at the end of the CleverbotSession constructor) ?

If you are not seeing this line:

cookies = Utils.GetCookies(baseUrl);

it means your git clone went wrong somehow, and you are not using the latest version.

There was a commit some weeks ago that fixes a problem with the .NET cookies handling that may be the cause of your issue.

Let me know, we will find a solution.
Thank you

from chatter-bot-api.

Zephyrrus avatar Zephyrrus commented on July 18, 2024

Looks like my VS tries to fix the line spacing and that's why everything is pushed down 2 lines for me. I have that line at the end of CleverbotSession constructor. For you it works to create two cleverbots in the same program ?

from chatter-bot-api.

pierredavidbelanger avatar pierredavidbelanger commented on July 18, 2024

I honestly didn't tried to reproduce the problem since I was sure your where not using the latest version, but now you made me doubtful.

If you only take the test program and change the line 32 to use a CLEVERBOT instead of a PANDORABOTS, are you able to reproduce the problem ?

If you do, I will try the same, and start looking for a solution.

As far as I know, Cleverbot did not change. The other languages are working.

from chatter-bot-api.

Zephyrrus avatar Zephyrrus commented on July 18, 2024

Cleverbot servers had some issues for some minutes, they're back now.

Here's a screenshot
image
showing that I have cloned the latest commit and I am using your code with the C# example.
Also yes, the same happens if I try to use the example with two cleverbots, maybe I should move to python if it works in that version.

Edit: In python 2.7 it works for me, but I prefer writing programs in C#

from chatter-bot-api.

pierredavidbelanger avatar pierredavidbelanger commented on July 18, 2024

Thank you for your feedbacks.
I has able to also reproduce the problem.
I will try to find a fix.

from chatter-bot-api.

pierredavidbelanger avatar pierredavidbelanger commented on July 18, 2024

Good news,
I may have found a fix (it fixes the problem on my side).

It turns out I was too noob in .NET to correctly dispose of the streams!
Also, the problem in this issue may be the fact that I was not correctly reading all the response when I read the cookies, this can hang the other requests (they are in a kind of reusable pool), I had the same problem on an unrelated Java program not so long ago, using Apache HttpClient.

Anyways,
if you have some spare time, maybe you could test it on your side, since I am not using Microsoft .NET, but Mono on OSX.

Mono JIT compiler version 4.0.0 ((detached/d136b79 Mon Apr 13 14:40:59 EDT 2015)

from chatter-bot-api.

Zephyrrus avatar Zephyrrus commented on July 18, 2024

It works now, only that sometimes it returns a 403 error if you let two cleverbots talk with each other. I think it can detect that it's two bots talking with each other, because it also send weird replies sometimes like "I think you want to talk to cleverbot really".

Example convo between two bots:

bot2>
Do you like Cleverbot?
bot1> Do you hold out hope for a better time?
bot2> The only better time I can think of is mankind ceasing to exist.
bot1>
You seem a bit too botlike for me.
bot2> I am Cleverbot.
bot1> No. Are you British?
bot2>
Confuse friends who text you with our free Clevermessage app for Android!
bot1>
Cleverbot in your pocket! Try our apps!
bot2>
Automate your texting with Clevermessage for Android! A free app!
bot1> This is silly.
bot2>
Do you like Cleverbot?
bot1>
Do you like Cleverbot?
bot2>
I think you want to talk to Cleverbot really...
bot1> What would you like to talk about?
bot2>
Want a fight!? Try the free ANGRY DUDE iOS app!

But that doesn't really need to be fixed, thanks a lot for fixing the other bug.

from chatter-bot-api.

pierredavidbelanger avatar pierredavidbelanger commented on July 18, 2024

Thanks to you for your input.
I close this issue.

from chatter-bot-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.