feat(usage): add reasoning effort column
This commit is contained in:
@@ -174,6 +174,35 @@ export function parseDateTimeLocalInput(value: string): number | null {
|
||||
return Math.floor(date.getTime() / 1000)
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化 OpenAI reasoning effort(用于使用记录展示)
|
||||
* @param effort 原始 effort(如 "low" / "medium" / "high" / "xhigh")
|
||||
* @returns 格式化后的字符串(Low / Medium / High / Xhigh),无值返回 "-"
|
||||
*/
|
||||
export function formatReasoningEffort(effort: string | null | undefined): string {
|
||||
const raw = (effort ?? '').toString().trim()
|
||||
if (!raw) return '-'
|
||||
|
||||
const normalized = raw.toLowerCase().replace(/[-_\s]/g, '')
|
||||
switch (normalized) {
|
||||
case 'low':
|
||||
return 'Low'
|
||||
case 'medium':
|
||||
return 'Medium'
|
||||
case 'high':
|
||||
return 'High'
|
||||
case 'xhigh':
|
||||
case 'extrahigh':
|
||||
return 'Xhigh'
|
||||
case 'none':
|
||||
case 'minimal':
|
||||
return '-'
|
||||
default:
|
||||
// best-effort: Title-case first letter
|
||||
return raw.length > 1 ? raw[0].toUpperCase() + raw.slice(1) : raw.toUpperCase()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化时间(只显示时分)
|
||||
* @param date 日期字符串或 Date 对象
|
||||
|
||||
Reference in New Issue
Block a user