feat(cms): record hand-run legal translation reviews in the CMS (MITHOME-113)
Validation of legal translations is a manual flow (user decision): copy the prompt, run it in any vendor's model, paste the answer back. The legal validation block now holds the prompt panel and a list of reviews (model, date, verdict, pasted answer, notes) instead of a model list and report link. Approval needs two distinct models whose latest complete review does not reject; a newer review supersedes a model's rejection. The locale path collector now looks through row/collapsible wrappers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
acd1ff2ed9
commit
bff08edafe
@@ -3,6 +3,7 @@ import type { CollectionConfig } from 'payload'
|
||||
import { collectionVersions } from '../lib/payload-versions'
|
||||
import { translationStatusField } from '../globals/fields/translationStatus'
|
||||
import { validateLegalApproval } from '../lib/legal-validation'
|
||||
import { legalValidationGroup } from './fields/legalValidation'
|
||||
|
||||
/**
|
||||
* Mirrors LegalPageContent (proto/src/content/types.ts) — MITHOME-88.
|
||||
@@ -60,30 +61,6 @@ export const LegalPages: CollectionConfig = {
|
||||
// MITHOME-113: legal translations need a recorded multi-model review
|
||||
// before they can be approved (src/lib/legal-validation.ts).
|
||||
translationStatusField(validateLegalApproval),
|
||||
{
|
||||
name: 'legalValidation',
|
||||
label: 'Jogi validáció (angol fordítás)',
|
||||
type: 'group',
|
||||
admin: {
|
||||
position: 'sidebar',
|
||||
description:
|
||||
'Az angol fordítás csak akkor hagyható jóvá, ha legalább két független, magas szintű modell ellenőrizte. ' +
|
||||
'A modell-validáció nem helyettesíti a jogi szakvéleményt.',
|
||||
},
|
||||
fields: [
|
||||
{ name: 'models', label: 'Validáló modellek', type: 'text', hasMany: true },
|
||||
{ name: 'validatedAt', label: 'Validálás dátuma', type: 'date' },
|
||||
{ name: 'reportRef', label: 'Validációs riport (hivatkozás)', type: 'text' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// MITHOME-113 (D8): copyable review prompt built from the saved hu + en texts.
|
||||
name: 'validationPrompt',
|
||||
type: 'ui',
|
||||
admin: {
|
||||
position: 'sidebar',
|
||||
components: { Field: './src/components/admin/LegalValidationPrompt#LegalValidationPrompt' },
|
||||
},
|
||||
},
|
||||
legalValidationGroup,
|
||||
],
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import type { GroupField } from 'payload'
|
||||
|
||||
import { REVIEW_VERDICTS, type ReviewVerdict } from '../../lib/legal-validation'
|
||||
|
||||
const VERDICT_LABELS: Record<ReviewVerdict, string> = {
|
||||
approve: 'Jóváhagyható',
|
||||
'approve-with-changes': 'Javításokkal jóváhagyható',
|
||||
reject: 'Elutasítva',
|
||||
}
|
||||
|
||||
/**
|
||||
* MITHOME-113 (design D7/D8): legal translation validation block — the
|
||||
* copyable prompt panel, then one row per model review with the pasted
|
||||
* answer. Shared across locales: it is metadata about the English text.
|
||||
*/
|
||||
export const legalValidationGroup: GroupField = {
|
||||
name: 'legalValidation',
|
||||
label: 'Jogi validáció (angol fordítás)',
|
||||
type: 'group',
|
||||
admin: {
|
||||
description:
|
||||
'1. Másold ki a promptot, és futtasd le egy magas szintű modellben. 2. A választ rögzítsd új validálásként. ' +
|
||||
'Jóváhagyáshoz legalább két különböző modell el nem utasító validálása kell (modellenként a legutóbbi számít). ' +
|
||||
'A modell-validáció nem helyettesíti a jogi szakvéleményt.',
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'validationPrompt',
|
||||
type: 'ui',
|
||||
admin: { components: { Field: './src/components/admin/LegalValidationPrompt#LegalValidationPrompt' } },
|
||||
},
|
||||
{
|
||||
name: 'reviews',
|
||||
label: 'Validálások',
|
||||
labels: { singular: 'Validálás', plural: 'Validálások' },
|
||||
type: 'array',
|
||||
fields: [
|
||||
{
|
||||
type: 'row',
|
||||
fields: [
|
||||
{ name: 'model', label: 'Modell (pl. Claude Opus 5.5, GPT-5, Gemini)', type: 'text', required: true },
|
||||
{ name: 'reviewedAt', label: 'Dátum', type: 'date', required: true },
|
||||
{
|
||||
name: 'verdict',
|
||||
label: 'Ítélet',
|
||||
type: 'select',
|
||||
required: true,
|
||||
options: REVIEW_VERDICTS.map((value) => ({ label: VERDICT_LABELS[value], value })),
|
||||
},
|
||||
],
|
||||
},
|
||||
{ name: 'result', label: 'A modell válasza (beillesztve)', type: 'textarea', required: true },
|
||||
{ name: 'notes', label: 'Megjegyzés, meghozott döntések', type: 'textarea' },
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
Reference in New Issue
Block a user