fix: recommendations run together on one line split into ranked items; old re-check prose falls back to bullets
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
35d4d97504
commit
400f9ec3a0
@ -292,11 +292,7 @@ export function Recheck({ row }: { row: Row }) {
|
||||
{ label: 'Recovered to date', value: recovered == null ? '—' : money(recovered), tone: 'emerald' },
|
||||
]}
|
||||
/>
|
||||
{workStatement(summary) ? (
|
||||
<WorkStatement text={summary} heading="" bare />
|
||||
) : (
|
||||
<p className="text-sm leading-relaxed whitespace-pre-wrap text-muted">{summary}</p>
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
);
|
||||
|
||||
@ -95,7 +95,25 @@ export const CARC: Record<string, string> = {
|
||||
export function recommendations(v: unknown): string[] {
|
||||
const s = str(v).trim();
|
||||
if (!s) return [];
|
||||
const parts = s.split(/\n(?=\s*\d+\.\s)/).map((x) => x.trim()).filter(Boolean);
|
||||
// Ava is asked for one numbered line each, but sometimes runs them together
|
||||
// ("… recovered. 2. Billing: …"). Split at a line break OR at a sentence end
|
||||
// followed by the next number in sequence — "2." after "1.", never "$1.5M".
|
||||
let parts = s.split(/\n(?=\s*\d+\.\s)/).map((x) => x.trim()).filter(Boolean);
|
||||
if (parts.length === 1) {
|
||||
const out: string[] = [];
|
||||
let rest = parts[0];
|
||||
let n = 2;
|
||||
for (;;) {
|
||||
const re = new RegExp(`(?<=[.;:)])\\s+(?=${n}\\.\\s+[A-Z(])`);
|
||||
const m = re.exec(rest);
|
||||
if (!m) break;
|
||||
out.push(rest.slice(0, m.index).trim());
|
||||
rest = rest.slice(m.index).trim();
|
||||
n++;
|
||||
}
|
||||
out.push(rest);
|
||||
parts = out.filter(Boolean);
|
||||
}
|
||||
return parts.length ? parts : [s];
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user