主要功能更新: - 新增配置管理模块:支持YAML配置文件的在线编辑、验证和保存 - 实现评分规则管理:支持YAML格式评分配置,简化条件配置流程 - 完善前后端通信:优化API路径配置,解决跨域和网络连接问题 - 新增组件架构:AppContent、ConfigManager、ScoringRules、ThreatGraph等核心组件 - 集成js-yaml库:支持前端YAML格式解析和编辑 - 修复UI渲染问题:解决Naive UI组件空值引用和布局问题 技术改进: - 动态API地址配置,支持不同网络环境 - 增强错误处理和空值保护 - 优化表格布局和操作按钮排列 - 完善类型定义和接口规范 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
74 lines
2.9 KiB
HTML
74 lines
2.9 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>
|
|
</head>
|
|
<body>
|
|
<h1>AI SOC 分析师 - 前后端连接测试</h1>
|
|
|
|
<div>
|
|
<h2>API连接测试</h2>
|
|
<button id="testStatus">测试系统状态API</button>
|
|
<button id="testReports">测试报告API</button>
|
|
<button id="testSources">测试数据源API</button>
|
|
<div id="results"></div>
|
|
</div>
|
|
|
|
<script>
|
|
const API_BASE = 'http://localhost:8000/api/v1';
|
|
const results = document.getElementById('results');
|
|
|
|
function logResult(test, result, isSuccess = true) {
|
|
const div = document.createElement('div');
|
|
div.style.padding = '10px';
|
|
div.style.margin = '5px';
|
|
div.style.border = '1px solid';
|
|
div.style.borderColor = isSuccess ? 'green' : 'red';
|
|
div.style.backgroundColor = isSuccess ? '#e8f5e8' : '#ffe8e8';
|
|
div.innerHTML = `<strong>${test}:</strong> ${result}`;
|
|
results.appendChild(div);
|
|
}
|
|
|
|
document.getElementById('testStatus').onclick = async () => {
|
|
try {
|
|
const response = await fetch(`${API_BASE}/status`);
|
|
const data = await response.json();
|
|
logResult('系统状态API', `✅ 成功 - 状态: ${data.status}, 可用数据源: ${data.available_sources.length}`);
|
|
} catch (error) {
|
|
logResult('系统状态API', `❌ 失败 - ${error.message}`, false);
|
|
}
|
|
};
|
|
|
|
document.getElementById('testReports').onclick = async () => {
|
|
try {
|
|
const response = await fetch(`${API_BASE}/reports/`);
|
|
const data = await response.json();
|
|
logResult('报告API', `✅ 成功 - 报告数量: ${data.reports.length}, 总数: ${data.total}`);
|
|
} catch (error) {
|
|
logResult('报告API', `❌ 失败 - ${error.message}`, false);
|
|
}
|
|
};
|
|
|
|
document.getElementById('testSources').onclick = async () => {
|
|
try {
|
|
const response = await fetch(`${API_BASE}/upload/sources`);
|
|
const data = await response.json();
|
|
logResult('数据源API', `✅ 成功 - 可用数据源: ${data.sources.join(', ')}`);
|
|
} catch (error) {
|
|
logResult('数据源API', `❌ 失败 - ${error.message}`, false);
|
|
}
|
|
};
|
|
|
|
// 自动运行所有测试
|
|
window.onload = () => {
|
|
setTimeout(() => {
|
|
document.getElementById('testStatus').click();
|
|
setTimeout(() => document.getElementById('testReports').click(), 500);
|
|
setTimeout(() => document.getElementById('testSources').click(), 1000);
|
|
}, 1000);
|
|
};
|
|
</script>
|
|
</body>
|
|
</html> |