feat(desktop,gateway): 报告归口运行页 —— 能找回、能复盘、能导出

承接上一个提交(报告终于落库进运行历史),把「所有执行归口运行页」做完整:
只能看不能存,不算归口。

- 运行页的输出面板:报告类运行显示「报告正文」并在右上角出 Word/Markdown
  导出。报告页那两个导出按钮依赖它自己一切页面就没的本地状态,所以从历史
  里找回来的报告,只能在运行页导。
- 运行历史列表显示报告主题。此前只有 report_<hex>,谁也认不出是哪份报告。
  主题从 graph->>'topic' 取(报告的 graph 就是占位 DSL {"topic":"…"},普通
  任务 DSL 没有顶层 topic → 空串,不会误伤)。
- isReportRun() 按 task_id 的 report_ 前缀判定 —— 这是既有契约,导出接口
  /reports/:id/export 本来就按同一个 id 寻址。+4 单测(含"不能只看是否包含
  report"的误判防线)。
- reportFilename 从 ReportView 提到 lib:运行页也要用,不能私藏在一个 view 里。

live 验证(真账号,桌面端实机):运行历史首条显示「Redis 缓存穿透的三种解法」
→ 点开复盘 8 节点 + 全文 → 点 Word → **原生另存为对话框弹出**(文件名预填
主题)→ 保存 → 落盘 5KB,file 认 Microsoft Word 2007+,解 zip 得
word/document.xml,正文 2446 字。

**顺带把 wails3 迁移最后一个盲区验掉了**:v3 把 runtime.SaveFileDialog 重写成
application.Get().Dialog.SaveFile().SetFilename().AddFilter()
.PromptForSingleSelection(),此前从没被点过一次,记忆里只敢写"理应工作"。
现在实测通了。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Blizzard
2026-07-16 13:20:57 +08:00
parent fd268664c8
commit fd99ba6226
6 changed files with 78 additions and 15 deletions
+5 -1
View File
@@ -295,6 +295,9 @@ type RunRow struct {
At time.Time `json:"at"`
EvalLevel string `json:"eval_level"`
EvalOverall float64 `json:"eval_overall"`
// Topic:报告类运行的主题。报告的 graph 是占位 DSL `{"topic":"…"}`,普通任务的 DSL
// 没有顶层 topic → 空串。否则运行历史里报告只能显示 report_<hex> 这种 id,读不出是啥。
Topic string `json:"topic"`
}
// RecentRuns 返回某用户最近 n 条运行(含评测分级,供「运行历史」列表)。
@@ -306,7 +309,8 @@ func (p *Postgres) RecentRuns(ctx context.Context, owner string, n int) []RunRow
var out []RunRow
q := p.db.WithContext(ctx).Table("sundynix_task as t").
Select("t.task_id, t.status, t.detail, t.created_at as at, " +
"coalesce(e.level,'') as eval_level, coalesce(e.overall,0) as eval_overall").
"coalesce(e.level,'') as eval_level, coalesce(e.overall,0) as eval_overall, " +
"coalesce(t.graph->>'topic','') as topic").
Joins("left join sundynix_eval e on e.task_id = t.task_id").
Where("t.deleted_at is null AND t.owner = ?", owner)
if tid := tenantFromCtx(ctx); tid != "" && !isSystemCtx(ctx) {