前端增加专家模式提示词

This commit is contained in:
2025-04-02 23:48:31 +08:00
parent 59ff67595c
commit 2c3b83bba7
5 changed files with 939 additions and 121 deletions

View File

@@ -11,135 +11,145 @@
</div>
</div>
<div class="main-container">
<form method="POST" class="generate-form">
{{ form.hidden_tag() }}
<div class="search-section">
<div class="search-box">
<input type="text" id="templateSearch" class="search-input" placeholder="搜索模板名称或描述...">
<i class="fas fa-search search-icon"></i>
<div class="container mt-4">
<div class="row">
<div class="col-md-8 offset-md-2">
<div class="d-flex justify-content-between align-items-center mb-4">
<h2>提示词生成器</h2>
<a href="{{ url_for('main.expert_generate') }}" class="btn btn-primary">
<i class="fas fa-brain"></i> 专家模式
</a>
</div>
<div class="search-stats">
<span class="search-count"></span>
</div>
</div>
<div class="templates-section">
<div class="section-header">
<h2>选择场景</h2>
<div class="filter-controls">
<select id="industryFilter" class="custom-select">
<option value="all">全部行业</option>
{% for industry in industries %}
<option value="{{ industry }}">{{ industry }}</option>
{% endfor %}
</select>
<select id="professionFilter" class="custom-select">
<option value="all">全部职业</option>
{% for profession in professions %}
<option value="{{ profession }}">{{ profession }}</option>
{% endfor %}
</select>
<select id="subCategoryFilter" class="custom-select">
<option value="all">全部领域</option>
{% for sub_category in sub_categories %}
<option value="{{ sub_category }}">{{ sub_category }}</option>
{% endfor %}
</select>
<form method="POST" class="generate-form">
{{ form.hidden_tag() }}
<div class="search-section">
<div class="search-box">
<input type="text" id="templateSearch" class="search-input" placeholder="搜索模板名称或描述...">
<i class="fas fa-search search-icon"></i>
</div>
<div class="search-stats">
<span class="search-count"></span>
</div>
</div>
</div>
<div class="category-tabs">
<div class="tab active" data-category="all">全部</div>
{% for category in categories %}
<div class="tab" data-category="{{ category }}">{{ category }}</div>
{% endfor %}
</div>
<div class="template-grid">
{% for template in templates %}
<div class="template-card"
data-category="{{ template.category }}"
data-industry="{{ template.industry }}"
data-profession="{{ template.profession }}"
data-subcategory="{{ template.sub_category }}">
<input type="radio" name="template_id" id="template_{{ template.id }}"
value="{{ template.id }}"
{% if template.is_default %}checked{% endif %}>
<label for="template_{{ template.id }}" class="template-content">
<div class="template-actions">
<button type="button" class="btn-delete"
data-template-id="{{ template.id }}"
title="删除模板">
<i class="fas fa-trash-alt"></i>
<div class="templates-section">
<div class="section-header">
<h2>选择场景</h2>
<div class="filter-controls">
<select id="industryFilter" class="custom-select">
<option value="all">全部行业</option>
{% for industry in industries %}
<option value="{{ industry }}">{{ industry }}</option>
{% endfor %}
</select>
<select id="professionFilter" class="custom-select">
<option value="all">全部职业</option>
{% for profession in professions %}
<option value="{{ profession }}">{{ profession }}</option>
{% endfor %}
</select>
<select id="subCategoryFilter" class="custom-select">
<option value="all">全部领域</option>
{% for sub_category in sub_categories %}
<option value="{{ sub_category }}">{{ sub_category }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="category-tabs">
<div class="tab active" data-category="all">全部</div>
{% for category in categories %}
<div class="tab" data-category="{{ category }}">{{ category }}</div>
{% endfor %}
</div>
<div class="template-grid">
{% for template in templates %}
<div class="template-card"
data-category="{{ template.category }}"
data-industry="{{ template.industry }}"
data-profession="{{ template.profession }}"
data-subcategory="{{ template.sub_category }}">
<input type="radio" name="template_id" id="template_{{ template.id }}"
value="{{ template.id }}"
{% if template.is_default %}checked{% endif %}>
<label for="template_{{ template.id }}" class="template-content">
<div class="template-actions">
<button type="button" class="btn-delete"
data-template-id="{{ template.id }}"
title="删除模板">
<i class="fas fa-trash-alt"></i>
</button>
</div>
<div class="template-categories">
<div class="category-group">
<span class="category-label">行业:</span>
<span class="category-value">{{ template.industry }}</span>
</div>
<div class="category-group">
<span class="category-label">职业:</span>
<span class="category-value">{{ template.profession }}</span>
</div>
<div class="category-group">
<span class="category-label">领域:</span>
<span class="category-value">{{ template.sub_category }}</span>
</div>
</div>
<div class="template-header">
<div class="template-icon">
<i class="fas {{ get_template_icon(template.category) }}"></i>
</div>
<h3>{{ template.name }}</h3>
</div>
<div class="template-info">
<p>{{ template.description }}</p>
</div>
</label>
</div>
{% endfor %}
</div>
</div>
<div class="input-section">
<div class="section-header">
<h2>输入需求</h2>
<span class="subtitle">描述越详细,生成的提示词效果越好</span>
</div>
{{ form.input_text(class="form-control custom-textarea", rows=5,
placeholder="请详细描述您的需求...") }}
</div>
<div class="action-section">
{{ form.submit(class="btn btn-primary btn-generate", value="生成专业提示词") }}
</div>
</form>
{% if prompt %}
<div class="result-section">
<div class="result-card">
<div class="result-header">
<h2>生成结果</h2>
<div class="result-actions">
<button class="btn btn-copy" onclick="copyText('{{ prompt.generated_text }}')">
<i class="fas fa-copy"></i>
复制提示词
</button>
</div>
<div class="template-categories">
<div class="category-group">
<span class="category-label">行业:</span>
<span class="category-value">{{ template.industry }}</span>
</div>
<div class="category-group">
<span class="category-label">职业:</span>
<span class="category-value">{{ template.profession }}</span>
</div>
<div class="category-group">
<span class="category-label">领域:</span>
<span class="category-value">{{ template.sub_category }}</span>
</div>
</div>
<div class="result-content">
<div class="output-preview">
<div class="text-content">{{ prompt.generated_text }}</div>
</div>
<div class="template-header">
<div class="template-icon">
<i class="fas {{ get_template_icon(template.category) }}"></i>
</div>
<h3>{{ template.name }}</h3>
</div>
<div class="template-info">
<p>{{ template.description }}</p>
</div>
</label>
</div>
{% endfor %}
</div>
</div>
<div class="input-section">
<div class="section-header">
<h2>输入需求</h2>
<span class="subtitle">描述越详细,生成的提示词效果越好</span>
</div>
{{ form.input_text(class="form-control custom-textarea", rows=5,
placeholder="请详细描述您的需求...") }}
</div>
<div class="action-section">
{{ form.submit(class="btn btn-primary btn-generate", value="生成专业提示词") }}
</div>
</form>
{% if prompt %}
<div class="result-section">
<div class="result-card">
<div class="result-header">
<h2>生成结果</h2>
<div class="result-actions">
<button class="btn btn-copy" onclick="copyText('{{ prompt.generated_text }}')">
<i class="fas fa-copy"></i>
复制提示词
</button>
</div>
</div>
<div class="result-content">
<div class="output-preview">
<div class="text-content">{{ prompt.generated_text }}</div>
</div>
</div>
</div>
{% endif %}
</div>
</div>
{% endif %}
</div>
<div class="filter-stats">