python
from flask import Flask, request, render_template
app = Flask(__name__)
简单的规则匹配逻辑
def get_response(user_input):
user_input = user_input.lower()
if hello in user_input or hi in user_input:
return Hello! How can I assist you today?
elif how are you in user_input:
return I'm just a bot, but thanks for asking!
elif bye in user_input or goodbye in user_input:
return Goodbye! Have a great day!
else:
return I'm sorry, I didn't understand that.