def listen(self):
# Default value.
# TODO: Input plugin system goes here
# Plugins should be used for getting input so users can build their
# own custom front-end to the application.
# This will allow the speech to text functions to be moved out of the
# main class and into their own plugins.
if self.input_system == 'google':
self.question = self._google_stt()
else:
self.question = click.prompt("Input your query")
# TODO: Loading plugin system goes here
# Eventually I want people to be able to build custom behavior
# that executes when the response is being fetched. So there could
# be a loading screen that plays music or something for example.
click.echo("Wait for response...")
# Get a response from the AI using the api interface.
self.ai.get_response(self.question)
# Clean up the response and turn it into a Python object that can be read
self.response = self.ai.parse()
return self.response
评论列表
文章目录