Phase 1 关键Bug修复: 1. 代码块复制功能 - 删除 index.html 中的全局事件监听(47-53行) - 避免与 Vue 方法的双重监听冲突 2. 事件去重机制 - 在 handleTaskEvent() 添加基于 idx 的去重检查 - 使用 Set 存储已处理的事件索引(最多1000个) - 在 restoreTaskState() 时清理已处理事件 3. 任务结束逻辑 - 修复 handleTaskComplete() 异步状态清理问题 - 新增 clearTaskState() 统一清理方法 - 在 stopPolling() 中清除 currentTaskId 4. 停止按钮状态同步 - 改进 stopTask() 错误处理 - 添加后端确认等待(300ms) - 确保失败时也清理前端状态 - 添加 finally 块清除 dropToolEvents Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
55 lines
2.4 KiB
HTML
55 lines
2.4 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>AI Agent System</title>
|
|
<link rel="stylesheet" href="/static/style.css">
|
|
<link rel="stylesheet" href="/static/easter-eggs/flood.css">
|
|
<link rel="stylesheet" href="/static/easter-eggs/snake.css">
|
|
</head>
|
|
<body>
|
|
<div id="app"></div>
|
|
<script>
|
|
// 全局复制代码块函数
|
|
function decodeHtmlEntities(text) {
|
|
const textarea = document.createElement('textarea');
|
|
textarea.innerHTML = text || '';
|
|
return textarea.value;
|
|
}
|
|
function copyCodeBlock(blockId) {
|
|
const codeElement = document.querySelector(`[data-code-id="${blockId}"]`);
|
|
if (!codeElement) return;
|
|
const button = document.querySelector(`[data-code="${blockId}"]`);
|
|
if (button && button.classList.contains('copied')) return;
|
|
const raw = codeElement?.dataset?.originalCode || codeElement?.textContent || '';
|
|
const codeContent = decodeHtmlEntities(raw);
|
|
if (!button) {
|
|
navigator.clipboard.writeText(codeContent).catch((err) => console.error('复制失败:', err));
|
|
return;
|
|
}
|
|
if (!button.dataset.originalLabel) {
|
|
button.dataset.originalLabel = button.getAttribute('aria-label') || '复制代码';
|
|
}
|
|
navigator.clipboard.writeText(codeContent).then(() => {
|
|
button.classList.add('copied');
|
|
button.setAttribute('aria-label', '已复制');
|
|
setTimeout(() => {
|
|
button.classList.remove('copied');
|
|
button.setAttribute('aria-label', button.dataset.originalLabel);
|
|
}, 2000);
|
|
}).catch((err) => {
|
|
console.error('复制失败:', err);
|
|
button.classList.remove('copied');
|
|
button.setAttribute('aria-label', button.dataset.originalLabel || '复制代码');
|
|
});
|
|
}
|
|
</script>
|
|
<script src="/static/easter-eggs/registry.js"></script>
|
|
<script src="/static/easter-eggs/flood.js"></script>
|
|
<script src="/static/easter-eggs/snake.js"></script>
|
|
<script src="/static/security.js"></script>
|
|
<script type="module" src="/static/dist/assets/main.js"></script>
|
|
</body>
|
|
</html>
|