feat: ReportView reads report.md from files API, server-side .md rendering with pulldown-cmark
This commit is contained in:
parent
902b5192d5
commit
dd2c4449fd
@ -289,7 +289,7 @@ function goHome() {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="isReportPage" class="report-fullpage">
|
<div v-if="isReportPage" class="report-fullpage">
|
||||||
<ReportView :workflowId="reportWorkflowId" :key="reportWorkflowId" />
|
<ReportView :workflowId="reportWorkflowId" :projectId="selectedProjectId" :key="reportWorkflowId" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="app-layout">
|
<div v-else class="app-layout">
|
||||||
<header class="app-header">
|
<header class="app-header">
|
||||||
|
|||||||
@ -2,10 +2,10 @@
|
|||||||
import { ref, onMounted, nextTick } from 'vue'
|
import { ref, onMounted, nextTick } from 'vue'
|
||||||
import { marked } from 'marked'
|
import { marked } from 'marked'
|
||||||
import mermaid from 'mermaid'
|
import mermaid from 'mermaid'
|
||||||
import { api } from '../api'
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
workflowId: string
|
workflowId: string
|
||||||
|
projectId: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const html = ref('')
|
const html = ref('')
|
||||||
@ -38,8 +38,13 @@ async function renderMermaid() {
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const res = await api.getReport(props.workflowId)
|
const res = await fetch(`/tori/api/projects/${props.projectId}/files/report.md?raw`)
|
||||||
html.value = await marked.parse(res.report)
|
if (res.ok) {
|
||||||
|
const md = await res.text()
|
||||||
|
html.value = await marked.parse(md)
|
||||||
|
} else {
|
||||||
|
error.value = '暂无报告。Agent 完成后会生成 report.md。'
|
||||||
|
}
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
error.value = e.message
|
error.value = e.message
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user