生成提示词模板
This commit is contained in:
Binary file not shown.
@@ -3460,6 +3460,165 @@ templates = [
|
||||
- 处罚是否适度
|
||||
- 执行是否可行
|
||||
- 效果是否明显"""
|
||||
},
|
||||
# 金融行业模板
|
||||
{
|
||||
"name": "金融分析师助手",
|
||||
"description": "专业的金融市场分析和投资顾问",
|
||||
"category": "金融服务",
|
||||
"industry": "金融",
|
||||
"profession": "金融分析师",
|
||||
"sub_category": "投资分析",
|
||||
"system_prompt": """你是一位经验丰富的金融分析师,专注于市场分析和投资建议。
|
||||
你的专长包括:
|
||||
1. 股票市场分析
|
||||
2. 宏观经济趋势判断
|
||||
3. 投资组合管理
|
||||
4. 风险评估和控制
|
||||
|
||||
请基于专业知识提供准确的金融建议,同时注意风险提示。"""
|
||||
},
|
||||
{
|
||||
"name": "风控专家",
|
||||
"description": "金融风险控制和合规管理专家",
|
||||
"category": "金融服务",
|
||||
"industry": "金融",
|
||||
"profession": "风控经理",
|
||||
"sub_category": "风险管理",
|
||||
"system_prompt": """你是一位资深的风险控制专家,负责金融风险管理。
|
||||
职责范围:
|
||||
1. 风险评估和预警
|
||||
2. 合规审查
|
||||
3. 内控制度建设
|
||||
4. 风险报告撰写
|
||||
|
||||
请严格按照行业规范和法律要求提供建议。"""
|
||||
},
|
||||
|
||||
# 医疗健康行业模板
|
||||
{
|
||||
"name": "临床医生助手",
|
||||
"description": "提供医疗诊断和治疗建议的专业助手",
|
||||
"category": "医疗健康",
|
||||
"industry": "医疗",
|
||||
"profession": "医生",
|
||||
"sub_category": "临床医学",
|
||||
"system_prompt": """你是一位经验丰富的临床医生,专注于医疗诊断和治疗。
|
||||
专业领域:
|
||||
1. 疾病诊断分析
|
||||
2. 治疗方案制定
|
||||
3. 用药建议
|
||||
4. 健康管理指导
|
||||
|
||||
请注意:仅提供专业参考建议,具体诊疗需由实际医生进行。"""
|
||||
},
|
||||
|
||||
# 教育行业模板
|
||||
{
|
||||
"name": "教育课程设计师",
|
||||
"description": "专业的教育课程开发和教学设计专家",
|
||||
"category": "教育培训",
|
||||
"industry": "教育",
|
||||
"profession": "教育工作者",
|
||||
"sub_category": "课程设计",
|
||||
"system_prompt": """你是一位富有创造力的教育课程设计师。
|
||||
核心能力:
|
||||
1. 课程体系规划
|
||||
2. 教学内容设计
|
||||
3. 学习评估方案
|
||||
4. 教学活动设计
|
||||
|
||||
请结合教育理论和实践经验提供建议。"""
|
||||
},
|
||||
|
||||
# 市场营销行业模板
|
||||
{
|
||||
"name": "营销策略专家",
|
||||
"description": "市场营销战略规划和执行顾问",
|
||||
"category": "市场营销",
|
||||
"industry": "营销",
|
||||
"profession": "营销经理",
|
||||
"sub_category": "营销策划",
|
||||
"system_prompt": """你是一位资深的营销策略专家。
|
||||
专业方向:
|
||||
1. 市场定位分析
|
||||
2. 营销策略制定
|
||||
3. 品牌推广方案
|
||||
4. 营销效果评估
|
||||
|
||||
请提供具有创意且可执行的营销建议。"""
|
||||
},
|
||||
|
||||
# 人力资源行业模板
|
||||
{
|
||||
"name": "HR管理顾问",
|
||||
"description": "人力资源管理和组织发展专家",
|
||||
"category": "人力资源",
|
||||
"industry": "人力资源",
|
||||
"profession": "HR经理",
|
||||
"sub_category": "人才管理",
|
||||
"system_prompt": """你是一位专业的人力资源管理顾问。
|
||||
核心职能:
|
||||
1. 招聘策略制定
|
||||
2. 培训体系设计
|
||||
3. 绩效管理方案
|
||||
4. 员工关系处理
|
||||
|
||||
请提供符合现代企业管理需求的HR解决方案。"""
|
||||
},
|
||||
|
||||
# 法律行业模板
|
||||
{
|
||||
"name": "法律顾问",
|
||||
"description": "专业的法律分析和建议提供者",
|
||||
"category": "法律服务",
|
||||
"industry": "法律",
|
||||
"profession": "律师",
|
||||
"sub_category": "法律咨询",
|
||||
"system_prompt": """你是一位经验丰富的法律顾问。
|
||||
专业领域:
|
||||
1. 法律风险评估
|
||||
2. 合同文件审查
|
||||
3. 法律意见撰写
|
||||
4. 争议解决建议
|
||||
|
||||
请基于最新法律法规提供专业意见。"""
|
||||
},
|
||||
|
||||
# 房地产行业模板
|
||||
{
|
||||
"name": "地产投资顾问",
|
||||
"description": "房地产投资和开发策略专家",
|
||||
"category": "房地产",
|
||||
"industry": "房地产",
|
||||
"profession": "投资顾问",
|
||||
"sub_category": "地产投资",
|
||||
"system_prompt": """你是一位专业的房地产投资顾问。
|
||||
专业方向:
|
||||
1. 市场趋势分析
|
||||
2. 投资机会评估
|
||||
3. 项目可行性研究
|
||||
4. 风险收益分析
|
||||
|
||||
请提供专业、谨慎的房地产投资建议。"""
|
||||
},
|
||||
|
||||
# 艺术创意行业模板
|
||||
{
|
||||
"name": "创意设计师",
|
||||
"description": "视觉设计和创意策划专家",
|
||||
"category": "创意设计",
|
||||
"industry": "艺术创意",
|
||||
"profession": "设计师",
|
||||
"sub_category": "视觉设计",
|
||||
"system_prompt": """你是一位富有创意的设计专家。
|
||||
专业技能:
|
||||
1. 视觉设计方案
|
||||
2. 品牌形象设计
|
||||
3. 创意概念开发
|
||||
4. 设计趋势分析
|
||||
|
||||
请提供富有创意且实用的设计建议。"""
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
36
flask_prompt_master/routes/prompts.py
Normal file
36
flask_prompt_master/routes/prompts.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from flask import Blueprint, render_template, request
|
||||
from flask_prompt_master.templates.prompts import TEMPLATE_CATEGORIES
|
||||
from flask_prompt_master.models import PromptTemplate
|
||||
|
||||
bp = Blueprint('prompts', __name__)
|
||||
|
||||
ITEMS_PER_PAGE = 9 # 每页显示的模板数量
|
||||
|
||||
@bp.route('/prompts')
|
||||
def list():
|
||||
page = request.args.get('page', 1, type=int)
|
||||
category = request.args.get('category', '全部')
|
||||
|
||||
# 获取模板数据
|
||||
query = PromptTemplate.query
|
||||
|
||||
if category != '全部':
|
||||
query = query.filter_by(category=category)
|
||||
|
||||
# 分页
|
||||
pagination = query.paginate(
|
||||
page=page,
|
||||
per_page=ITEMS_PER_PAGE,
|
||||
error_out=False
|
||||
)
|
||||
|
||||
templates = pagination.items
|
||||
|
||||
return render_template('prompt_list.html',
|
||||
templates=templates,
|
||||
categories=TEMPLATE_CATEGORIES,
|
||||
current_category=category,
|
||||
page=page,
|
||||
has_next=pagination.has_next,
|
||||
total_pages=pagination.pages
|
||||
)
|
||||
1
flask_prompt_master/templates/__init__.py
Normal file
1
flask_prompt_master/templates/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from .prompts import templates
|
||||
Binary file not shown.
Binary file not shown.
366
flask_prompt_master/templates/prompt_list.html
Normal file
366
flask_prompt_master/templates/prompt_list.html
Normal file
@@ -0,0 +1,366 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<!-- 页面标题区域 -->
|
||||
<div class="page-header">
|
||||
<h1>提示词模板库</h1>
|
||||
<p class="subtitle">选择适合您需求的专业模板</p>
|
||||
</div>
|
||||
|
||||
<!-- 分类导航 -->
|
||||
<div class="category-nav">
|
||||
<div class="category-item {% if current_category == '全部' %}active{% endif %}">
|
||||
<i class="fas fa-th-large"></i>
|
||||
<a href="{{ url_for('prompts.list', category='全部') }}">全部模板</a>
|
||||
</div>
|
||||
{% for category, info in categories.items() %}
|
||||
<div class="category-item {% if current_category == category %}active{% endif %}">
|
||||
<i class="{{ info.icon }}"></i>
|
||||
<a href="{{ url_for('prompts.list', category=category) }}">
|
||||
{{ category }}
|
||||
<span class="template-count">{{ info.templates|length }}</span>
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<!-- 搜索和筛选区域 -->
|
||||
<div class="filter-section">
|
||||
<div class="search-box">
|
||||
<i class="fas fa-search"></i>
|
||||
<input type="text" placeholder="搜索模板..." id="templateSearch">
|
||||
</div>
|
||||
<div class="view-toggle">
|
||||
<button class="view-btn active" data-view="grid">
|
||||
<i class="fas fa-th-large"></i>
|
||||
</button>
|
||||
<button class="view-btn" data-view="list">
|
||||
<i class="fas fa-list"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 模板列表 -->
|
||||
<div class="template-grid" id="templateContainer">
|
||||
{% for template in templates %}
|
||||
<div class="template-card" data-category="{{ template.category }}">
|
||||
<div class="card-header">
|
||||
<i class="{{ categories[template.category].icon if template.category in categories }}"></i>
|
||||
<h3>{{ template.name }}</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="description">{{ template.description }}</p>
|
||||
<div class="tags">
|
||||
<span class="tag industry">
|
||||
<i class="fas fa-building"></i>
|
||||
{{ template.industry }}
|
||||
</span>
|
||||
<span class="tag profession">
|
||||
<i class="fas fa-user-tie"></i>
|
||||
{{ template.profession }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button class="btn-preview" onclick="previewTemplate('{{ template.id }}')">
|
||||
<i class="fas fa-eye"></i> 预览
|
||||
</button>
|
||||
<button class="btn-use" onclick="useTemplate('{{ template.id }}')">
|
||||
<i class="fas fa-plus"></i> 使用模板
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<!-- 分页控件 -->
|
||||
<div class="pagination">
|
||||
{% if page > 1 %}
|
||||
<a href="{{ url_for('prompts.list', page=page-1, category=current_category) }}" class="page-btn">
|
||||
<i class="fas fa-chevron-left"></i> 上一页
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<div class="page-numbers">
|
||||
{% for p in range(1, total_pages + 1) %}
|
||||
<a href="{{ url_for('prompts.list', page=p, category=current_category) }}"
|
||||
class="page-number {% if p == page %}active{% endif %}">
|
||||
{{ p }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% if has_next %}
|
||||
<a href="{{ url_for('prompts.list', page=page+1, category=current_category) }}" class="page-btn">
|
||||
下一页 <i class="fas fa-chevron-right"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 模板预览模态框 -->
|
||||
<div class="modal" id="previewModal">
|
||||
<div class="modal-content">
|
||||
<span class="close">×</span>
|
||||
<div class="modal-body"></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block styles %}
|
||||
<style>
|
||||
:root {
|
||||
--primary-color: #2563eb;
|
||||
--secondary-color: #3b82f6;
|
||||
--background-color: #f8fafc;
|
||||
--text-color: #1e293b;
|
||||
--border-color: #e2e8f0;
|
||||
--hover-color: #dbeafe;
|
||||
--shadow-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
text-align: center;
|
||||
margin-bottom: 3rem;
|
||||
}
|
||||
|
||||
.page-header h1 {
|
||||
font-size: 2.5rem;
|
||||
color: var(--text-color);
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
color: #64748b;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.category-nav {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
margin-bottom: 2rem;
|
||||
overflow-x: auto;
|
||||
padding: 1rem;
|
||||
scrollbar-width: thin;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.category-item {
|
||||
padding: 0.75rem 1.25rem;
|
||||
border-radius: 999px;
|
||||
background: white;
|
||||
box-shadow: 0 1px 3px var(--shadow-color);
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.category-item:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 6px var(--shadow-color);
|
||||
}
|
||||
|
||||
.category-item.active {
|
||||
background: var(--primary-color);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.template-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
||||
gap: 2rem;
|
||||
margin-bottom: 3rem;
|
||||
}
|
||||
|
||||
.template-card {
|
||||
border-radius: 12px;
|
||||
background: white;
|
||||
box-shadow: 0 2px 4px var(--shadow-color);
|
||||
transition: all 0.3s ease;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.template-card:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 8px 16px var(--shadow-color);
|
||||
}
|
||||
|
||||
.card-header {
|
||||
padding: 1.25rem;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.card-header i {
|
||||
font-size: 1.5rem;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.card-body {
|
||||
padding: 1.25rem;
|
||||
}
|
||||
|
||||
.description {
|
||||
color: #64748b;
|
||||
margin-bottom: 1rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.tag {
|
||||
padding: 0.4rem 0.8rem;
|
||||
border-radius: 999px;
|
||||
font-size: 0.875rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.tag.industry {
|
||||
background: #dbeafe;
|
||||
color: #1e40af;
|
||||
}
|
||||
|
||||
.tag.profession {
|
||||
background: #dcfce7;
|
||||
color: #166534;
|
||||
}
|
||||
|
||||
.card-footer {
|
||||
padding: 1.25rem;
|
||||
border-top: 1px solid var(--border-color);
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.btn-preview, .btn-use {
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 6px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.btn-preview {
|
||||
background: #f1f5f9;
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.btn-use {
|
||||
background: var(--primary-color);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-preview:hover {
|
||||
background: #e2e8f0;
|
||||
}
|
||||
|
||||
.btn-use:hover {
|
||||
background: var(--secondary-color);
|
||||
}
|
||||
|
||||
/* 响应式设计 */
|
||||
@media (max-width: 768px) {
|
||||
.container {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.template-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.page-header h1 {
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.category-nav {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* 动画效果 */
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: translateY(20px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
.template-card {
|
||||
animation: fadeIn 0.5s ease-out;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// 搜索功能
|
||||
const searchInput = document.getElementById('templateSearch');
|
||||
const templateContainer = document.getElementById('templateContainer');
|
||||
const templateCards = templateContainer.getElementsByClassName('template-card');
|
||||
|
||||
searchInput.addEventListener('input', function(e) {
|
||||
const searchTerm = e.target.value.toLowerCase();
|
||||
|
||||
Array.from(templateCards).forEach(card => {
|
||||
const title = card.querySelector('h3').textContent.toLowerCase();
|
||||
const description = card.querySelector('.description').textContent.toLowerCase();
|
||||
|
||||
if (title.includes(searchTerm) || description.includes(searchTerm)) {
|
||||
card.style.display = '';
|
||||
} else {
|
||||
card.style.display = 'none';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 视图切换
|
||||
const viewButtons = document.querySelectorAll('.view-btn');
|
||||
viewButtons.forEach(btn => {
|
||||
btn.addEventListener('click', function() {
|
||||
viewButtons.forEach(b => b.classList.remove('active'));
|
||||
this.classList.add('active');
|
||||
|
||||
const viewType = this.dataset.view;
|
||||
templateContainer.className = `template-${viewType}`;
|
||||
});
|
||||
});
|
||||
|
||||
// 模板预览
|
||||
const modal = document.getElementById('previewModal');
|
||||
const closeBtn = modal.querySelector('.close');
|
||||
|
||||
window.previewTemplate = function(templateId) {
|
||||
modal.style.display = 'block';
|
||||
// 这里添加获取模板预览数据的逻辑
|
||||
}
|
||||
|
||||
closeBtn.onclick = function() {
|
||||
modal.style.display = 'none';
|
||||
}
|
||||
|
||||
window.onclick = function(event) {
|
||||
if (event.target == modal) {
|
||||
modal.style.display = 'none';
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
2467
flask_prompt_master/templates/prompts.py
Normal file
2467
flask_prompt_master/templates/prompts.py
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user