Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After upgrade: "Statement matching query does not exist" #943

Closed
Issen007 opened this issue Aug 16, 2017 · 6 comments
Closed

After upgrade: "Statement matching query does not exist" #943

Issen007 opened this issue Aug 16, 2017 · 6 comments
Labels

Comments

@Issen007
Copy link

After upgrading the code I got a new bug.
This is happening when I type in a unknown word for the ChatterBot.

Internal Server Error: /api/chatterbot/
Traceback (most recent call last):
  File "/home/chrisp/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/home/chrisp/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/chrisp/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/chrisp/lib/python3.6/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/chrisp/lib/python3.6/site-packages/django/views/generic/base.py", line 88, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/chrisp/lib/python3.6/site-packages/chatterbot/ext/django_chatterbot/views.py", line 78, in post
    response = self.chatterbot.get_response(input_data, conversation.id)
  File "/home/chrisp/lib/python3.6/site-packages/chatterbot/chatterbot.py", line 119, in get_response
    self.storage.add_to_conversation(conversation_id, statement, response)
  File "/home/chrisp/lib/python3.6/site-packages/chatterbot/storage/django_storage.py", line 176, in add_to_conversation
    first_response = Statement.objects.get(text=response.text)
  File "/home/chrisp/lib/python3.6/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/chrisp/lib/python3.6/site-packages/django/db/models/query.py", line 380, in get
    self.model._meta.object_name
chatterbot.ext.django_chatterbot.models.DoesNotExist: Statement matching query does not exist.
@gunthercox
Copy link
Owner

A line probably needs to be modified in there to create that statement. I probably missed it when I did the conversation changes for #828

@gunthercox gunthercox added the bug label Aug 16, 2017
@GitCMDR
Copy link

GitCMDR commented Dec 10, 2017

+1, affected by bug.

@GitCMDR
Copy link

GitCMDR commented Dec 10, 2017

Solution is to downgrade to 0.7.6 for the moment. (At least that worked for me.)

@phdggg
Copy link

phdggg commented Dec 16, 2017

Confirm this bug is still there in 0.8.1. The workaround is to stop self-learning by adding the following to Django's settings.py:
CHATTERBOT = {
#######
'read_only': True,
#######
}

@kalentang
Copy link

agree @phdggg , this bug is still in 0.8.2.

@gunthercox
Copy link
Owner

This should be fixed now that #1391 has resulted in the removal of the Conversation model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants