入口字段声明不一致时合并,不把整份草稿判死

同一份文档分十轮起草,各轮对 factory_code 的必填/类型声明常对不上。原先直接抛错,34 条
指标的草稿因为一个字段的 required 不同整份作废。现在必填取并集、类型取更宽,每一处不一致
记一条说明摆在入口字段下面;建图和界面共用同一套合并逻辑。
This commit is contained in:
ThearchyHelios
2026-11-04 09:54:16 +08:00
parent 0d5f9609e7
commit 97cd9498a4
6 changed files with 82 additions and 33 deletions
@@ -497,6 +497,7 @@ export function CaliberDrafts() {
/** 入口字段:发布后按这些字段收参数 */
const renderEntryFields = (draft: CaliberDraft) => {
const fields = draft.entry_fields
const notes = draft.entry_notes ?? []
if (!fields) return null
return (
<div data-draft-entry-fields="">
@@ -518,6 +519,11 @@ export function CaliberDrafts() {
})}
</ul>
) : <p className="text-2xs text-faint">{D.entryFieldNone}</p>}
{notes.length > 0 && (
<ul className="mt-1 space-y-0.5 text-2xs leading-relaxed text-warn" data-draft-entry-notes="">
{notes.map((note, i) => <li key={`${i}:${note}`}>{note}</li>)}
</ul>
)}
</div>
)
}
+2
View File
@@ -566,6 +566,8 @@ export interface CaliberDraft extends CaliberDraftSummary {
metrics?: DraftMetric[]
/** 草稿图的入口字段 */
entry_fields?: DraftEntryField[]
/** 入口字段在各组里声明不一致的地方(必填取并集、类型取更宽),合并时记下的说明 */
entry_notes?: string[]
dropped?: DraftDropped[]
open_questions?: string[]
/** 还没有起草出来的指标名称:续跑跑到轮数上限或没有新指标后剩下的,可以再起一份 */