Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions frontend/src/components/HistoryDatabase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,25 @@
<span class="btn-icon">◇</span>
<span class="btn-text">{{ $t('history.step1Button') }}</span>
</button>
<button
class="modal-btn btn-simulation"
<button
class="modal-btn btn-simulation"
@click="goToSimulation"
>
<span class="btn-step">Step2</span>
<span class="btn-icon">◈</span>
<span class="btn-text">{{ $t('history.step2Button') }}</span>
</button>
<button
class="modal-btn btn-report"
<button
class="modal-btn btn-simulation"
@click="goToSimulationRun"
:disabled="!selectedProject.simulation_id"
>
<span class="btn-step">Step3</span>
<span class="btn-icon">◈</span>
<span class="btn-text">{{ $t('history.step3Button') }}</span>
</button>
<button
class="modal-btn btn-report"
@click="goToReport"
:disabled="!selectedProject.report_id"
>
Expand Down Expand Up @@ -425,6 +434,17 @@ const goToSimulation = () => {
}
}

// 导航到模拟运行/对话时间轴页面(Step3,已完成的模拟为只读查看)
const goToSimulationRun = () => {
if (selectedProject.value?.simulation_id) {
router.push({
name: 'SimulationRun',
params: { simulationId: selectedProject.value.simulation_id }
})
closeModal()
}
}

// 导航到分析报告页面(Report)
const goToReport = () => {
if (selectedProject.value?.report_id) {
Expand Down
35 changes: 34 additions & 1 deletion frontend/src/components/Step3Simulation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -687,10 +687,43 @@ watch(() => props.systemLogs?.length, () => {
})
})

// 初始化:已运行过的模拟用只读模式加载现有时间轴,避免 onMounted 自动 force-restart
const initSimulation = async () => {
if (!props.simulationId) return
try {
const res = await getRunStatus(props.simulationId)
const data = res && res.data
const alreadyRan = data && (
data.runner_status === 'completed' ||
data.runner_status === 'stopped' ||
data.runner_status === 'running' ||
(data.total_actions_count || 0) > 0
)
if (alreadyRan) {
addLog('Loading existing run (view mode — no restart)')
runStatus.value = data
await fetchRunStatusDetail() // 加载已有动作到时间轴
if (data.runner_status === 'running') {
phase.value = 1
startStatusPolling()
startDetailPolling()
} else {
phase.value = 2
emit('update-status', 'completed')
}
return
}
} catch (err) {
console.warn('初始化状态检查失败,将按新模拟启动:', err)
}
// 全新模拟才启动
doStartSimulation()
}

onMounted(() => {
addLog(t('log.step3Init'))
if (props.simulationId) {
doStartSimulation()
initSimulation()
}
})

Expand Down
3 changes: 2 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,9 @@
"replayTitle": "Simulation Replay",
"step1Button": "Graph Build",
"step2Button": "Env Setup",
"step3Button": "Conversation",
"step4Button": "Analysis Report",
"replayHint": "Step 3 'Run Simulation' and Step 5 'Deep Interaction' must be started during runtime and do not support history replay",
"replayHint": "Step 5 'Deep Interaction' must be started during runtime; completed runs can be viewed read-only via 'Conversation'",
"notStarted": "Not started",
"roundsProgress": "{current}/{total} rounds",
"untitledSimulation": "Untitled simulation",
Expand Down
3 changes: 2 additions & 1 deletion locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,9 @@
"replayTitle": "推演回放",
"step1Button": "图谱构建",
"step2Button": "环境搭建",
"step3Button": "模拟对话",
"step4Button": "分析报告",
"replayHint": "Step3「开始模拟」与 Step5「深度互动」需在运行中启动,不支持历史回放",
"replayHint": "Step5「深度互动」需在运行中启动;已完成的模拟可通过「模拟对话」只读查看",
"notStarted": "未开始",
"roundsProgress": "{current}/{total} 轮",
"untitledSimulation": "未命名模拟",
Expand Down