feat: 步骤6提交审核改用智能体执行

- 新增步骤6任务模板(config/agent_submit_template.txt)
- 步骤6调用智能体hz4th_editor执行提交操作
- 智能体根据产品类别选择对应API接口提交数据
- 页面新增步骤6模板编辑面板,支持查看/编辑/保存/预览
- 修正步骤5标题为'填充字段'(去掉'并提交')
- 新增API: GET/POST /api/process/submit-template
This commit is contained in:
2026-07-15 16:52:28 +08:00
parent 4177acf75c
commit 9b11c02cba
5 changed files with 380 additions and 30 deletions
+88
View File
@@ -11,6 +11,7 @@ document.addEventListener('DOMContentLoaded', () => {
loadHistory();
loadAgentTemplate();
loadFillFieldsTemplate();
loadSubmitTemplate();
// 启动自动刷新(每2秒)
startAutoRefresh();
@@ -588,3 +589,90 @@ async function doFillFieldsPreview() {
document.getElementById('template-preview-content').textContent = '预览失败: ' + error.message;
}
}
// ===== 步骤6提交审核模板 =====
// 加载步骤6模板
async function loadSubmitTemplate() {
try {
const response = await fetch(`${API_BASE}/api/process/submit-template`);
const data = await response.json();
if (data.success) {
document.getElementById('submit-template-editor').value = data.template;
} else {
document.getElementById('submit-template-editor').value = '// 模板加载失败: ' + (data.error || '未知错误');
}
} catch (error) {
console.error('加载提交模板失败:', error);
document.getElementById('submit-template-editor').value = '// 加载模板失败: ' + error.message;
}
}
// 保存步骤6模板
async function saveSubmitTemplate() {
const template = document.getElementById('submit-template-editor').value;
if (!template.trim()) {
showToast('模板内容不能为空', 'error');
return;
}
try {
const response = await fetch(`${API_BASE}/api/process/submit-template`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ template })
});
const data = await response.json();
if (data.success) {
showToast('步骤6模板已保存 ✓', 'success');
} else {
showToast('保存失败: ' + data.error, 'error');
}
} catch (error) {
showToast('保存失败: ' + error.message, 'error');
}
}
// 预览步骤6模板
function previewSubmitTemplate() {
document.getElementById('template-preview-modal').classList.add('active');
doSubmitPreview();
}
// 执行步骤6预览
async function doSubmitPreview() {
const product = document.getElementById('preview-product').value || '示例产品';
const category = document.getElementById('preview-category').value || 'AI模型';
try {
const response = await fetch(`${API_BASE}/api/process/submit-template/preview`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
product_name: product,
category: category,
subcategory: '',
product_data: JSON.stringify({
"name": product,
"organization": "示例组织",
"parameters": "70B",
"context_length": 4096,
"visible": true,
"is_pinned": false
}, null, 2)
})
});
const data = await response.json();
if (data.success) {
document.getElementById('template-preview-content').textContent = data.preview;
} else {
document.getElementById('template-preview-content').textContent = '预览失败: ' + data.error;
}
} catch (error) {
document.getElementById('template-preview-content').textContent = '预览失败: ' + error.message;
}
}