功能模块: - 仪表盘: 统计数据概览、快速操作入口 - 资料池管理: 查看、搜索、删除资料 - 文章历史: 查看历史文章列表和主题标签 - 工作流控制: 新建工作流、配置参数、启动流程 - 系统设置: LLM配置、文章类型、数据管理 技术栈: - Flask Web框架 - Tailwind CSS - RESTful API - 实时LLM连接测试
236 lines
11 KiB
HTML
236 lines
11 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>资料池管理 - 文章工作流</title>
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<link href="https://cdn.jsdelivr.net/npm/remixicon@3.5.0/fonts/remixicon.css" rel="stylesheet">
|
|
</head>
|
|
<body class="bg-gray-50 min-h-screen">
|
|
<div class="flex">
|
|
<!-- 侧边栏 -->
|
|
<aside class="w-64 bg-slate-800 min-h-screen fixed left-0 top-0">
|
|
<div class="p-6">
|
|
<h1 class="text-white text-xl font-bold flex items-center gap-2">
|
|
<i class="ri-article-line text-2xl text-blue-400"></i>
|
|
文章工作流
|
|
</h1>
|
|
</div>
|
|
<nav class="mt-6">
|
|
<a href="/" class="flex items-center gap-3 px-6 py-3 text-slate-300 hover:bg-slate-700 hover:text-white">
|
|
<i class="ri-dashboard-line"></i><span>仪表盘</span>
|
|
</a>
|
|
<a href="/resources" class="flex items-center gap-3 px-6 py-3 bg-slate-700 text-white">
|
|
<i class="ri-database-2-line"></i><span>资料池</span>
|
|
</a>
|
|
<a href="/articles" class="flex items-center gap-3 px-6 py-3 text-slate-300 hover:bg-slate-700 hover:text-white">
|
|
<i class="ri-file-list-3-line"></i><span>文章历史</span>
|
|
</a>
|
|
<a href="/workflow" class="flex items-center gap-3 px-6 py-3 text-slate-300 hover:bg-slate-700 hover:text-white">
|
|
<i class="ri-flow-chart"></i><span>工作流</span>
|
|
</a>
|
|
<a href="/settings" class="flex items-center gap-3 px-6 py-3 text-slate-300 hover:bg-slate-700 hover:text-white">
|
|
<i class="ri-settings-3-line"></i><span>系统设置</span>
|
|
</a>
|
|
</nav>
|
|
</aside>
|
|
|
|
<!-- 主内容 -->
|
|
<main class="ml-64 flex-1 p-8">
|
|
<div class="flex items-center justify-between mb-6">
|
|
<h1 class="text-2xl font-bold text-gray-800">资料池管理</h1>
|
|
<div class="flex gap-3">
|
|
<button onclick="exportResources()" class="px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 flex items-center gap-2">
|
|
<i class="ri-download-line"></i> 导出
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 筛选栏 -->
|
|
<div class="bg-white rounded-xl p-4 shadow-sm border border-gray-100 mb-6">
|
|
<div class="flex gap-4 items-center">
|
|
<div class="flex-1">
|
|
<input type="text" id="searchInput" placeholder="搜索资料..."
|
|
class="w-full px-4 py-2 border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
|
onkeyup="filterResources()">
|
|
</div>
|
|
<select id="filterAnalyzed" onchange="filterResources()"
|
|
class="px-4 py-2 border border-gray-200 rounded-lg">
|
|
<option value="all">全部</option>
|
|
<option value="analyzed">已分析</option>
|
|
<option value="unanalyzed">未分析</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 资料列表 -->
|
|
<div class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
|
|
<table class="w-full">
|
|
<thead class="bg-gray-50 border-b border-gray-100">
|
|
<tr>
|
|
<th class="px-6 py-3 text-left text-sm font-medium text-gray-500">标题</th>
|
|
<th class="px-6 py-3 text-left text-sm font-medium text-gray-500">来源</th>
|
|
<th class="px-6 py-3 text-left text-sm font-medium text-gray-500">状态</th>
|
|
<th class="px-6 py-3 text-left text-sm font-medium text-gray-500">添加时间</th>
|
|
<th class="px-6 py-3 text-left text-sm font-medium text-gray-500">操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="resourceTable">
|
|
<tr><td colspan="5" class="px-6 py-8 text-center text-gray-500">加载中...</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- 详情弹窗 -->
|
|
<div id="detailModal" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center z-50">
|
|
<div class="bg-white rounded-xl w-3/4 max-h-[80vh] overflow-hidden flex flex-col">
|
|
<div class="p-6 border-b border-gray-100 flex justify-between items-center">
|
|
<h2 class="text-xl font-bold text-gray-800" id="modalTitle">资料详情</h2>
|
|
<button onclick="closeModal()" class="text-gray-400 hover:text-gray-600">
|
|
<i class="ri-close-line text-2xl"></i>
|
|
</button>
|
|
</div>
|
|
<div class="p-6 overflow-auto flex-1" id="modalContent">
|
|
<!-- 内容将动态填充 -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
|
|
<script>
|
|
let allResources = [];
|
|
|
|
async function loadResources() {
|
|
const response = await fetch('/api/resources');
|
|
allResources = await response.json();
|
|
renderResources(allResources);
|
|
}
|
|
|
|
function renderResources(resources) {
|
|
const tbody = document.getElementById('resourceTable');
|
|
|
|
if (resources.length === 0) {
|
|
tbody.innerHTML = '<tr><td colspan="5" class="px-6 py-8 text-center text-gray-500">暂无资料</td></tr>';
|
|
return;
|
|
}
|
|
|
|
tbody.innerHTML = resources.map(r => `
|
|
<tr class="border-b border-gray-50 hover:bg-gray-50">
|
|
<td class="px-6 py-4">
|
|
<div class="font-medium text-gray-800 truncate max-w-md">${r.title || '无标题'}</div>
|
|
</td>
|
|
<td class="px-6 py-4">
|
|
<a href="${r.url}" target="_blank" class="text-blue-500 hover:underline text-sm truncate max-w-xs block">${r.url || '-'}</a>
|
|
</td>
|
|
<td class="px-6 py-4">
|
|
${r.analyzed
|
|
? '<span class="px-2 py-1 bg-green-100 text-green-700 rounded text-xs">已分析</span>'
|
|
: '<span class="px-2 py-1 bg-yellow-100 text-yellow-700 rounded text-xs">待分析</span>'}
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-gray-500">
|
|
${r.added_at ? new Date(r.added_at).toLocaleString() : '-'}
|
|
</td>
|
|
<td class="px-6 py-4">
|
|
<button onclick="viewDetail('${r.id}')" class="text-blue-500 hover:text-blue-700 mr-3">
|
|
<i class="ri-eye-line"></i> 查看
|
|
</button>
|
|
<button onclick="deleteResource('${r.id}')" class="text-red-500 hover:text-red-700">
|
|
<i class="ri-delete-bin-line"></i>
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
`).join('');
|
|
}
|
|
|
|
function filterResources() {
|
|
const keyword = document.getElementById('searchInput').value.toLowerCase();
|
|
const analyzedFilter = document.getElementById('filterAnalyzed').value;
|
|
|
|
let filtered = allResources;
|
|
|
|
if (keyword) {
|
|
filtered = filtered.filter(r =>
|
|
(r.title && r.title.toLowerCase().includes(keyword)) ||
|
|
(r.url && r.url.toLowerCase().includes(keyword))
|
|
);
|
|
}
|
|
|
|
if (analyzedFilter === 'analyzed') {
|
|
filtered = filtered.filter(r => r.analyzed);
|
|
} else if (analyzedFilter === 'unanalyzed') {
|
|
filtered = filtered.filter(r => !r.analyzed);
|
|
}
|
|
|
|
renderResources(filtered);
|
|
}
|
|
|
|
async function viewDetail(id) {
|
|
const response = await fetch(`/api/resources/${id}`);
|
|
const data = await response.json();
|
|
|
|
document.getElementById('modalTitle').textContent = data.title || '资料详情';
|
|
document.getElementById('modalContent').innerHTML = `
|
|
<div class="space-y-4">
|
|
<div>
|
|
<h3 class="font-medium text-gray-700 mb-2">基本信息</h3>
|
|
<div class="grid grid-cols-2 gap-4 text-sm">
|
|
<div><span class="text-gray-500">来源:</span><a href="${data.url}" target="_blank" class="text-blue-500">${data.url}</a></div>
|
|
<div><span class="text-gray-500">类型:</span>${data.type || '-'}</div>
|
|
<div><span class="text-gray-500">添加时间:</span>${data.added_at || '-'}</div>
|
|
<div><span class="text-gray-500">状态:</span>${data.analyzed ? '已分析' : '待分析'}</div>
|
|
</div>
|
|
</div>
|
|
${data.summary ? `
|
|
<div>
|
|
<h3 class="font-medium text-gray-700 mb-2">分析摘要</h3>
|
|
<div class="bg-gray-50 p-4 rounded-lg text-sm whitespace-pre-wrap">${data.summary}</div>
|
|
</div>
|
|
` : ''}
|
|
${data.content ? `
|
|
<div>
|
|
<h3 class="font-medium text-gray-700 mb-2">原始内容</h3>
|
|
<div class="bg-gray-50 p-4 rounded-lg text-sm max-h-64 overflow-auto whitespace-pre-wrap">${data.content.substring(0, 2000)}...</div>
|
|
</div>
|
|
` : ''}
|
|
</div>
|
|
`;
|
|
|
|
document.getElementById('detailModal').classList.remove('hidden');
|
|
document.getElementById('detailModal').classList.add('flex');
|
|
}
|
|
|
|
function closeModal() {
|
|
document.getElementById('detailModal').classList.add('hidden');
|
|
document.getElementById('detailModal').classList.remove('flex');
|
|
}
|
|
|
|
async function deleteResource(id) {
|
|
if (!confirm('确定要删除这个资料吗?')) return;
|
|
|
|
const response = await fetch(`/api/resources/${id}`, { method: 'DELETE' });
|
|
const data = await response.json();
|
|
|
|
if (data.success) {
|
|
loadResources();
|
|
}
|
|
}
|
|
|
|
async function exportResources() {
|
|
const response = await fetch('/api/export/resources');
|
|
const data = await response.json();
|
|
|
|
const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' });
|
|
const url = URL.createObjectURL(blob);
|
|
const a = document.createElement('a');
|
|
a.href = url;
|
|
a.download = 'resources_export.json';
|
|
a.click();
|
|
}
|
|
|
|
// 初始化
|
|
loadResources();
|
|
</script>
|
|
</body>
|
|
</html> |