website.py 文件源码

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

项目:Chinese-ChatBot-AIML-Web.py 作者: JingLuo05 项目源码 文件源码
def POST(self):
        form = myform()
        if not form.validates():
            return render.formtest(form)
        else:
            # form.d.boe and form['boe'].value are equivalent ways of
            # extracting the validated arguments from the form.
            global question
            global answer
            global chat_history
            global after_question
            question = form['??'].value
            after_question = stopwords.eliminate_stop_words(question)
            answer = robot.chat(after_question)
            chat_history.append(question)
            chat_history.append(answer)

            if answer is "":
                raise web.seeother('/add')
            web.header('Content-Type','text/html; charset=utf-8', unique=True)  # let the browser use the utf-8 encoding
            form['??'].set_value('')
            return render.answer(answer,chat_history, form)
            # return "Grrreat success! boe: %s, bax: %s, area: %s" % (form.d.boe, form['bax'].value, form['moe'].value)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号