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)
评论列表
文章目录