更新:models/routes/services/templates/docs
This commit is contained in:
@@ -145,18 +145,36 @@ function renderTemplateList() {
|
||||
list.innerHTML = '<div class="p-3 text-muted">暂无模板</div>';
|
||||
return;
|
||||
}
|
||||
list.innerHTML = templates.map(t => `
|
||||
<div class="template-card card m-2 p-2 ${currentTemplate && currentTemplate.id === t.id ? 'active' : ''}"
|
||||
onclick="selectTemplate(${t.id})">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<strong>${t.name}</strong>
|
||||
<br><small class="text-muted">${t.type === 'ai_prompt' ? 'AI提示词' : '报告模板'}</small>
|
||||
|
||||
// 按类型分组
|
||||
const groups = {};
|
||||
templates.forEach(t => {
|
||||
if (!groups[t.type]) groups[t.type] = [];
|
||||
groups[t.type].push(t);
|
||||
});
|
||||
|
||||
const typeNames = { 'ai_prompt': 'AI提示词模板', 'report': '报告导出模板' };
|
||||
|
||||
let html = '';
|
||||
Object.keys(groups).forEach(type => {
|
||||
html += `<div class="mb-3">
|
||||
<h6 class="text-muted border-bottom pb-1 mb-2">${typeNames[type] || type}</h6>`;
|
||||
groups[type].forEach(t => {
|
||||
html += `
|
||||
<div class="template-card card m-2 p-2 ${currentTemplate && currentTemplate.id === t.id ? 'active' : ''}"
|
||||
onclick="selectTemplate(${t.id})">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<strong>${t.name}</strong>
|
||||
<br><small class="text-muted">${t.description || ''}</small>
|
||||
</div>
|
||||
<i class="bi bi-chevron-right"></i>
|
||||
</div>
|
||||
<i class="bi bi-chevron-right"></i>
|
||||
</div>
|
||||
</div>
|
||||
`).join('');
|
||||
</div>`;
|
||||
});
|
||||
html += '</div>';
|
||||
});
|
||||
list.innerHTML = html;
|
||||
}
|
||||
|
||||
async function selectTemplate(id) {
|
||||
|
||||
Reference in New Issue
Block a user