mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-16 21:23:44 +08:00
🚀 feature: Add request duration
This commit is contained in:
@@ -11,6 +11,7 @@ const LogTableHead = ({ userIsAdmin }) => {
|
||||
<TableCell>令牌</TableCell>
|
||||
<TableCell>类型</TableCell>
|
||||
<TableCell>模型</TableCell>
|
||||
<TableCell>耗时</TableCell>
|
||||
<TableCell>提示</TableCell>
|
||||
<TableCell>补全</TableCell>
|
||||
<TableCell>额度</TableCell>
|
||||
|
||||
@@ -25,7 +25,25 @@ function renderType(type) {
|
||||
}
|
||||
}
|
||||
|
||||
function requestTimeLabelOptions(request_time) {
|
||||
let color = 'error';
|
||||
if (request_time === 0) {
|
||||
color = 'default';
|
||||
} else if (request_time <= 1000) {
|
||||
color = 'success';
|
||||
} else if (request_time <= 3000) {
|
||||
color = 'primary';
|
||||
} else if (request_time <= 5000) {
|
||||
color = 'secondary';
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
export default function LogTableRow({ item, userIsAdmin }) {
|
||||
let request_time = item.request_time / 1000;
|
||||
request_time = request_time.toFixed(2) + ' 秒';
|
||||
|
||||
return (
|
||||
<>
|
||||
<TableRow tabIndex={item.id}>
|
||||
@@ -54,6 +72,10 @@ export default function LogTableRow({ item, userIsAdmin }) {
|
||||
</Label>
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{' '}
|
||||
<Label color={requestTimeLabelOptions(item.request_time)}> {item.request_time == 0 ? '无' : request_time} </Label>
|
||||
</TableCell>
|
||||
<TableCell>{item.prompt_tokens || ''}</TableCell>
|
||||
<TableCell>{item.completion_tokens || ''}</TableCell>
|
||||
<TableCell>{item.quota ? renderQuota(item.quota, 6) : ''}</TableCell>
|
||||
|
||||
Reference in New Issue
Block a user