// 共用 CSV 字段转义:list export 与 single-inquiry chat export 都用同一份逻辑。 // 含 `,` `"` `\n` 的字段用 `"..."` 包裹,内部 `"` 转义为 `""`;null/undefined → 空串。 export function csvEscape(v: any): string { const s = v == null ? '' : String(v); return /[",\n]/.test(s) ? '"' + s.replace(/"/g, '""') + '"' : s; }