feat: ReportView reads report.md from files API, server-side .md rendering with pulldown-cmark

This commit is contained in:
2026-04-06 20:09:10 +01:00
parent 902b5192d5
commit dd2c4449fd
2 changed files with 9 additions and 4 deletions

View File

@@ -289,7 +289,7 @@ function goHome() {
<template>
<div v-if="isReportPage" class="report-fullpage">
<ReportView :workflowId="reportWorkflowId" :key="reportWorkflowId" />
<ReportView :workflowId="reportWorkflowId" :projectId="selectedProjectId" :key="reportWorkflowId" />
</div>
<div v-else class="app-layout">
<header class="app-header">

View File

@@ -2,10 +2,10 @@
import { ref, onMounted, nextTick } from 'vue'
import { marked } from 'marked'
import mermaid from 'mermaid'
import { api } from '../api'
const props = defineProps<{
workflowId: string
projectId: string
}>()
const html = ref('')
@@ -38,8 +38,13 @@ async function renderMermaid() {
onMounted(async () => {
try {
const res = await api.getReport(props.workflowId)
html.value = await marked.parse(res.report)
const res = await fetch(`/tori/api/projects/${props.projectId}/files/report.md?raw`)
if (res.ok) {
const md = await res.text()
html.value = await marked.parse(md)
} else {
error.value = '暂无报告。Agent 完成后会生成 report.md。'
}
} catch (e: any) {
error.value = e.message
} finally {