botshot / botshot Goto Github PK
View Code? Open in Web Editor NEWA chatbot framework for python developers. Batteries included ππ
License: GNU Affero General Public License v3.0
A chatbot framework for python developers. Batteries included ππ
License: GNU Affero General Public License v3.0
Traceback (most recent call last):
File "/home/web/showmax-bot/env/lib/python3.5/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/home/web/showmax-bot/env/lib/python3.5/site-packages/gunicorn/workers/base.py", line 129, in init_process
self.load_wsgi()
File "/home/web/showmax-bot/env/lib/python3.5/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/home/web/showmax-bot/env/lib/python3.5/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/home/web/showmax-bot/env/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
return self.load_wsgiapp()
File "/home/web/showmax-bot/env/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File "/home/web/showmax-bot/env/lib/python3.5/site-packages/gunicorn/util.py", line 350, in import_app
__import__(module)
File "/home/web/showmax-bot/bot/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/home/web/showmax-bot/env/lib/python3.5/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/home/web/showmax-bot/env/lib/python3.5/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/web/showmax-bot/env/lib/python3.5/site-packages/django/apps/registry.py", line 120, in populate
app_config.ready()
File "/home/web/showmax-bot/botshot/apps.py", line 10, in ready
init_flows()
File "/home/web/showmax-bot/botshot/core/flow.py", line 43, in init_flows
print('Initialized {} flows: {}'.format(len(flows), sorted(list(flows.keys()))))
TypeError: unorderable types: bool() < str()
Blank django templates added automatically as bootstrap. The landing page is not necessary, maybe webgui is a better home page. The conditions are needed for messenger so it makes sense to include them in the example.
Add dashboard view showing status of:
Useful information should be provided when there is a problem with any service.
We should investigate everything that happens on each server startup and bring it all into one place. We have to be careful that multiple instances (two by default) of the same server are started up. Some things should be run only once (sending messenger menu settings), some things in both instances (setting up loggers).
We should also investigate what data gets passed between Celery and Django and when.
There are several things that should be added to the documentation to make it easier to get familiar with Botshot.
When using sqlite, the bot will crash if there are 2 messages coming at once because of sqlite's basic locking support.
django.db.transaction.TransactionManagementError: An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block.
When running 'bots init my_bot && cd my_bot' an error is thrown because the django.utils.six module is not available. Installing django version 2.2.9 fixed this issue.
It looks like that module was removed for version 3.0.0 of django.
Changing the install requirement in setup.py to specify between versions 2.1.5 and 2.2.9 would probably fix this issue.
Right now the real exception is not immediately visible, it is hidden under ImportError.
Include conversation testing in the framework, or as a PyPI module.
Right now, the framework crashes when moving to the state.
Scheduler is not loaded after apps.py update #44.
For some reason, scheduler.py was imported from flows.py in BotshotConfig.ready().
Now that flows are loaded elsewhere, it doesn't get loaded and the update task is never registered.
Sometimes it is desired to have a "pause" between two messages, for example to indicate that the bot is thinking. This could be done directly in threads, or with a special PauseMessage.
Human should be able to take over conversation in Messages admin tab. First, " πβπ¨Take over" button will be shown, clicking it will disable the bot and reveal the input field.
Conversations in left panel are grouped into two sections, something like: Human takeover, Bot controlled.
When chatting with the bot, a "Request human reply" action could be triggered to automatically hand over to human and additionally show an βοΈ exclamation mark next to it as "Requested assistance"
For some reason, these have different effect.
INSTALLED_APPS = ('botshot', ...
INSTALLED_APPS = ('botshot.apps.BotshotConfig', ...
For example, when running unit tests, the second variant crashes with "default.root not found".
This indicates that ready() may not be called in the first case.
If you use "redis://localhost:6379/0"
without a slash, BOT_CONFIG.get('REDIS_URL').rstrip("/")+'/1'
will crash.
(Of course redis error message just says ValueError: invalid literal for int() with base 10: '0/1'
)
The user may get stuck inside a requirement loop.
Special characters like newlines aren't displayed correctly across messaging platforms. Check if it's even possible and replace newlines with the correct characters in the individual chat interfaces.
It would be nice to have a "development mode" where everything would run in one process without complicated setup, so that debugging is easier.
TO DO:
Originally posted by @mzilinec in #41 (comment)
botshot/botshot/core/interfaces/facebook.py
Line 222 in 8d06f70
Here the JSON might be invalid.
Based on this template: https://gist.github.com/PurpleBooth/109311bb0361f32d87a2
botshot/botshot/core/chat_manager.py
Line 129 in b5c347a
Telegram webhooks init should not be done when migrating, importing settings or when there is no telegram token. Also there should be a small enough timeout.
When you import from botshot.core.chat_manager import ChatManager
from a flow, botshot will crash with message "flows weren't initialized".
(Branch message_log)
The easiest way to support custom dialog transitions like in Alquist would be just by decoupling and making MessageProcessor
abstract, so that we would have for instance FlowMessageProcessor
and ProbabilisticMessageProcessor
and the chatbot developer would choose in BOT_CONFIG
.
It would be great to have a GUI in which the user could see or edit flows visually. Actions that are represented by a function would need to be documented by the developer and this documentation would be shown in the GUI. Optionally, the functions could take some kind of arguments from the dialog builder.
def action(dialog, text_from_non_technical_person: str):
do_stuff()
dialog.send(processed_text)
Botshot console log is not working when using proper logging module like in FacebookInterface.
On ubuntu, redis is automatically installed as init.d service and this will cause the script to fail because the port is already bound.
Using buttons and example sentences for each state from #10, we could create a "metabot" that would generate a conversation tree from our flows (up to a certain depth). This could be used to visualize a graph of states with edges that correspond to example messages and bot responses.
Implement unit tests.
Messenger bottom menu, get started etc. should be configurable for example from settings.py or in other file.
Make web chat GUI embeddable into user pages by <iframe>. Add link to full screen chat.
State could be passed as extra argument to the QuickReply and Button objects to make it more user friendly than passing _state in payload.
All interfaces could be handled by the same botshot view class.
When stopped, celery will keep running and eat up all memory.
There should be a default message broker that will get installed using pip, so that the user doesn't have to add it manually.
In production, the server is not run with botshot start but using a wsgi script. The dependencies should be included in the wsgi script or prepared as separate services.
Right now, schedule uses a special _schedule flow. Furthermore, the bot crashes if this isn't present.
Check python version in botshot console script, fail with nice error if version < 3.5.
An examples
field of possible user phrases could be added to each state to:
For some reason, now that webgui is hosted under /chat
by default, django expects static files under /chat/static/css/webchat.css
.
Only admins should have access to "hacks" such as /test_record/start/ command
History states sometimes aren't added to context.
Inline entities could be defined like below.
Advantages: avoids repetitive calling of NLU for entities that we're not interested in, faster development, definition at runtime, nice to have in flow builder
Questions:
Should this just use KeywordsExtractor or should it be connected to the "real" NLU? Maybe keywords, word similarity and regex would be nice? (Definitely no training as this can be modified at runtime)
default:
states:
- name: ask_user_type
action: foo
entities:
- keywords yesno:
- 'yes': ['yes', 'yeah', 'sure']
- 'no': ['no', 'nope', 'nah']
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.