fix(ui): 完善界面交互与开发配置
This commit is contained in:
@@ -283,7 +283,7 @@ function renderModelName(record, copyText, t, isRootUser) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---- 使用记录(个人端)呈现:原型为 Ant Design 预设无边框标签与纯文本,不含渐变点、脉冲与悬停缩放 ----
|
||||
// ---- 使用记录(个人端)呈现 ----
|
||||
const RECORD_TYPE_COLORS = {
|
||||
1: 'cyan',
|
||||
2: 'green',
|
||||
@@ -312,19 +312,39 @@ function renderRecordType(type, t) {
|
||||
}
|
||||
|
||||
function renderRecordUseTime(record, t) {
|
||||
const useTime = `${parseInt(record.use_time)}s`;
|
||||
const useTime = parseInt(record.use_time, 10);
|
||||
const validUseTime = Number.isFinite(useTime) && useTime >= 0;
|
||||
const other = getLogOther(record.other);
|
||||
const firstTime =
|
||||
record.is_stream && other?.frt
|
||||
? ` / ${(parseFloat(other.frt) / 1000.0).toFixed(1)}s`
|
||||
: '';
|
||||
const firstMilliseconds = parseFloat(other?.frt);
|
||||
const validFirstTime =
|
||||
Number.isFinite(firstMilliseconds) && firstMilliseconds >= 0;
|
||||
// 首字耗时按实际显示的一位小数判色,避免显示 3.0s / 10.0s 却仍落在上一档。
|
||||
const firstTime = validFirstTime
|
||||
? (firstMilliseconds / 1000).toFixed(1)
|
||||
: null;
|
||||
const useTimeColor = !validUseTime
|
||||
? undefined
|
||||
: useTime < 101
|
||||
? 'green'
|
||||
: useTime < 300
|
||||
? 'gold'
|
||||
: 'magenta';
|
||||
const firstTimeColor = !validFirstTime
|
||||
? undefined
|
||||
: Number(firstTime) < 3
|
||||
? 'cyan'
|
||||
: Number(firstTime) < 10
|
||||
? 'orange'
|
||||
: 'red';
|
||||
return (
|
||||
<span className='usage-record-use-time'>
|
||||
<span>
|
||||
{useTime}
|
||||
{firstTime && <em>{firstTime}</em>}
|
||||
</span>
|
||||
<AntTag variant='filled' color={record.is_stream ? 'cyan' : undefined}>
|
||||
<span className='usage-record-use-time' aria-label={t('用时/首字')}>
|
||||
<AntTag color={useTimeColor}>{validUseTime ? `${useTime}s` : '—'}</AntTag>
|
||||
{record.is_stream && (
|
||||
<AntTag color={firstTimeColor}>
|
||||
{validFirstTime ? `${firstTime}s` : '—'}
|
||||
</AntTag>
|
||||
)}
|
||||
<AntTag color={record.is_stream ? 'blue' : undefined}>
|
||||
{record.is_stream ? t('流') : t('非流')}
|
||||
</AntTag>
|
||||
</span>
|
||||
@@ -336,7 +356,7 @@ const formatRecordNumber = (value) => {
|
||||
return Number.isFinite(number) ? number.toLocaleString('en-US') : value;
|
||||
};
|
||||
|
||||
// Both reference images show the same 2097px table at opposite scroll positions.
|
||||
// 固定列宽保持横向滚动时的对齐,耗时列预留三枚标签的空间。
|
||||
const RECORD_COLUMN_WIDTHS = {
|
||||
time: 152,
|
||||
channel: 85,
|
||||
@@ -345,7 +365,7 @@ const RECORD_COLUMN_WIDTHS = {
|
||||
group: 148,
|
||||
type: 110,
|
||||
model: 225,
|
||||
use_time: 126,
|
||||
use_time: 190,
|
||||
prompt: 110,
|
||||
completion: 110,
|
||||
cost: 136,
|
||||
|
||||
Reference in New Issue
Block a user