wit.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:Liljimbo-Chatbot 作者: chrisjim316 项目源码 文件源码
def interactive(self, context=None):
        """Runs interactive command line chat between user and bot. Runs
        indefinitely until EOF is entered to the prompt.

        context -- optional initial context. Set to {} if omitted
        """
        if context is None:
            context = {}

        # input/raw_input are not interchangeable between Python 2 and 3
        try:
            input_function = raw_input
        except NameError:
            input_function = input

        history = InMemoryHistory()
        while True:
            try:
                message = prompt(INTERACTIVE_PROMPT, history=history, mouse_support=True).rstrip()
            except (KeyboardInterrupt, EOFError):
                return
            print(self.message(message, context))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号