',
'',
'',
'
',
'function stripInlineMarkdownMarkers(value = '') { return String(value || '') .replace(/\*\*/g, '') .replace(/`/g, '') .trim() } function resolveLegacyAttachmentAssociationField(text = '', label = '') { const escapedLabel = String(label || '').replace(/[.*+?^${}()|[\]\\]/g, '\\$&') const match = String(text || '').match(new RegExp(`${escapedLabel}[::]\\s*([^\\n]+)`, 'u')) return stripInlineMarkdownMarkers(match?.[1] || '') } function renderLegacyAttachmentAssociationField(label = '', value = '', options = {}, context = {}) { const text = String(value || '').trim() if (!text) { return '' } return [ `
' ].join('') } function isNoisyLegacyAssociationText(value = '') { const text = String(value || '').replace(/\s+/g, '').trim() if (!text) { return true } if (!/[\u4e00-\u9fa5A-Za-z]/.test(text)) { return true } if (/^[::;;,,.\-\d]+$/.test(text)) { return true } if (/^[::;;]/.test(text) && /\d{6,}/.test(text)) { return true } return false } function normalizeLegacyAssociationDescription(value = '') { const text = stripInlineMarkdownMarkers(value).replace(/\s+/g, ' ').trim() return isNoisyLegacyAssociationText(text) ? '' : text } export function renderLegacyAttachmentAssociationHtml(content = '', options = {}) { const context = { escapeHtml: options.escapeHtml || ((item) => String(item || '')) } const text = String(content || '') if (!/我已先识别票据,并匹配到最可能的报销单/.test(text)) { return '' } const attachment = resolveLegacyAttachmentAssociationField(text, '本次附件') const summary = resolveLegacyAttachmentAssociationField(text, '识别摘要') const claimNo = resolveLegacyAttachmentAssociationField(text, '推荐关联') const reason = normalizeLegacyAssociationDescription(resolveLegacyAttachmentAssociationField(text, '单据事项')) const basis = resolveLegacyAttachmentAssociationField(text, '匹配依据') return [ '我已先识别票据,并找到一张可能关联的报销单。请确认是否自动归集:
', '