fix: Add optional chaining to prevent potential undefined errors in LogsTable #833

This commit is contained in:
1808837298@qq.com
2025-03-09 21:23:33 +08:00
parent 00c2d6c102
commit bd5c261b99

View File

@@ -459,7 +459,7 @@ const LogsTable = () => {
<> <>
<Space> <Space>
{renderUseTime(text)} {renderUseTime(text)}
{renderFirstUseTime(other.frt)} {renderFirstUseTime(other?.frt)}
{renderIsStream(record.is_stream)} {renderIsStream(record.is_stream)}
</Space> </Space>
</> </>
@@ -837,29 +837,29 @@ const LogsTable = () => {
let content = ''; let content = '';
if (other?.ws || other?.audio) { if (other?.ws || other?.audio) {
content = renderAudioModelPrice( content = renderAudioModelPrice(
other.text_input, other?.text_input,
other.text_output, other?.text_output,
other.model_ratio, other?.model_ratio,
other.model_price, other?.model_price,
other.completion_ratio, other?.completion_ratio,
other.audio_input, other?.audio_input,
other.audio_output, other?.audio_output,
other?.audio_ratio, other?.audio_ratio,
other?.audio_completion_ratio, other?.audio_completion_ratio,
other.group_ratio, other?.group_ratio,
other.cache_tokens || 0, other?.cache_tokens || 0,
other.cache_ratio || 1.0, other?.cache_ratio || 1.0,
); );
} else { } else {
content = renderModelPrice( content = renderModelPrice(
logs[i].prompt_tokens, logs[i].prompt_tokens,
logs[i].completion_tokens, logs[i].completion_tokens,
other.model_ratio, other?.model_ratio,
other.model_price, other?.model_price,
other.completion_ratio, other?.completion_ratio,
other.group_ratio, other?.group_rati,
other.cache_tokens || 0, other?.cache_tokens || 0,
other.cache_ratio || 1.0, other?.cache_ratio || 1.0,
); );
} }
expandDataLocal.push({ expandDataLocal.push({