release: v2.1 - Prompt管理系统、页脚优化、图标修复
新增功能: - Prompt管理:后台新增Prompt模板管理功能 - 数据库迁移:新增prompt_templates表及默认数据 - 页脚优化:添加ICP备案号(浙ICP备2025154782号-1)和Microsoft Clarity统计 - 图标修复:详情页Material Icons替换为Emoji - 标签显示:修复编辑页标签名称无法显示的问题 技术改进: - 添加正则表达式提取标签名称 - 优化页脚样式和链接 - 完善增量部署文档 🚀 Generated with Claude Code Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
32
models.py
32
models.py
@@ -136,3 +136,35 @@ class Admin(UserMixin, db.Model):
|
||||
|
||||
def __repr__(self):
|
||||
return f'<Admin {self.username}>'
|
||||
|
||||
class PromptTemplate(db.Model):
|
||||
"""AI提示词模板模型"""
|
||||
__tablename__ = 'prompt_templates'
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
key = db.Column(db.String(50), unique=True, nullable=False, comment='唯一标识(tags/features/description)')
|
||||
name = db.Column(db.String(100), nullable=False, comment='模板名称')
|
||||
system_prompt = db.Column(db.Text, nullable=False, comment='系统提示词')
|
||||
user_prompt_template = db.Column(db.Text, nullable=False, comment='用户提示词模板(支持变量)')
|
||||
description = db.Column(db.String(200), comment='模板说明')
|
||||
is_active = db.Column(db.Boolean, default=True, comment='是否启用')
|
||||
created_at = db.Column(db.DateTime, default=datetime.now, comment='创建时间')
|
||||
updated_at = db.Column(db.DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
|
||||
|
||||
def __repr__(self):
|
||||
return f'<PromptTemplate {self.name}>'
|
||||
|
||||
def to_dict(self):
|
||||
"""转换为字典"""
|
||||
return {
|
||||
'id': self.id,
|
||||
'key': self.key,
|
||||
'name': self.name,
|
||||
'system_prompt': self.system_prompt,
|
||||
'user_prompt_template': self.user_prompt_template,
|
||||
'description': self.description,
|
||||
'is_active': self.is_active,
|
||||
'created_at': self.created_at.strftime('%Y-%m-%d %H:%M:%S') if self.created_at else None,
|
||||
'updated_at': self.updated_at.strftime('%Y-%m-%d %H:%M:%S') if self.updated_at else None
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user