fix: stabilize background operations and large embedding results

This commit is contained in:
2026-09-06 16:26:17 +08:00
parent 874e916106
commit 3b9490e3fb
73 changed files with 3847 additions and 149 deletions
+31
View File
@@ -0,0 +1,31 @@
<!doctype html><html><head><meta charset="utf-8"><title>日志页面视觉验收</title></head>
<body><div id="app"></div><script type="module">
import { createApp, nextTick } from 'vue'
import LogsView from '/src/features/logs/LogsView.vue'
import { getCommunityThemePreviewCss } from '/src/services/themePackageService.ts'
import '/src/styles/tokens.css'
import '/src/styles/features.css'
const theme = new URLSearchParams(location.search).get('theme') || 'paper-moments'
document.documentElement.dataset.theme = theme
const style = document.createElement('style'); style.textContent = getCommunityThemePreviewCss(theme); document.head.append(style)
const entries = [
{ source: 'vectors', event: 'embedding.failed', level: 'ERROR', details: { model: 'Bge-small-zh', device: 'cuda', error_code: 'LOCAL_CUDA_OOM', fallback: 'cpu', job_id: 'index_demo', frames: 'runtime.py:180:infer' } },
{ source: 'agent', event: 'ToolResult', level: 'INFO', details: { run_id: 'run_demo', tool: 'tasks.create', status: 'running' } },
{ source: 'tasks', event: 'task.created', level: 'INFO', details: { task_id: 'task_demo', run_id: 'run_demo', status: 'todo' } },
{ source: 'models', event: 'model.embedding', level: 'WARNING', details: { model: 'Bge-small-zh', fallback: 'LOCAL_CUDA_OOM', device: 'cpu' } },
{ source: 'http', event: 'request.finished', level: 'INFO', details: { method: 'POST', route: '/api/tasks', status: 200, duration_ms: 32.5 } },
].map((entry, index) => ({ ...entry, id: 10-index, timestamp: '2026-09-06T08:00:00Z' }))
window.fetch = async input => {
const url = new URL(typeof input === 'string' ? input : input.url, location.href)
if (url.pathname !== '/api/logs') throw Error('Unexpected request in isolated log preview')
return new Response(JSON.stringify({ items: entries, next_cursor: null, sources: entries.map(x => x.source), pending: 0, dropped: 0, write_failures: 0, retention: 20000 }), { headers: { 'Content-Type': 'application/json' } })
}
createApp(LogsView).mount('#app')
window.prepareScrollBenchmark = async () => {
await new Promise(resolve => setTimeout(resolve, 300)); await nextTick()
document.querySelector('details').open = true
return { x: 700, y: 400 }
}
window.finishScrollBenchmark = async () => ({ theme, rows: document.querySelectorAll('details').length })
window.runBenchmark = window.prepareScrollBenchmark
</script></body></html>