feat: task_io 交付件改共享渲染(md→MdWidget+下载,office/pdf→下载)

This commit is contained in:
ymq 2026-09-03 16:41:28 +08:00
parent 9045323adb
commit 624a820417

View File

@ -56,11 +56,14 @@ async with DBPools().sqlorContext(dbname) as sor:
except Exception:
description = params_str
# 输出:交付件
# 输出:交付件(md→MdWidget渲染+下载;office/pdf→下载链接;全产线统一)
dels = await sor.sqlExe(
"SELECT deliverable_type, title, content, review_status, quality_score, review_comment "
"SELECT deliverable_type, title, content, file_path, project_id, review_status, "
"quality_score, review_comment "
"FROM pipeline_deliverables WHERE task_id=${t}$ ORDER BY created_at DESC", {"t": task_id})
proj_file_url = entire_url("/pipeline-sdlc/api/project_file.dspy")
sc = _state_colors.get(state, '#64748b')
subwidgets = []
@ -108,33 +111,18 @@ async with DBPools().sqlorContext(dbname) as sor:
"options": {"text": "(暂无交付件)", "halign": "left", "cfontsize": 0.8, "color": "#94a3b8"},
})
else:
from pipeline_service.task_io_render import deliverable_card
for d in dels:
d_type = getattr(d, 'deliverable_type', '') or ''
d_title = getattr(d, 'title', '') or ''
d_content = getattr(d, 'content', '') or ''
d_status = getattr(d, 'review_status', '') or ''
d_score = getattr(d, 'quality_score', '') or ''
d_comment = getattr(d, 'review_comment', '') or ''
card = {
"widgettype": "VBox",
"options": {"css": "card", "gap": "4px", "width": "100%", "padding": "8px"},
"subwidgets": [
{"widgettype": "HBox", "options": {"gap": "8px", "width": "100%"},
"subwidgets": [
{"widgettype": "Text", "options": {"text": d_type, "cfontsize": 0.8, "color": "#3b82f6", "halign": "left"}},
{"widgettype": "Text", "options": {"text": d_title, "cfontsize": 0.8, "color": "#1e293b", "halign": "left"}},
{"widgettype": "Filler"},
{"widgettype": "Text", "options": {"text": d_status, "cfontsize": 0.75, "color": "#94a3b8", "halign": "left"}},
]},
{"widgettype": "Text", "options": {"text": (d_content or "")[:3000], "cfontsize": 0.78, "color": "#475569", "wrap": True, "halign": "left"}},
],
}
if d_comment:
card["subwidgets"].append({
"widgettype": "Text",
"options": {"text": "审核意见: " + d_comment[:300], "cfontsize": 0.75, "color": "#f0a040", "wrap": True, "halign": "left"},
})
subwidgets.append(card)
subwidgets.append(deliverable_card({
"deliverable_type": getattr(d, 'deliverable_type', '') or '',
"title": getattr(d, 'title', '') or '',
"content": getattr(d, 'content', '') or '',
"file_path": getattr(d, 'file_path', '') or '',
"project_id": getattr(d, 'project_id', '') or '',
"review_status": getattr(d, 'review_status', '') or '',
"quality_score": getattr(d, 'quality_score', '') or '',
"review_comment": getattr(d, 'review_comment', '') or '',
}, proj_file_url))
# 5 秒刷新:仅非终态任务刷新。终态(completed/approved/failed/rejected/cancelled)不再变化,
# 切到终态任务时清除定时器;非终态任务设置定时器。params.state 由 binds.params 传入 script。