gunthercox / ChatterBot

ChatterBot is a machine learning, conversational dialog engine for creating chat bots
https://chatterbot.readthedocs.io
BSD 3-Clause "New" or "Revised" License
14.12k stars 4.45k forks source link

cant not set response selection methods #1580

Closed xuexiaoao closed 5 years ago

xuexiaoao commented 5 years ago

i upgrade version 1.0.0, but error when set response selection methods. this is my code

chinese_bot = ChatBot(
    "Chatterbot",
    storage_adapter="chatterbot.storage.MongoDatabaseAdapter",
    logic_adapters=[
        {
            'import_path': 'chatterbot.logic.BestMatch',
            'default_response': 'I don\'t have a response for that. What else can we talk about?',
            'response_selection_method': "chatterbot.response_selection.get_random_response",
        },
        # {
        #     'import_path': 'adapter.logic.default_response.DefaultResponse'
        # }
    ],
    database_uri='mongodb://127.0.0.1:27017/chatterbot',
)

this is error log

INFO:chatterbot.chatterbot:Beginning search for close text match
WARNING:chatterbot.chatterbot:No value for search_text was available on the provided input
INFO:chatterbot.chatterbot:Processing search results
INFO:chatterbot.chatterbot:Using "hi" as a close match to "hi" with a confidence of 0
INFO:chatterbot.chatterbot:Selecting response from 956 optimal responses.
ERROR:flask.app:Exception on /get [GET]
Traceback (most recent call last):
  File "C:\Users\xuexi\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\xuexi\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\xuexi\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Users\xuexi\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\_compat.py", line 35, in reraise
    raise value
  File "C:\Users\xuexi\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\xuexi\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:/workspace/pycharm/flask-chatterbot/app.py", line 63, in get_bot_response
    reply = str(chinese_bot.get_response(userText));
  File "C:\Users\xuexi\AppData\Local\Programs\Python\Python36\lib\site-packages\chatterbot\chatterbot.py", line 121, in get_response
    response = self.generate_response(input_statement, additional_response_selection_parameters)
  File "C:\Users\xuexi\AppData\Local\Programs\Python\Python36\lib\site-packages\chatterbot\chatterbot.py", line 154, in generate_response
    output = adapter.process(input_statement, additional_response_selection_parameters)
  File "C:\Users\xuexi\AppData\Local\Programs\Python\Python36\lib\site-packages\chatterbot\logic\best_match.py", line 90, in process
    self.chatbot.storage
TypeError: 'str' object is not callable
INFO:werkzeug:127.0.0.1 - - [22/Jan/2019 10:20:22] "GET /get?msg=hi HTTP/1.1" 500 -
vkosuri commented 5 years ago

It seems to me the flask unable to detect string object.

xuexiaoao commented 5 years ago

Sorry, I made a mistake.

neeraj26jan commented 5 years ago

You can hide this warning. Just put these lines in header of the file import logging logging.basicConfig(level=logging.CRITICAL)

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.