def __init__(self, name): ClientConfigurationData.__init__(self, name) self._host = "0.0.0.0" self._port = 80 self._debug = False self._use_api_keys = False self._api_key_file = None self._ssl_cert_file = None self._ssl_key_file = None self._config_key = True
def __init__(self, name): ClientConfigurationData.__init__(self, name) self._host = "0.0.0.0" self._port = 80 self._debug = False self._api = '/api/rest/v1.0/ask' self._use_api_keys = False self._api_key_file = None self._ssl_cert_file = None self._ssl_key_file = None
def __init__(self): ClientConfigurationData.__init__(self, "rosnode") # Initializing config-variables used by the client if gestSettings.g_firstInit == True: gestSettings.g_rostopic_gestures = "gestureOut" gestSettings.g_queueSize = 10 self._default_userid = "rosClient" self._nodename = "chatbot" self._rostopic_chat = "chatbotOUT" self._subscription = "chatbotIN" self._rosrate = 10
def __init__(self): ClientConfigurationData.__init__(self, "twitter") self._description = 'ProgramY AIML2.0 Twitter Client' self._polling_interval = 60 self._rate_limit_sleep = 900 self._follow_followers = True self._respond_to_mentions = True self._respond_to_directs = False self._mentions = ['#askprogramy'] self._welcome_message = "Thanks for following me."
def test_selection_multi_bot(self): config_file, logging_file = MockConfigFiles.get_config_files(self) arguments = MockConfigFiles.get_commandline_args(None, logging_file) client = MockBotClient(arguments) bot1 = Bot(BotConfiguration(), client) bot2 = Bot(BotConfiguration(), client) bot3 = Bot(BotConfiguration(), client) bots = {"bot1": bot1, "bot2": bot2, "bot3": bot3} config = ClientConfigurationData(name="test") selector = DefaultBotSelector(config, bots) selected = selector.select_bot() self.assertIsNotNone(selected) self.assertEquals(selected, bot1) selected = selector.select_bot() self.assertIsNotNone(selected) self.assertEquals(selected, bot2) selected = selector.select_bot() self.assertIsNotNone(selected) self.assertEquals(selected, bot3) selected = selector.select_bot() self.assertIsNotNone(selected) self.assertEquals(selected, bot1)
def test_selection_multi_brain(self): client = TestClient() bot = Bot(BotConfiguration(), client) brain1 = Brain(bot, BrainConfiguration()) brain2 = Brain(bot, BrainConfiguration()) brain3 = Brain(bot, BrainConfiguration()) brains = {"brain1": brain1, "brain2": brain2, "brain3": brain3} config = ClientConfigurationData(name="test") selector = DefaultBrainSelector(config, brains) selected = selector.select_brain() self.assertIsNotNone(selected) self.assertEqual(selected, brain1) selected = selector.select_brain() self.assertIsNotNone(selected) self.assertEqual(selected, brain2) selected = selector.select_brain() self.assertIsNotNone(selected) self.assertEqual(selected, brain3) selected = selector.select_brain() self.assertIsNotNone(selected) self.assertEqual(selected, brain1)
def test_selection_no_bot(self): config = ClientConfigurationData(name="test") selector = DefaultBotSelector(config, {}) selected = selector.select_bot() self.assertIsNone(selected)
def test_with_no_data(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text(""" other: """, ConsoleConfiguration(), ".") client_config = ClientConfigurationData("console") client_config.load_configuration(yaml, ".") self.assertIsNotNone(client_config.bot_selector) self.assertIsNotNone(client_config.scheduler) self.assertEqual(None, client_config.scheduler.name) self.assertEqual(0, client_config.scheduler.debug_level) self.assertFalse(client_config.scheduler.add_listeners) self.assertFalse(client_config.scheduler.remove_all_jobs) self.assertIsNotNone(client_config.renderer)
def __init__(self): ClientConfigurationData.__init__(self, "telegram") self._unknown_command = None self._unknown_command_srai = None
def get_client_configuration(self): return ClientConfigurationData("polling")
def test_with_data_multiple_bots(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text( """ console: prompt: ">>>" renderer: programy.clients.render.text.TextRenderer scheduler: name: Scheduler1 debug_level: 0 add_listeners: True remove_all_jobs: True bot_selector: programy.clients.botfactory.DefaultBotSelector bots: bot1: prompt: ">>>" initial_question: Hi, how can I help you today? initial_question_srai: YINITIALQUESTION default_response: Sorry, I don't have an answer for that! default_response_srai: YDEFAULTRESPONSE empty_string: YEMPTY exit_response: So long, and thanks for the fish! exit_response_srai: YEXITRESPONSE override_properties: true max_question_recursion: 1000 max_question_timeout: 60 max_search_depth: 100 max_search_timeout: 60 spelling: load: true classname: programy.spelling.norvig.NorvigSpellingChecker alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' check_before: true check_and_retry: true splitter: classname: programy.dialog.splitter.regex.RegexSentenceSplitter joiner: classname: programy.dialog.joiner.SentenceJoiner conversations: save: true load: false max_histories: 100 restore_last_topic: false initial_topic: TOPIC1 empty_on_start: false from_translator: classname: programy.nlp.translate.textblob_translator.TextBlobTranslator from: fr to: en to_translator: classname: programy.nlp.translate.textblob_translator.TextBlobTranslator from: en to: fr sentiment: classname: programy.nlp.sentiment.textblob_sentiment.TextBlobSentimentAnalyser scores: programy.nlp.sentiment.scores.SentimentScores brain_selector: programy.bot.DefaultBrainSelector brains: brain1: # Overrides overrides: allow_system_aiml: true allow_learn_aiml: true allow_learnf_aiml: true # Defaults defaults: default_get: unknown default_property: unknown default_map: unknown learnf-path: file # Binary binaries: save_binary: true load_binary: true load_aiml_on_binary_fail: true # Braintree braintree: create: true services: OPENCHAT: classname: programy.services.openchat.openchat.service.OpenChatRESTService REST: classname: programy.services.rest.GenericRESTService method: GET host: 0.0.0.0 port: 8080 Pannous: classname: programy.services.pannous.PannousService url: http://weannie.pannous.com/api openchatbots: chatbot1: url: http://localhost:5959/api/rest/v2.0/ask method: GET security: authentication: classname: programy.security.authenticate.passthrough.BasicPassThroughAuthenticationService denied_srai: AUTHENTICATION_FAILED authorisation: classname: programy.security.authorise.usergroupsauthorisor.BasicUserGroupAuthorisationService denied_srai: AUTHORISATION_FAILED usergroups: storage: file dynamic: variables: gettime: programy.dynamic.variables.datetime.GetTime sets: numeric: programy.dynamic.sets.numeric.IsNumeric roman: programy.dynamic.sets.roman.IsRomanNumeral maps: romantodec: programy.dynamic.maps.roman.MapRomanToDecimal dectoroman: programy.dynamic.maps.roman.MapDecimalToRoman bot2: prompt: ">>>" initial_question: Hi, how can I help you today? initial_question_srai: YINITIALQUESTION default_response: Sorry, I don't have an answer for that! default_response_srai: YDEFAULTRESPONSE empty_string: YEMPTY exit_response: So long, and thanks for the fish! exit_response_srai: YEXITRESPONSE override_properties: true max_question_recursion: 1000 max_question_timeout: 60 max_search_depth: 100 max_search_timeout: 60 spelling: load: true classname: programy.spelling.norvig.NorvigSpellingChecker alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' check_before: true check_and_retry: true splitter: classname: programy.dialog.splitter.regex.RegexSentenceSplitter joiner: classname: programy.dialog.joiner.SentenceJoiner conversations: save: true load: false max_histories: 100 restore_last_topic: false initial_topic: TOPIC1 empty_on_start: false from_translator: classname: programy.nlp.translate.textblob_translator.TextBlobTranslator from: fr to: en to_translator: classname: programy.nlp.translate.textblob_translator.TextBlobTranslator from: en to: fr sentiment: classname: programy.nlp.sentiment.textblob_sentiment.TextBlobSentimentAnalyser scores: programy.nlp.sentiment.scores.SentimentScores brain_selector: programy.bot.DefaultBrainSelector brains: brain1: # Overrides overrides: allow_system_aiml: true allow_learn_aiml: true allow_learnf_aiml: true # Defaults defaults: default_get: unknown default_property: unknown default_map: unknown learnf-path: file # Binary binaries: save_binary: true load_binary: true load_aiml_on_binary_fail: true # Braintree braintree: create: true services: OPENCHAT: classname: programy.services.openchat.openchat.service.OpenChatRESTService REST: classname: programy.services.rest.GenericRESTService method: GET host: 0.0.0.0 port: 8080 Pannous: classname: programy.services.pannous.PannousService url: http://weannie.pannous.com/api openchatbots: chatbot1: url: http://localhost:5959/api/rest/v2.0/ask method: GET security: authentication: classname: programy.security.authenticate.passthrough.BasicPassThroughAuthenticationService denied_srai: AUTHENTICATION_FAILED authorisation: classname: programy.security.authorise.usergroupsauthorisor.BasicUserGroupAuthorisationService denied_srai: AUTHORISATION_FAILED usergroups: storage: file dynamic: variables: gettime: programy.dynamic.variables.datetime.GetTime sets: numeric: programy.dynamic.sets.numeric.IsNumeric roman: programy.dynamic.sets.roman.IsRomanNumeral maps: romantodec: programy.dynamic.maps.roman.MapRomanToDecimal dectoroman: programy.dynamic.maps.roman.MapDecimalToRoman """, ConsoleConfiguration(), ".") client_config = ClientConfigurationData("console") client_config.load_configuration(yaml, ".") self.assertEqual(2, len(client_config.configurations)) self.assertEqual("programy.clients.botfactory.DefaultBotSelector", client_config.bot_selector) self.assertIsNotNone(client_config.scheduler) self.assertEqual("Scheduler1", client_config.scheduler.name) self.assertEqual(0, client_config.scheduler.debug_level) self.assertTrue(client_config.scheduler.add_listeners) self.assertTrue(client_config.scheduler.remove_all_jobs) self.assertEqual("programy.clients.render.text.TextRenderer", client_config.renderer)
def __init__(self): ClientConfigurationData.__init__(self, "webwebsocket") self._host = "0.0.0.0" self._port = 80
def get_client_configuration(self): return ClientConfigurationData("events")
def __init__(self): ClientConfigurationData.__init__(self, "voice") self._tts_engine_name = None self._stt_engine_name = None self._tts_engine = None self._stt_engine = None
def __init__(self): ClientConfigurationData.__init__(self, "mock")
def test_defaults(self): client_config = ClientConfigurationData("console") data = {} client_config.to_yaml(data, True) ClientConfigurationDataTests.assert_defaults(self, data)
def check_for_license_keys(self, license_keys): ClientConfigurationData.check_for_license_keys(self, license_keys)
def __init__(self): ClientConfigurationData.__init__(self, "discord")
def __init__(self): ClientConfigurationData.__init__(self, "console") self._default_userid = "console" self._prompt = ">>>"
def __init__(self): ClientConfigurationData.__init__(self, "slack") self._polling_interval = 1