25 lines
895 B
Python
25 lines
895 B
Python
from flask_wtf import FlaskForm
|
|
from wtforms import StringField, TextAreaField, SelectField, SubmitField
|
|
from wtforms.validators import DataRequired, Length, NumberRange
|
|
|
|
class PromptForm(FlaskForm):
|
|
input_text = TextAreaField('输入内容', validators=[
|
|
DataRequired(message='请输入内容'),
|
|
Length(min=10, max=1000, message='内容长度应在10到1000个字符之间')
|
|
])
|
|
submit = SubmitField('生成提示词')
|
|
|
|
class FeedbackForm(FlaskForm):
|
|
rating = SelectField('评分', choices=[
|
|
('5', '⭐⭐⭐⭐⭐'),
|
|
('4', '⭐⭐⭐⭐'),
|
|
('3', '⭐⭐⭐'),
|
|
('2', '⭐⭐'),
|
|
('1', '⭐')
|
|
], validators=[DataRequired(message='请选择评分')])
|
|
|
|
comment = TextAreaField('评论', validators=[
|
|
Length(max=500, message='评论不能超过500个字符')
|
|
])
|
|
submit = SubmitField('提交反馈')
|