mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-11-26 10:06:31 +00:00
fix(admin-ui): keep sign and precision in CSV, YAML and context labels
CSV export prefixed negative numbers with an apostrophe, which corrupted the data. YAML emitted NaN and Infinity as plain strings. Context windows such as 1500 read as 2k. Numbers now skip the CSV formula guard, non-finite values use YAML float forms, and counts below 10k keep one decimal.
This commit is contained in:
@@ -41,7 +41,7 @@ const CSV_FORMULA_LEAD_CHARS = /^[=+\-@\t\r]/
|
||||
*/
|
||||
function csvField(value: unknown): string {
|
||||
let s = value === null || value === undefined ? '' : String(value)
|
||||
if (CSV_FORMULA_LEAD_CHARS.test(s)) s = `'${s}`
|
||||
if (typeof value !== 'number' && CSV_FORMULA_LEAD_CHARS.test(s)) s = `'${s}`
|
||||
if (!CSV_SPECIAL_CHARS.test(s)) return s
|
||||
return `"${s.replace(/"/g, '""')}"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user